I have a chat app using Google cloud messaging. I have to migrate to FCM because of API Key. I used this tutorial: GCM to FCM but When I start the app, it closes immediately. This is the part of Gcmintentservice. I didn't understand what I should make Gcmintentservice.
protected void onHandleIntent(Intent intent) {
String key = intent.getStringExtra(KEY);
switch (key) {
case SUBSCRIBE:
// subscribe to a topic
String topic = intent.getStringExtra(TOPIC);
subscribeToTopic(topic);
break;
case UNSUBSCRIBE:
String topic1 = intent.getStringExtra(TOPIC);
unsubscribeFromTopic(topic1);
break;
default:
// if key is not specified, register with GCM
registerGCM();
}
}
When I delete inside of onHandleIntent function, App is working and there is no error but instant messaging is not working.