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() {
|
static async initExpoToken() {
|
||||||
let token = AsyncStorageManager.getInstance().preferences.expoToken.current;
|
let token = AsyncStorageManager.getInstance().preferences.expoToken.current;
|
||||||
if (token === '') {
|
if (token === '') {
|
||||||
await NotificationsManager.askPermissions();
|
try {
|
||||||
let expoToken = await Notifications.getExpoPushTokenAsync();
|
await NotificationsManager.askPermissions();
|
||||||
// Save token for instant use later on
|
let expoToken = await Notifications.getExpoPushTokenAsync();
|
||||||
AsyncStorageManager.getInstance().savePref(AsyncStorageManager.getInstance().preferences.expoToken.key, expoToken);
|
// 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