Reputation: 366
I'm trying to set up an application to work with gcm but every time I get the phone_registration_error error according to the Gcm documentation this error means:
Incorrect phone registration with Google.
This phone doesn't currently support GCM.
But I don't understand why my it's not supported, I tested this on a real android device and a emulator with the google api's
My MainActivity:
@Override
public void onCreate(Bundle savedInstanceState) {
checkNotNull(SENDER_ID, "SENDER_ID");
GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
final String regId = GCMRegistrar.getRegistrationId(this);
Log.i(TAG, "registration id ===== "+regId);
if(regId.equals("")){
GCMRegistrar.register(this, SENDER_ID);
} else {
Log.v(TAG, "Already Registred");
}
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
And my manifest:
Upvotes: 3
Views: 7788
Reputation: 1
i looked in your manifest and you forgot to pass GooglePlay Services metadata.
Verify if you have linked GooglePlay services library to your project
Try to add this in your
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
It works nicely for me.
Then recompile and retry. Hope it helps.
Upvotes: 0
Reputation: 1108
I had the same issue and after seraching on the internet for many days I noticed this in the google groups (https://groups.google.com/forum/#!topic/cerberus-support-forum/eJxOsYqkTxo) and tried it and it worked flawlessly for me.
There is something wrong with your Google account. Please try this:
or
Go to Settings -> Apps-> All (on newer versions)
Then check for the GCM id from your app.
If it still doesn't work then remove all your google accounts from the phone and reboot the phone and add the account again.
It worked for me (after implementing many solutions that I got from searching the internet.)
Hope it helps!!
Upvotes: 2
Reputation: 28152
GCM only works on devices that run android 2.2 or newer. Also GCM only works if a google account is installed for the device. This is also the reason google recommend using <uses-permission android:name="android.permission.GET_ACCOUNTS" />
in the manifest so you are sure the device has a google account.
Upvotes: 2