Guest User

Untitled

a guest
Apr 14th, 2016
1,489
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. function onAppReady() {
  4.     if( navigator.splashscreen && navigator.splashscreen.hide ) {   // Cordova API detected
  5.         navigator.splashscreen.hide() ;
  6.     }
  7. }
  8.  
  9. // document.addEventListener("deviceready", onAppReady, false) ;
  10. // document.addEventListener("onload", onAppReady, false) ;
  11.  
  12. // The app.Ready event shown above is generated by the init-dev.js file; it
  13. // unifies a variety of common "ready" events. See the init-dev.js file for
  14. // more details. You can use a different event to start your app, instead of
  15. // this event. A few examples are shown in the sample code above. If you are
  16. // using Cordova plugins you need to either use this app.Ready event or the
  17. // standard Crordova deviceready event. Others will either not work or will
  18. // work poorly.
  19.  
  20. // NOTE: change "dev.LOG" in "init-dev.js" to "true" to enable some console.log
  21. // messages that can help you debug Cordova app initialization issues.
  22.  
  23.  
  24. (function () {
  25.     "use strict";
  26.     /*
  27.       hook up event handlers
  28.     */
  29.     function register_event_handlers() {
  30.  
  31.         // window.plugins.OneSignal.setLogLevel({logLevel: 4, visualLevel: 4});
  32.  
  33.         var notificationOpenedCallback = function (jsonData) {
  34.  
  35.             alert("Message was \n" + jsonData.message);
  36.         };
  37.  
  38.         window.plugins.OneSignal.init("xc1be215c-tb9998-88888-bb00-b32efe6e02e0", {
  39.                 googleProjectNumber: "1899994998891"
  40.             },
  41.             notificationOpenedCallback);
  42.  
  43.  
  44.  
  45.         // Show an alert box if a notification comes in when the user is in your app.
  46.         //    window.plugins.OneSignal.enableInAppAlertNotification(true);
  47.  
  48.         /* button  #btn_push */
  49.         $(document).on("click", "#btn_push", function (evt) {
  50.  
  51.             window.plugins.OneSignal.sendTag("Group", "My Testgroup");
  52.           //  alert("Registered");
  53.  
  54.             window.plugins.OneSignal.getIds(function (ids) {
  55.                 alert("ID : "+ids.userId + "\nToken "+  ids.pushToken);
  56.             });
  57.  
  58.         });
  59.  
  60.     }
  61.     document.addEventListener("app.Ready", register_event_handlers, false);
  62. })();
RAW Paste Data