Open makis73 opened 3 years ago
It does not work on Andriod 11 for me.
@tilakdewangan @makis73
You need to update your Manifest file with
<uses-permission android:name="android.permission.SEND_SMS" />
<queries>
<intent>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="smsto"/>
</intent>
</queries>
And request SMS permission at runtime.
@vizhan-lanars Thanks for your answer. I tested and found out that we only need the <queries>
tag, not the runtime SEND_SMS
permission itself.
<!-- SEND_SMS runtime permission not needed -->
<queries>
<intent>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="smsto"/>
</intent>
</queries>
@vizhan-lanars Thanks for your answer. I tested and found out that we only need the
<queries>
tag, not the runtimeSEND_SMS
permission itself.<!-- SEND_SMS runtime permission not needed --> <queries> <intent> <action android:name="android.intent.action.SENDTO" /> <data android:scheme="smsto"/> </intent> </queries>
Thanks for this, it worked.
WHERE TO PASTE THIS IN WHICH SECTION?
WHERE TO PASTE THIS IN WHICH SECTION?
In android/app/src/main
and it's AndroidManifest.xml
WHERE TO PASTE THIS IN WHICH SECTION?
In
android/app/src/main
and it'sAndroidManifest.xml
Directly after
The queries tag in the Android manifest.xml file should be placed outside the application tag.
Here's an example of the correct placement of the queries tag in the Android manifest.xml file:
<manifest ... > <application ... >
<queries>
<intent>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="smsto"/>
</intent>
</queries>
Placing the queries tag inside the application tag will result in a compilation error.
This Worked for me on Pixel 6 Android 13. Thx
Thanks @vizhan-lanars , my app was working perfectly fine before adding your suggested extra code but a week ago it stopped sending sms with the platform exception and I tried your solution and it worked :)
Also would appreciate any possible explanations to my query that : app was working perfectly fine before , with only single line config of :- <uses-permission android:name="android.permission.SEND_SMS" />
but stopped working a week ago and now today after adding these lines :-
<queries>
<intent>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="smsto"/>
</intent>
</queries>
to above-old configuration , the app started working fine again..!!!! what could be the reason for the same?
In addition to the lines provided by @vizhan-lanars (thank you!!!!!!) I had to manually give the app permissions on my phone (by going to Settings -> Permission Manager -> SMS -> allow <APP NAME>
) to actually send the message without opening the app (using the sendDirect
parameter of _sendSMS
). Otherwise, it works! (by opening the messaging app of my phone).
EDIT: Upon further read of the code here: https://github.com/fluttercommunity/flutter_sms/issues/67#issue-1275608493 I was able to add a runtime permission request using permission_handler
and it solved my issue. Hope this helps!
Hello and congrats for your work ! 2.3.1 works on Android 6 - 11 but not on Android 5 ! PlatformException(device_not_capable, The current device is not ....... ! Your example also. Why can this happens ? Something about permissions ?