Support Topics Documentation Slack YouTube Blog

Android Device Registrations Not Showing in Backendless Console

Trying to register an Android device with backendless, I execute the following code per documentation and see no devices registered in the backendless console.

Backendless.Messaging.registerDevice(
    Constants.GCM_SENDER_ID,
    Arrays.asList("default", "test-channel"),
    pushExpiryDate);

I assume there are no exceptions on the client side?

Correct

Could you try running the async version of the method? If there is an exception on the client, it will be delivered to your AsyncCallback instance.

Executed the async version, handleResponse was called on the AsyncCallback with no issues. Still nothing in the console.

Do you run it on a device or emulator?

Samsung Galaxy S5

Have you added the following to the app’s manifest?

<uses-permission android:name="android.permission.INTERNET"/><uses-permission android:name="android.permission.GET_ACCOUNTS"/><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"/>

<receiver android:name=“com.backendless.push.BackendlessBroadcastReceiver” android:permission=“com.google.android.c2dm.permission.SEND”><intent-filter> <category android:name="[APP PACKAGE NAME]"/></intent-filter></receiver>

Yes, my manifest is properly configured.

Sorry, I cannot reproduce the error. Here’s my code, I used another app where I was testing a memory leak (do not let the namespace name confuse you):

package com.backendless.memoryleaktest;


import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;


import com.backendless.Backendless;
import com.backendless.Subscription;
import com.backendless.async.callback.AsyncCallback;
import com.backendless.exceptions.BackendlessFault;
import com.backendless.messaging.Message;


import java.util.Arrays;
import java.util.Date;
import java.util.List;




public class MainActivity extends Activity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        Backendless.initApp(this, "757E349F-C515-5AF3-FF5D-EFF0379BFB00", "115455F0-5317-46D0-FFB2-82712757C900", "v1");
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        registerDevice();
    }




    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }


    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();


        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }


        return super.onOptionsItemSelected(item);
    }


    private void registerDevice()
    {
        Backendless.Messaging.registerDevice(
                "XXXXXXXX",
                Arrays.asList("default", "test-channel"),
                new Date(1451455200000l) );
    }
}

Here’s my manifest:

&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.backendless.memoryleaktest" >
    &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot;/&gt;
    &lt;uses-permission android:name=&quot;android.permission.GET_ACCOUNTS&quot;/&gt;
    &lt;uses-permission android:name=&quot;android.permission.WAKE_LOCK&quot;/&gt;
    &lt;uses-permission android:name=&quot;com.google.android.c2dm.permission.RECEIVE&quot;/&gt;
    &lt;uses-permission android:name=&quot;com.backendless.memoryleaktest.permission.C2D_MESSAGE&quot;/&gt;
    &lt;permission android:name=&quot;com.backendless.memoryleaktest.permission.C2D_MESSAGE&quot; android:protectionLevel=&quot;signature&quot;/&gt;


    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            &lt;intent-filter&gt;
                <action android:name="android.intent.action.MAIN" />


                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
            &lt;/intent-filter&gt;
        </activity>


        &lt;service android:name=&quot;com.backendless.AndroidService&quot;/&gt;
        &lt;receiver android:name=&quot;com.backendless.push.BackendlessBroadcastReceiver&quot; android:permission=&quot;com.google.android.c2dm.permission.SEND&quot;&gt;
            &lt;intent-filter&gt;
                <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
                <action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
                &lt;category android:name=&quot;com.backendless.memoryleaktest&quot;/&gt;
            &lt;/intent-filter&gt;
        &lt;/receiver&gt;
    </application>


&lt;/manifest&gt;

And here’s the device in console:
http://support.backendless.com/public/attachments/35eeaa94a02349255308fc18d5aaf719.jpg</img>

Looks like I had a typo in one of my permissions. I’m surprised that didn’t throw any build errors.

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

And it just failed silently.

Good Day…It seems I cant solve my problem, which is very similar to that of Tim R. My device still is not showing ,now I do not understand because I have followed tutorials on the matter…I have even redone my code in case I might have made some mistakes…

My Manifest
I have declarations set up like you have defined above…not forgetting to replace [APP PACKAGE NAME] with my full app package name.

I have added server api Key to backendless console.
I have also added a sender ID into my app…
Both of which came from googles cloud messaging.

Whenever I register device it throws HandleResponce but My device is not showing, and even the channels ive registered for arent showing…

Any Assistance on this matter is very welcome…