cordova-plugin-sms
cordova-plugin-sms copied to clipboard
onSMSArrive not working more in adroid 6.0.0
Hello,
I had a device with android 4.4.4 kitkat. The event 'onSMSArrive' work in it. But in android 6.0.0 marshmallow this event not work more.
Someone could help me the reason about this.
+1
Hi @PeaceDeveloper ,
can enableIntercept work on android 4.4.4 kitkat ? thank you for your answer.
Hi @onebook0505,
I have downgraded my phone to 4.4.4 and everything is ok.
+1 on Android 6.0.1 Same issue (device is Xiaomi Redmi Note 3)
any solution? thanx
hi fellow developers) i find a workaround
-
You need to install this plugin https://www.npmjs.com/package/cordova-plugin-android-permissions
-
You need add that code var permissions = cordova.plugins.permissions; permissions.hasPermission(permissions.READ_SMS, checkPermissionCallback, null);
function checkPermissionCallback(status) { if(!status.hasPermission) { var errorCallback = function() { console.warn('SMS permission is not turned on'); } permissions.requestPermission( permissions.READ_SMS, function(status) { if(!status.hasPermission) errorCallback(); }, errorCallback); } }
good luck)
Or if you simply want to receive SMS, try this plugin which features newer APIs and has been thoroughly tested: cordova-plugin-sms-receive