Search code examples
androidandroid-c2dm

How to login google in my android application to use C2DM?


i'm trying to use the C2DM service from google, but i stuck when i try to send the RegistrationIntent. The error was: "AuthTokenCallBack: account missing".

So, searching on google, i found the answer that i'm not logged in google. I want to know:

1) how to login google in "background mode" ? 2) Is the only way using OAuth2.0 ?? 3) With one single account and multiple device, can i send a message to one specific device? 4) I'm noob on android development, do you know any tutorial?


Solution

  • 4)Here you can find a good tutorial about c2dm.

    3) if you get the Device ID and send it to your server when you send registration ID, you can keep these values in your data base with primary key "device id". So in that way you can send message to the specific device.

    here how you can get the device id,

    final String registrationId = intent.getStringExtra("registration_id");
    final String deviceId = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
        `