I am integrating GCM in my application. I did one R&D 2 years back where user can send the detail on the main activity like this
GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
String regId = GCMRegistrar.getRegistrationId(this);
if (regId.equals("")) {
GCMRegistrar.register(this, SENDER_ID);
} else {
Log.v(TAG, "Already registered");
}
Here we can send the SENDER_ID, which was api key(if I recall correctly something like AIxxxxxxxxxxxxxp-xxxxx_xxxx_2xxxxxx2_De).
But how do we send this using the sample app. What is difference between SENDER_Id generated and API_KEY and SERVER_API_KEY. How is this implemented? I havegone through this link https://developers.google.com/cloud-messaging/registration. But got confuse. Can any body help me for these
- SENDER_ID, API_KEY and SERVER_API_KEY. What are those? when and where are they used?
- Use of google-service.json file in debug mode? Already gone through link What does google-services.json really do?
- Do we need to fill the entries inside json manually, or is it filled by android api's? Entried like "oauth_client": [], "api_key": [],
- In below line taken from RegistrationIntentService.java. R.string.gcm_sender_id is basically SENDER_ID or API_KEY String token = instanceID.getToken(getString(R.string.gcm_sender_id), GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
Also is there any tutorial which is implemented based on the latest GCM integration(apart from sample provided by developer.android)
Help will be appreciated.