Backendless Support
 
Waiting for user's response

NPE in Handling Push Service Registration

Hi there,

I am receiving some in a while NPE with this stacktrace:

  1. java.lang.NullPointerException
  2. at com.backendless.push.BackendlessPushService.handleRegistration (BackendlessPushService.java:220)
  3. at com.backendless.push.BackendlessPushService.handleIntent (BackendlessPushService.java:100)
  4. at com.backendless.push.BackendlessPushService.onHandleIntent (BackendlessPushService.java:66)
  5. non-project frames
  6. at android.app.IntentService$ServiceHandler.handleMessage (IntentService.java:65)
  7. at android.os.Handler.dispatchMessage (Handler.java:99)6at android.os.Looper.loop (Looper.java:137)
  8. at android.os.HandlerThread.run (HandlerThread.java:61)

Looking into the library that BackendlessPushService.java:220 ->

  1. if( error.equals( GCMConstants.ERROR_SERVICE_NOT_AVAILABLE ) )

And the only previous interaction with "error" variable is:

  1. private void handleRegistration( final Context context, Intent intent )
  2. {
  3. String registrationId = intent.getStringExtra( GCMConstants.EXTRA_REGISTRATION_ID );
  4. String error = intent.getStringExtra( GCMConstants.EXTRA_ERROR );

So it seems that sometimes (for any reason) the intent does not contain any String error, this becomes null and so it produces the npe.

Since this is inside the library, any ideas about workaround to avoid these breaks?

Leave a Comment

Comments (6)

photo
1

What version of sdk, do you use?

photo
1

3.0.25

I'm using Backendless 3 and my app ID: 2C218174-5C8D-CC02-FFDA-271D3F676400

photo
1

Ok I'll give it a try to see what happens.

Where can I see the update notes between versions Sergey?

photo
1

here it is release history for 4.0 https://backendless.com/products/release-history/

Please keep in mind that the free plan in Backendless 3.x will be discontinued on November 1st 2017. Unless you plan to migrate to a paid plan in 3.x, I recommend switching to version 4.0

photo
1

Thanks for the tips Sergey.