use of com.google.android.gms.iid.InstanceID in project react-native-push-notification by zo0r.
the class RNPushNotificationRegistrationService method onHandleIntent.
@Override
protected void onHandleIntent(Intent intent) {
try {
String SenderID = intent.getStringExtra("senderID");
InstanceID instanceID = InstanceID.getInstance(this);
String token = instanceID.getToken(SenderID, GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
sendRegistrationToken(token);
} catch (Exception e) {
Log.e(LOG_TAG, TAG + " failed to process intent " + intent, e);
}
}
use of com.google.android.gms.iid.InstanceID in project easy by MehdiBenmesa.
the class RegistrationIntentService method onHandleIntent.
@Override
protected void onHandleIntent(Intent intent) {
String deviceId = intent.getStringExtra("DEVICE_ID");
String deviceName = intent.getStringExtra("DEVICE_NAME");
try {
InstanceID instanceID = InstanceID.getInstance(this);
String registrationId = instanceID.getToken(getString(R.string.gcm_defaultSenderId), GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
App.getInstance().setGcmToken(registrationId);
registerDeviceProcess(deviceName, deviceId, registrationId);
Log.i("token", registrationId);
} catch (IOException e) {
e.printStackTrace();
}
}
Aggregations