IBM MobileFirst 7.0 WLClient.Push.subscribe method not invoked on iOS platform -
i developing mobilefirst 7.0 hybrid app , i've implemented notification module ios , android platform.
i using wl.client.push
api , works fine on android platform gcm (android < 6.0 - on android 6.0 permission policy changed , it's similiar ios, have not tried on android 6.0 yet).
i have problem ios. when try invoke wlclient.subscribe
method when first start app on ios, subscribe method never invoked. can't find errors in logs on was, don't see response method- success or failure. thought problem related permission policy on ios, because when click allow notifications on native popup when app starting, subscribe()
method still not invoked, when logging app second time method invoked. e.g. on ios 9.3.1 subscribe method when logging invoked , not :(
i think it's random me , don't know, it's problem code, apns in country or problem mobilefirst push api?
registernotifications.dosubscribe = function () { try{ wl.client.push.subscribe("mypush", { onsuccess: dosubscribesuccess, onfailure: dosubscribefailure }); } catch(e){ //fix webbrowser //alert("exception during subscribe notifications"); console.log("exception during subscribe notifications!"); ewd.debug("exception during subscribe notifications!", "request_top_up"); } function dosubscribesuccess() { console.log("you subscribed successfully!"); ewd.debug("you subscribed successfully!","request_top_up"); //alert("you subscribed successfully!"); } function dosubscribefailure() { console.log("dosubscribefailure"); ewd.debug("dosubscribefailure", "request_top_up"); //alert("dosubscribefailure"); }}; registernotifications.ispushsubscribed = function() { var issubscribed = false; try{ if (wl.client.push){ issubscribed = wl.client.push.issubscribed('mypush'); } } catch(e) { //fix webbrowser //alert("registernotifications.ispushsubscribed: catch" ); } console.log(issubscribed); ewd.debug("registernotifications.ispushsubscribed: "+ issubscribed, "request_top_up"); return issubscribed;}; registernotifications.ispushsupported = function () { var issupported = false; try { if (wl.client.push){ issupported = wl.client.push.ispushsupported(); } } catch(e) { //fix webbrowser } ewd.debug("registernotifications.ispushsupported: " + issupported, "request_top_up"); console.log(issupported); return issupported;}; if (wl.client.push) { // alert("in try in render wl.client.push"); wl.client.push.onreadytosubscribe = function() { wl.client.push.registereventsourcecallback("mypush", "notificationadapter", "pusheventsource", pushnotificationreceived); ewd.debug("onreadytosubscribe: ready subscribe user!", "request_top_up"); if (registernotifications.ispushsupported() && !registernotifications.ispushsubscribed()) { ewd.debug("now, can call dosubscribe method!", "request_top_up"); registernotifications.dosubscribe(); }else{ ewd.debug("your platform not supported or subscribed!", "request_top_up"); }};} else { ewd.debug("wl.client.push loading library problem!", "request_top_up");}
ios 9.1.0 first time(wi-fi network):
- registernotifications.ispushsupported() return true
registernotifications.ispushsubscribed() return false
registernotifications.ispushsubscribed() not invoked, if click allow notification on ios native popup - second time(wi-fi network):
registernotifications.ispushsupported()
return true.registernotifications.ispushsubscribed()
return false.registernotifications.ispushsubscribed()
invoked, can send notifications users.
on ios 9.3.1: random, works not :(
- first time(wi-fi network):
registernotifications.ispushsupported()
not invoked.registernotifications.ispushsubscribed()
not invoked.registernotifications.ispushsubscribed()
not invokedwl.client.push.onreadytosubscribe
never called. - second time(wi-fi network, after kill app):
registernotifications.ispushsupported()
return true
registernotifications.ispushsubscribed()
return false
registernotifications.ispushsubscribed()
not invoked - third time(wi-fi network, after kill app):
registernotifications.ispushsupported()
return true
registernotifications.ispushsubscribed()
return false
registernotifications.ispushsubscribed()
invoked, can send notifications users.
Comments
Post a Comment