I'm trying to establish a connection from an android device to the music-streaming-platform deezer. I followed the developers tutorial but already in the beginning there is trouble.
Building the connection works fine, anyway there are'nt any failures in the log.
connection = new DeezerConnectImpl(this, APP_ID);
On calling the connection to authorize with
connection.authorize(this, PERMISSIONS, new ReconnectDialogHandler());
a new (and mysterious?) screen appears in the device-emulator showing this message:
I searched on the developers-page and the internet for a possible solution, but i found nothing helpful... What's the matter of this fault..?
Here's the complete code:
package com.example.deezertest2;
import android.app.Activity;
import android.os.Bundle;
import android.os.StrictMode;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Toast;
import com.deezer.sdk.DeezerConnect;
import com.deezer.sdk.DeezerConnectImpl;
import com.deezer.sdk.DeezerError;
import com.deezer.sdk.DialogError;
import com.deezer.sdk.DialogListener;
import com.deezer.sdk.OAuthException;
import com.deezer.sdk.SessionStore;
public class MainActivity extends Activity {
private final String SECRET = "XXXXX";
public String access_token = "XXXXX";
private final String APP_ID = "XXXXX";
private final static String[] PERMISSIONS = new String[] {"basic_access","offline_access"};
private static final String LOG_TAG = "BaseActvt";
DeezerConnect connection;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
StrictMode.enableDefaults();
System.out.println("onCreate");
connection = new DeezerConnectImpl(this, APP_ID);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public void loginButton(View view){
System.out.println("Button clicked");
connection.authorize(this, PERMISSIONS, new ReconnectDialogHandler());
}
protected class ReconnectDialogHandler implements DialogListener {
@Override
public void onComplete(final Bundle values) {
SessionStore sessionStore = new SessionStore();
sessionStore.save( connection, MainActivity.this );
Toast.makeText( MainActivity.this, R.string.user_authentified, Toast.LENGTH_LONG ).show();
}//met
@Override
public void onDeezerError(final DeezerError deezerError) {
Toast.makeText( MainActivity.this, R.string.deezer_error_during_login, Toast.LENGTH_LONG ).show();
Log.e( LOG_TAG, "DialogError error during login" , deezerError );
}//met
@Override
public void onError(final DialogError dialogError) {
Toast.makeText( MainActivity.this, R.string.deezer_error_during_login, Toast.LENGTH_LONG ).show();
Log.e( LOG_TAG, "DialogError error during login", dialogError );
}//met
@Override
public void onCancel() {
Toast.makeText( MainActivity.this, R.string.login_cancelled, Toast.LENGTH_LONG ).show();
}//met
@Override
public void onOAuthException(OAuthException oAuthException) {
Toast.makeText( MainActivity.this, R.string.invalid_credentials, Toast.LENGTH_LONG ).show();
}//met
}//inner class
}
And the error-log:
Here's the Manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.deezertest2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.deezertest2.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
P.S: Hackitaly , isn't it? :D