|
|
|
@@ -17,6 +17,7 @@ app.util.OneSignal = (function(){ |
|
|
|
*/
|
|
|
|
cbNotificationOpened = function( jsonData )
|
|
|
|
{
|
|
|
|
console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData));
|
|
|
|
if ( jsonData &&
|
|
|
|
jsonData.notification &&
|
|
|
|
jsonData.notification.payload &&
|
|
|
|
@@ -82,7 +83,26 @@ app.util.OneSignal = (function(){ |
|
|
|
|
|
|
|
if (window.navigator.userAgent === "ProBuddy/2.0 (Android)") {
|
|
|
|
// New cordova app (version 3)
|
|
|
|
//OneSignal.setAppId(appId);
|
|
|
|
|
|
|
|
// Uncomment to set OneSignal device logging to VERBOSE
|
|
|
|
OneSignal.setLogLevel(6, 0);
|
|
|
|
|
|
|
|
// NOTE: Update the setAppId value below with your OneSignal AppId.
|
|
|
|
OneSignal.setAppId(appId);
|
|
|
|
// OneSignal.setNotificationOpenedHandler(function(jsonData) {
|
|
|
|
// console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData));
|
|
|
|
// });
|
|
|
|
|
|
|
|
OneSignal.setNotificationOpenedHandler(cbNotificationOpened);
|
|
|
|
|
|
|
|
//Prompts the user for notification permissions.
|
|
|
|
// * Since this shows a generic native prompt, we recommend instead using an In-App Message to prompt for notification permission (See step 6) to better communicate to your users what notifications they will get.
|
|
|
|
OneSignal.promptForPushNotificationsWithUserResponse(function(accepted) {
|
|
|
|
console.log("User accepted notifications: " + accepted);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
// Old cordova app (version 2)
|
|
|
|
OneSignal
|
|
|
|
|