2

I have a button for mailing user, but when i click button it showing platform exception

launchUrl(Uri(path: "mailto:${baseSetting.baseSetting?.mail ?? ''}"))

E/flutter ( 1164): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: PlatformException(ACTIVITY_NOT_FOUND, No Activity found to handle intent { mailto%3Asales@sookh.com }, null, null)
E/flutter ( 1164): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
E/flutter ( 1164): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:167:18)
E/flutter ( 1164): <asynchronous suspension>
E/flutter ( 1164): #2      launchUrlString (package:url_launcher/src/url_launcher_string.dart:39:10)
E/flutter ( 1164): <asynchronous suspension>
E/flutter ( 1164): #3      launchUrl (package:url_launcher/src/url_launcher_uri.dart:55:10)
E/flutter ( 1164): <asynchronous suspension>

please help how to solve this

Ichinator
  • 357
  • 2
  • 11
Mamun Hossain
  • 21
  • 1
  • 5

2 Answers2

0

You may try the answer in this post : Android: No Activity found to handle Intent error? How it will resolve

but in my app where i got this error, it was due to the emulator i used not having gmail installed on it. upon getting one with gmail everything worked fine(obviously my app is opening gmail and not contacts). so make sure you have yours installed

0

You have to add the following queries in AndroidManifest.xml file above

<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>
. . . =>
Mamun Hossain
  • 21
  • 1
  • 5