How can I request sms permissions in Flutter/Dart?

Viewed 2577

I'm using permission_handler to request video and audio, but I can't get it to request permission to send SMS. I don't know if this is an issue with my phone's settings, my phone (Motorola Moto X4 XT1900-1), my phone's OS (Android 9), permission_handler, Flutter, Dart, my implementation, or something else.

Once I've successfully received permission to send SMS, I plan to send SMS in the background without user input. I know how to pull up the messaging app with a message and recipient and have the user press send, but I'd rather not do it that way; I'm trying to take a no UI approach to it.

Here are some relevant lines of code.

pubspec.yaml:

permission_handler:

home.dart:

import 'package:permission_handler/permission_handler.dart';
await [ Permission.camera, Permission.microphone, Permission.sms ].request();

The app will correctly request permission for camera and microphone, but not for sms. Any help is appreciated.

2 Answers

enter image description here

the problem i resolve by change version;

5.0.0 version can't correctly request sms ;

need change version ;it can work;

Try adding this code in androidmanifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="yourappname>
<uses-permission android:name="android.permission.SEND_SMS" />
<application>
.....
</application>
</manifest>
Related