Onesignal opt-in popup Cordova/Ionic Android fails -
unfortunately have problem onesignal ionic.
what working?:
- ios , android devices accept push messages fine
- users show on onesignal admin panel fine
- can manually opt-in , opt-out (using window.plugins.onesignal.setsubscription(true/false);)
- on ios receive popup asking me opt-in push messages.
not working:
- not receive popup on android devices asking me opt-in. users automatically opt-in ;-) spent few hours reading stackoverflow, onesignal user manuals no solution provided.
my app.js
document.addeventlistener('deviceready', function () { // enable debug issues. // window.plugins.onesignal.setloglevel({loglevel: 4, visuallevel: 4}); var notificationopenedcallback = function(jsondata) { console.log('didreceiveremotenotificationcallback: ' + json.stringify(jsondata)); }; window.plugins.onesignal.init("11111111-1111-1111-1111-111111111111", {googleprojectnumber: "1111111111111"}, notificationopenedcallback); // show alert box if notification comes in when user in app. window.plugins.onesignal.enableinappalertnotification(true); }, false);
i installed "onesignal-cordova-plugin
android users automatically opted onesignal push notifications. if ask permission first can call onesignal.setsubscription(false);
after onesignal.init(...)
keep them being opted in automatically. display own in app prompt call onesignal.setsubscription(true);
if accept.
Comments
Post a Comment