suresh
suresh

Reputation: 417

Emulator only got GCM messages?

I have prepared one application for GCM with help of GCM: Getting Started. It is working fine.I got messages in emulator.I have installed my app in device.when i send messages from server emulator only got the messages,but devices not getting messages.I think have done some mistake some where please guide me.

Upvotes: 2

Views: 1530

Answers (2)

Bhavesh Patadiya
Bhavesh Patadiya

Reputation: 25830

Did you register the device with GCM? for getting the Registration ID you have to do the Following code:

inside onCreate() method, add the following code:

GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
final String regId = GCMRegistrar.getRegistrationId(this);
if (regId.equals("")) {
  GCMRegistrar.register(this, SENDER_ID);
} else {
  Log.v(TAG, "Already registered");
}

here you will get regId which you must have to sent it to the Server so that server can send push notification to Device which has the above regId.

for More Help you can refer here

Upvotes: 2

sique
sique

Reputation: 241

check GCMRegistrar log. device cant register in GCM , cant got message if success regist, you see device regId in log console.

or

check your 3rd party server or DB.

Upvotes: 1

Related Questions