Backendless Support
 
Answered

Push Notifications with Firebase

Hello, now that google cloud messaging has changed to firebase cloud messaging, are there any new additional steps taken to setup push notifications on backendless, is it even possible?

Best Answer
photo

Hi Edgar,

We got the project. By looking at it, it appears you are working with Backendless 4 (which is available as a self-hosted version of the product), is that correct?

If not and you're using the Cloud version of Backendless, please make sure to change the library reference as shown in the image below:

41671f0f8c7af21d40f671923a204545

Regards,

Mark

Leave a Comment

Comments (12)

photo
1

Hi Edgar,

The instructions on the following page in our documentation are current and valid. No additional steps are required:

https://backendless.com/documentation/messaging/android/messaging_push_notification_setup_androi.htm

Could you please confirm if it worked for you?

Regards,

Mark

photo
1

Hello Mark,

I created my app on Firebase, I actually imported it because It already existed on my google developer console, I'm also using the google maps API..anyway after setting it up on the Firebase console, I went back to the google developer console and there I found three Keys auto created as a result of the cloud messaging being enabled, there's an Android key, a server key and a browser key. I copied the server key to Backendless mobile settings, imported the backendless library and included the required permissions in my app manifest. Now the app itself runs properly no crashes and It says its been registered properly but I dont see anything on the devices screen in the messaging section...

  1. @Override

    public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    //----------Initialize Backendless

    Backendless.initApp(getActivity().getApplicationContext(), "XXXXXXX-2CFC-07B5-FF77-C32708EB7A00",

    "82F0D240-2439-4D10-FF4F-XXXXXXXXXXX");

    //------Register User First arg is project ID from Google dev console

    Backendless.Messaging.registerDevice("44XXXXXXXX8", new AsyncCallback<Void>() {

    @Override

    public void handleResponse(Void response) {

    Log.i("BACKEND", "Device Registered successfully");

    }

    @Override

    public void handleFault(BackendlessFault fault) {

    Log.e("BACKEND", "Registration error " + fault.getMessage());

    }

    });

photo
1

Ok now I'm getting this error;

  1. FATAL EXCEPTION: IntentService[BackendlessPushService]
  2. Process: com.buffaloit.ek.bitsacab, PID: 27753
  3. java.lang.RuntimeException: AUTHENTICATION_FAILED
  4. at com.backendless.push.BackendlessPushService.onError(BackendlessPushService.java:88)
  5. at com.backendless.push.BackendlessPushService.handleRegistration(BackendlessPushService.java:233)
  6. at com.backendless.push.BackendlessPushService.handleIntent(BackendlessPushService.java:98)
  7. at com.backendless.push.BackendlessPushService.onHandleIntent(BackendlessPushService.java:65)
  8. at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
  9. at android.os.Handler.dispatchMessage(Handler.java:102)
  10. at android.os.Looper.loop(Looper.java:136)
  11. at android.os.HandlerThread.run(HandlerThread.java:61)

photo
1

Hi Edgar,

Just to make sure, did you follow the instructions from the page in the docs I referenced?

Regards,

Mark

photo
1

yep, I read the documentation over and over confirming each step..I did not include the custom handling of push notifications yet, still not getting anything on the devices screen... all I get is that nasty exception

photo
1

Hello, Edgar Kealeboga,

I can not reproduce your issue, I have followed this doc https://backendless.com/documentation/messaging/android/messaging_push_notification_setup_androi.htm everything works fine

photo
1

I made a separate app to test now I'm getting this error:

  1. java.lang.RuntimeException: Could not register device on Backendless server: https://api.backendless.com/262AFD91-3D3D-55B3-FFD5-2EA124658600/2FCDA41C-8F13-E438-FF7B-2D19788F9700/binary
  2. at com.backendless.push.BackendlessBroadcastReceiver.onError(BackendlessBroadcastReceiver.java:83)
  3. at com.backendless.push.BackendlessPushService$1.handleFault(BackendlessPushService.java:252)
  4. at com.backendless.Messaging$2.handleFault(Messaging.java:255)
  5. at com.backendless.async.message.AsyncMessage$FaultHandler.handle(AsyncMessage.java:83)
  6. at com.backendless.async.message.AsyncMessage.handleCallback(AsyncMessage.java:41)
  7. at com.backendless.core.AndroidCarrier$1.handleMessage(AndroidCarrier.java:37)
  8. at android.os.Handler.dispatchMessage(Handler.java:98)
  9. at android.os.Looper.loop(Looper.java:136)
  10. at android.app.ActivityThread.main(ActivityThread.java:5590)
  11. at java.lang.reflect.Method.invokeNative(Native Method)
  12. at java.lang.reflect.Method.invoke(Method.java:515)
  13. at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1280)
  14. at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1096)
  15. at dalvik.system.NativeStart.main(Native Method)

photo
1

Could you zip up your project, upload to either google drive or dropbox and email the link for it to support@backendless.com ?

photo
1

I've just sent the email, sorry for the late response, I'm a bit busy at the moment. Hope you can get to the bottom of it. Thanks in advance.

Regards

photo
1

Hi Edgar,

We got the project. By looking at it, it appears you are working with Backendless 4 (which is available as a self-hosted version of the product), is that correct?

If not and you're using the Cloud version of Backendless, please make sure to change the library reference as shown in the image below:

41671f0f8c7af21d40f671923a204545

Regards,

Mark

photo
1

Yes, the library I used is for the project is 4.0,0-beta1 but I haven't migrated to it on the console...let me try the one you suggested....

photo
1

Yep, that was the problem...it works perfectly now. Thanks Guys

photo