TestGcm icon indicating copy to clipboard operation
TestGcm copied to clipboard

How can I get the GCM_TOKEN?

Open azamuddin opened this issue 9 years ago • 5 comments

azamuddin avatar Jan 28 '16 15:01 azamuddin

Hello. This is an old issue, but if anyone else comes here wondering:

GcmAndroid.addEventListener('register', function(token){
  console.log('send gcm token to server', token);
});

There the token is sent to console.log. You can then see it with:

adb logcat '*:S ReactNative:V ReactNativeJS:V'

fermuch avatar May 15 '16 12:05 fermuch

hey i am getting this while adb logcat GcmAndroid.launchNotification internal', undefined please help

dg92 avatar Jun 13 '16 10:06 dg92

i have tried this but i cant get anything on my console.log . It doesnt show any token . @fermuch

xphaul avatar Jul 04 '16 07:07 xphaul

@xphaul are you trying in a device or an emulator?

fermuch avatar Jul 04 '16 13:07 fermuch

@fermuch im on a device . an i got the device token now . My problem is now is that app cant listen on incoming notifications when it is on background state

GcmAndroid.addEventListener('notification', function(notification){ if(!GcmAndroid.isInForeground) { console.log('background') } });

this function doesnt work if app is on background and received a notification

xphaul avatar Jul 05 '16 11:07 xphaul