使用 navigator.notification.alert 而不是普通的 js 警报
Using navigator.notification.alert instead of normal js alert
我开发了一个 phonegap 应用程序,我从 onesignal
的这两个设置中收到了一些丑陋的 js 警报:
// Show an alert box if a notification comes in when the user is in your app.
window.plugins.OneSignal.setSubscription(true);
//activating the reception of push notification when the app is working also
window.plugins.OneSignal.enableNotificationsWhenActive(true);
我可以自定义这些吗,所以我使用 cordovas navigator.notification.alert
而不是普通的 js alert
。
是的,这可以定制。首先,您应该将 enableNotificationsWhenActive 设置为 false。
接下来,当 isActive
为真时,请遵循 notificationOpenedCallback 和 运行 navigator.notification.alert(jsonData.message)
的文档。
我开发了一个 phonegap 应用程序,我从 onesignal
的这两个设置中收到了一些丑陋的 js 警报:
// Show an alert box if a notification comes in when the user is in your app.
window.plugins.OneSignal.setSubscription(true);
//activating the reception of push notification when the app is working also
window.plugins.OneSignal.enableNotificationsWhenActive(true);
我可以自定义这些吗,所以我使用 cordovas navigator.notification.alert
而不是普通的 js alert
。
是的,这可以定制。首先,您应该将 enableNotificationsWhenActive 设置为 false。
接下来,当 isActive
为真时,请遵循 notificationOpenedCallback 和 运行 navigator.notification.alert(jsonData.message)
的文档。