I am trying to send sms from a device using the sms manager by adding the corodova send sms plugin. This application works fine until the android6.0 device sends sms, but when I tried to send sms from android7.0, it shows me the following security exception. Before sending sms, he asks for permission, and I also gave permission.
An exception:
java.lang.SecurityException: at android.os.Parcel.readException(Parcel.java:1683) at android.os.Parcel.readException(Parcel.java:1636) at com.android.internal.telephony.IPhoneSubInfo$Stub$Proxy.getGroupIdLevel1(IPhoneSubInfo.java:583) at android.telephony.TelephonyManager.getGroupIdLevel1(TelephonyManager.java:2163) at android.telephony.SmsMessage.hasEmsSupport(SmsMessage.java:854) at com.android.internal.telephony.SmsMessageBase.calcUnicodeEncodingDetails(SmsMessageBase.java:409) at com.android.internal.telephony.gsm.SmsMessage.calculateLength(SmsMessage.java:796) at android.telephony.SmsMessage.fragmentText(SmsMessage.java:354) at android.telephony.SmsManager.divideMessage(SmsManager.java:450) at com.cordova.plugins.sms.Sms.send(Sms.java:143) at com.cordova.plugins.sms.Sms.access$400(Sms.java:22) at com.cordova.plugins.sms.Sms$1.run(Sms.java:102) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:761)
Code for sending SMS:
var smsdata = ' தேதி: ' + this.currentbilldate + ' பில் எண்: ' + this.save_details.vehicle_bill_no + ' எடுக்கப்பட்ட பொருட்களின் விவரங்கள்: ' + this.smselements.toString() + ', மொத்த பொருட்கள்: ' + totalcount + ''; var farmermobileno = this.entry_details.farmer_mobile_no; this.sms.send(farmermobileno, smsdata).then((result) => { this.commonService.presentToast('Message sent successfully'); }, (error) => { console.log('Error in sending message', error); this.commonService.presentToast('Message Failed'); });
Plugin name: Cordova-sms-plugin
Sending text to SMS:
var smsdata = 'உங்கள் கணக்கில் அன்று 23-8-17 அட்வான்ஸ் தொகை ₹500 வழங்கப்பட்டுள்ளது.இருப்பு ₹5000';
android cordova ionic3
Nidhin kumar
source share