Backendless Support
 
Solved

Register device cause crash

My apps start getting crash when register device

APPLICATION_ID 161CA8CE-7AC3-2596-FF77-73632D3ED600

It crashed both on all android and ios devices.

On android device, it return a success message "register device: Device has been subscribed to channel userwCF3H4FNrmWQ5IshvmyAGUToDhf2", but then 30 seconds after, it crash with "Could not register device on Backendless server: timeout".

For iOS, app get freeze with register device function, no success or error message and finally crash.

I have been using those code in past 4 months, the problem start on last Friday morning and was solved for while and get back this morning,

See this http://support.backendless.com/topic/urgent-register-device-cause-crash

java.lang.RuntimeException: Could not register device on Backendless server: timeout

at com.backendless.push.BackendlessPushService.onError(BackendlessPushService.java:88)

at com.backendless.push.BackendlessPushService$1.handleFault(BackendlessPushService.java:252)

at com.backendless.Messaging$2.handleFault(Messaging.java:255)

at com.backendless.async.message.AsyncMessage$FaultHandler.handle(AsyncMessage.java:83)

at com.backendless.async.message.AsyncMessage.handleCallback(AsyncMessage.java:41)

at com.backendless.core.AndroidCarrier$1.handleMessage(AndroidCarrier.java:37)

at android.os.Handler.dispatchMessage(Handler.java:98)

at android.os.Looper.loop(Looper.java:158)

at android.app.ActivityThread.main(ActivityThread.java:7224)

at java.lang.reflect.Method.invoke(Native Method)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Android code

  1. try {
  2. List<String> channels = new ArrayList<String>();
  3. channels.add(channel);
  4. Calendar cal = Calendar.getInstance();
  5. cal.add(Calendar.YEAR, 10);
  6. Date expiration = cal.getTime();
  7. Log.e(“register device”, “expiration ” + expiration);
  8. Log.e(“register device”, “channels ” + channels);
  9. Backendless.Messaging.registerDevice(context.getString(R.string.google_project_number), channels, expiration, new AsyncCallback<Void>() {
  10. @Override
  11. public void handleResponse(Void response) {
  12. if(DEBUG) Timber.v(“Device has been subscribed to channel ” + channel);
  13. Log.e(“register device”, “response ” + response);
  14. Log.e(“register device”, “Device has been subscribed to channel ” + channel);
  15. }
  16. @Override
  17. public void handleFault(BackendlessFault fault) {
  18. if(DEBUG) Timber.v(“Device subscription failed. ” + fault.getMessage());
  19. Log.e(“register device”, “Device subscription failed. ” + fault.getMessage());
  20. }
  21. });
  22. } catch (Exception e) {
  23. e.printStackTrace();
  24. Log.e(“register device”, “Device subscription failed. ” + e.getMessage());
  25. return false;
  26. }

iOS code

  1. -(void) subscribeToPushChannel: (NSString *) channel {

    NSLog(@"subscribeToPushChannel %@", channel);

    if (!_isSubscribed) {

    channel = [self safeChannel:channel];

    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

    NSData *token = [defaults objectForKey:@"backendless_deviceToken"];

    if (token) {

    @try {

    NSCalendar *cal = [NSCalendar currentCalendar];

    NSDate *expiration = [cal dateByAddingUnit:NSCalendarUnitYear value:10 toDate:[NSDate date] options:0];

    NSString * deviceRegistrationId = [backendless.messaging registerDevice:token channels:@[channel] expiration:expiration];

    NSLog(@"subscribeToPushChannel success deviceRegistrationId: %@", deviceRegistrationId);

    _isSubscribed = YES;

    }

    @catch (Fault * fault) {

    NSLog(@"subscribeToPushChannel FAULT = %@ <%@>", fault.message, fault.detail);

    }@finally {

    }

    }

    }

    }

Leave a Comment

Comments (4)

photo
1

Hello Allan

We've create an internal ticket BKNDLSS-16710 for investigation your issue, and we will notify you here about any result

And I've switched mode of the topic from private to normal, private topic is available only for Managed Backendless and Backendless PRO plans

Thanks, Vladimir

photo
1

Do you still have the problem?

photo
1

The problem was gone yesterday afternoon at 3pm, but it's backed today about half hour ago. The problem seem to come back at about 9:30am every day since last Friday.

photo
1

It's working now.

photo