Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29795

getExpoPushTokenAsync not responding on Android testing device

$
0
0

i know there have been a few similar post regarding “standalone” devices out there, but this is about a (still) testing device in connection with the Expo XDE.

In short:

I am trying to get the Push Notification token using getExpoPushTokenAsyncthis is working perfectly for iphones, but not for android phones

Code:token = await Notifications.getExpoPushTokenAsync();–> return token for iphone, but nothing happens on Android (not even any following console.log)

just before:const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);–> returns “granted”

I am using:“expo”: “^36.0.0”,

// if no existing permission ask user for permission   console.log("status: -"+ status +'-');    if (status !== 'granted') {      // Android remote notification permissions are granted during the app      // install, so this will only ask on iOS      const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);      finalStatus = status;    }    // If no permission, exit ...    if (finalStatus !== 'granted') {      return;    }    // Get the token that uniquely identifies this device    console.log("BEFORE TOKEN....");    let token = await Notifications.getExpoPushTokenAsync();    console.log("TOKEN: "+ token);

Output Android:

status: -granted-TOKEN BEFORE....

Output iPhone:

status: -granted-TOKEN BEFORE....TOKEN: ExponentPushToken[Xxxxx_Xxxxxxxxxxxxxx]

Viewing all articles
Browse latest Browse all 29795

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>