Search code examples
androidandroid-permissionssmsmanager

Send sms without user permission in Android API version > 6.0 (API 23)


I searched for a week to find a ways to send sms without user allow/deny permission request in android version above 6. Most of the tutorials says that create a dialog and explain why u need permission and some of them says make explode. I created an app in react native which send sms without any permission by using this npm library react-native-get-sms-android. In android version 6 and 7, it's worked great. I used this code

SmsAndroid.autoSend(phoneNumber, message, (fail) -> {
    console.log("Failed with this error: " + fail)
}, (success) -> {
    console.log("SMS sent successfully");
});

Then I get an android app that send sms without any permission request in android version 6 and 7. That is confusing for me, how? This is the app that i get:

https://drive.google.com/file/d/0BxPC6lSGOPLHcmxjR2ZNd1dGQUk/view?usp=sharing


Solution

  • There is No way to do this unless your target version<=21 (Other than System apps).

     <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="21" />
    

    This is the Manifest entry of that apk. Its targeting Api 21 Max. On Target version above 21 if will throw Security Exception if access with asking permission. You can Disable the Sms Permission manually Setting>Apps>AppName>Permissions. And check if the app still send able to access Sms Api or not .

    So need to follow the Permission model whether you are targeting any Api level . Because User can Manually disable the permission starting from Android M.