-1

Do I need to ask for permission from a user for launching dialpad(phone call) with the help of url_launcher.

Here is the basic code

launchURL(String number) async {
if (await canLaunch(number)) {
  await launch(number);
} else {
  throw 'Could not launch $number';
 }
}

Just simply launching with a number

3 Answers3

3

Refer this link for an answer. It works. Basically, you need to add the relevant permission in manifest and you are done.

<manifest>

<!-- Nest within the manifest element, not the application element-->
<queries>
    <intent>
        <action android:name="android.intent.action.VIEW" />
        <data android:scheme="https" />
    </intent>
    <intent>
        <action android:name="android.intent.action.DIAL" />
        <data android:scheme="tel" />
    </intent>
    <intent>
        <action android:name="android.intent.action.SEND" />
        <data android:mimeType="*/*" />
    </intent>
</queries>

<application>
    ....
</application>

https://stackoverflow.com/a/65082750/6032764

Himadhar H
  • 106
  • 9
  • Can you please once again review my question I added code for more clarity.. thanku –  May 02 '21 at 18:38
  • Can you review this also https://stackoverflow.com/questions/67319152/permission-and-path-for-hive-flutter?r=SearchResults –  May 03 '21 at 08:56
  • Please refer to this answer. As like the above answer, you need to add the permission in your manifest file. https://stackoverflow.com/questions/11699819/how-do-i-get-the-dialer-to-open-with-phone-number-displayed?answertab=active#tab-top – Himadhar H May 04 '21 at 05:06
0

No, But you have to add internet permission if you are working on an app which wants to access the internet.

Mr Random
  • 1,992
  • 7
  • 20
  • Can you please once again review my question I added code for more clarity.. thanku –  May 02 '21 at 18:38
  • you don't need permission to open a dial pad, the default messaging app or email/Gmail – Mr Random May 03 '21 at 06:09
  • With the number in it? –  May 03 '21 at 08:50
  • Can you review this question https://stackoverflow.com/questions/67319152/permission-and-path-for-hive-flutter?r=SearchResults –  May 03 '21 at 08:56
-1

Actually URL launcher is a pre-configured plugin at pub.dev, just add it to your pubspec.yaml file and you are ready to go.