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.