Backendless Support
 
Answered

Device Registration

I'm registering my device ob backendless but it gave error java.lang.RuntimeException: Could not register device on Backendless server: Permission denied (missing INTERNET permission?) however i have also added INTERNET and ACCESS_NETWORK_STATE permissions in manifest file. i don't know why it gave error. first it Toast "registered" then the application stopped working. kindly help me here

the permissions are

<user-permission android:name="android.permission.INTERNET" />

<user-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<uses-permission android:name="android.permission.WAKE_LOCK"/>

<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>

<uses-permission android:name="com.example.mubtadanaqvi.backendlesstutorial.permission.C2D_MESSAGE"/>

<permission android:name="com.example.mubtadanaqvi.backendlesstutorial.permission.C2D_MESSAGE"

android:protectionLevel="signature"/>here is my java file code

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

Backendless.initApp(this,AppKey,SecretKey,Version);

Backendless.Messaging.registerDevice(gcmSenderID, "default", new AsyncCallback<Void>() {

@Override

public void handleResponse(Void response) {

Toast.makeText(getBaseContext(),"Registered", Toast.LENGTH_SHORT).show();

}

@Override

public void handleFault(BackendlessFault fault) {

Toast.makeText(getBaseContext(),"fault: "+fault.getMessage(), Toast.LENGTH_SHORT).show();

}

});

}

Leave a Comment

Comments (2)

photo
1

it was a typo mistake, i typed 'uses' instead of user, now i received this error in fault handle method,

fault.code is

IllegalArgumentException

fault.messge is

'Not Allowed to start service Intent {act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gsf(has extras)} without permission com.google.android.c2dm.permission.RECEIVE

photo
1

its solved. i registered my device.