Backendless Support
 
Answered

Unable to register device for push notifications

Good day.

My android device is not registering to receive push notifications.

I have added my server Api key under mobile tab in my console.

I have added SENDER ID into my app eg.( Backendless.Messaging.registerDevice("SENDER ID", myChannels, date, asyncCallback));

Both my SERVER KEY and SENDER ID i got from google cloud messaging.

I have added all my manifest configurations accordingly...

Whenever I have to register device ,then it doesnt show under backendless messaging ,Despite my app running handleResponse.

I FEEL STUCK AS I DO NOT KNOW HOW TO HANDLE THIS MATTER .

Leave a Comment

Comments (10)

photo
1

Hi, Kamohelo.

I've tried with my Android device, and it works.

1)

Did you go through the whole steps of our documentation ?

https://backendless.com/docs/android/doc.html#push-notification-setup-android

2)

You also can try sample from here:

https://github.com/Backendless/Android-SDK/tree/master/samples/MessagingService/pushdemo

3)

What did you receive in return for Backendless.Messaging.registerDevice() call?

photo
1

Hi Oleg..

Yes I have went through every step in the setup process.

as in...

Android Manifest

<uses-permission android.name="android.permission.INTERNET "/>

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

<uses-permission

android.name="com.google.android.c2dm.permission.RECEIVE"/>

<uses-permission

android.name="[APP PACKAGE NAME].permission.C2D_MESSAGE"/>

<permission android.name="[APP PACKAGE NAME].permission.C2D_MESSAGE"

android:protectionLevel="signature"/>

AND FOR MY RECEIVER DECLARATION

<receiver android.name="com.backendless.push.BackendlessBroadcastReceiver"

android:permission ="com.google.android.c2dm.permission.SEND">

<intent-filter>

<action android:name="com.google.android.c2dm.intent.RECEIVE"/>

<action android:name="com.google.android.c2dm.intent.REGISTRATION/>

<category android:name="[APP PACKAGE NAME]"/>

</intent-filter>

</receiver>

<service android:name="com.backendless.push.BackendlessPushService"/>

I HAVE REPLACED [APP PACKAGE NAME]

WITH THE FULL PACKAGE NAME OF MY APP.

And in my main Activity...

List<String> myChannels=new ArrayList<String>();

myChannels.add("XXXX");

Backendless.Messaging.registerDevice("SENDER ID",myChannels, date, AsyncCallback);

To answer your question.

YES. I did follow the documentation and video done on the topic...

As for registering a device?

It always executes handleResponse , with log. i("","App successfully registered ");

I do not know whether I have tackled your questions...

Please suggest where possible as i need to have the issue resolved.

Note* I AM RUNNING THE APP ON A PHYSICAL DEVICE

photo
photo
1

Hello Kamohelo,

what is your application id?

photo
1

My Application ID

"3FF8E15F—F9DF—E3F3—FF16—5B34A6B8CB00"

photo
1

Is everything in Order?

photo
photo
1

Kamohelo,

Please zip and send your project to support@backendless.com

photo
1

Thanks..

note * I have already added my server Api key into my console.

Everything else is inside the project..

photo
1

Hello.

I've tried register device with the GCMsenderId from your googleApp and have registered my device successfully.

But i noticed, that you set two android server keys. It is a bad practice -- you should use one key. Besides this, i think that one of your keys is wrong, please check it.

photo
1

Sorry for this delay.

I think I have now figured it out.

The reason my application wasnt working was that I was testing it on an Android version 4.

Which it seems its not supported.

I tested the app on android version 5 and it worked perfectly.

I hope someday older versions will also support this feature.

photo
1

We only officially support Android 5+, which is SDK version 21+. We're going to mention that in the "Setup" section of the documentation (in case it's not there already).

photo