[object Promise]
但是当我在警报中输出时它显示字符串值。有没有办法在存储中保存该字符串值?
这是我的代码:
initializeApp() {
this.platform.ready().then(() => {
this.statusBar.styleDefault();
this.splashScreen.hide();
FCMPlugin.getToken(
(token) => {
this.saveToken(token);
},
(err) => {
console.log(err);
}
);
this.onNotification();
});
}
saveToken(token: string) {
this.storage.set('token', token);
}
这是返回令牌
的插件代码// GET TOKEN //
else if (action.equals("getToken")) {
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
try {
String token = FirebaseInstanceId.getInstance().getToken();
callbackContext.success(FirebaseInstanceId.getInstance().getToken());
Log.d(TAG, "\tToken: " + token);
} catch (Exception e) {
Log.d(TAG, "\tError retrieving token");
}
}
});