0

environment: jquery mobile 1.0, ios 8.1 ipad (not hacked), cordova

I want to show a push notification permission alert. I tried to follow many solutions but could not get it to work. I am starting push notification using this code:

 function on_load() {
     document.addEventListener("deviceready", function(){
         $.mobile.showPageLoadingMsg();
         console.log(device.platform);

         i_platform = device.platform.toUpperCase();
         if(device.platform.toUpperCase() == 'ANDROID'){
             window.plugins.pushNotification.register(successHandler,errorHandler, {
                 "senderID" : "378913173898",  "ecb" : "onNotificationGCM"});
         } else {
               window.plugins.pushNotification.register(tokenHandler, errorHandler, {
                   "badge":"true", // 뱃지 기능을 사용한다.
                   "sound":"true", // 사운드를 사용한다.
                   "alert":"true", // alert를 사용한다.
                   "ecb": "onNotificationAPN" });
         }
     });
 }

function onNotificationAPN (event){
        if (event.alert){
            navigator.notification.alert(event.alert);
        }
        if (event.sound){
            var snd = new Media(event.sound);
            snd.play();
        }
        if (event.badge){
            window.plugins.pushNotification.setApplicationIconBadgeNumber(successHandler, errorHandler, event.badge);
        }
    }


    function tokenHandler(result){
        //alert('deviceToken:' + result);
        ongetregidios(result);
    }
    function errorHandler(err){
        alert('error:' + err);
    }
    function successHandler(result){
        //              alert('result:'+result);
    }

In appdeletete.m:

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
     (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];

But it is not showing push alert on first start. Thanks for any help.

Kyungman
  • 1
  • 1
  • I am unable to understand what your question is. What do you mean by: *i want showing 'pushnotification permission alert'*? And have you defined the functions `successHandler`, `errorHandler`, `onNotificationGCM`, etc..... – Ajoy Aug 17 '15 at 03:42
  • @Ajoy http://stackoverflow.com/questions/12281620/not-getting-push-notification-alert-request-iphone I speak just a little English. sorry. my problem is simillar case – Kyungman Aug 17 '15 at 03:51
  • Did you try the answers in that question? They seemed to have worked for others – Ajoy Aug 17 '15 at 04:11
  • i tried this answer. and http://www.raywenderlich.com/32960/ also tried this solution .. but not working, – Kyungman Aug 17 '15 at 04:20

0 Answers0