forked from vergnet/application-amicale
Fixed crash on emulator
This commit is contained in:
parent
4c6905a5d5
commit
72693d14f2
1 changed files with 8 additions and 4 deletions
|
@ -94,10 +94,14 @@ export default class NotificationsManager {
|
|||
static async initExpoToken() {
|
||||
let token = AsyncStorageManager.getInstance().preferences.expoToken.current;
|
||||
if (token === '') {
|
||||
await NotificationsManager.askPermissions();
|
||||
let expoToken = await Notifications.getExpoPushTokenAsync();
|
||||
// Save token for instant use later on
|
||||
AsyncStorageManager.getInstance().savePref(AsyncStorageManager.getInstance().preferences.expoToken.key, expoToken);
|
||||
try {
|
||||
await NotificationsManager.askPermissions();
|
||||
let expoToken = await Notifications.getExpoPushTokenAsync();
|
||||
// Save token for instant use later on
|
||||
AsyncStorageManager.getInstance().savePref(AsyncStorageManager.getInstance().preferences.expoToken.key, expoToken);
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue