Opening Yahoomail app from a flutter app using urllauncher not working

136 Views Asked by At

Trying to launch yahoo mail app with URL launcher package but it is not working.

Trying to launch yahoo mail app with URL launcher package but it is not working. Tried all possibilties but not working, working smoothly in IOS but not on android -- Added intents to android manifest xml files also

Please help !

1

There are 1 best solutions below

0
Chris Koepke On

It seems that the url_launcher lib creates an intent with the "VIEW" action in Android which is not the way a mailto request should normally be handled. Maybe this is the reason why the Yahoo mail client does not work in this case. Usually a "SENDTO" action is required.

You can use the android_intent_plus package to create your own intent:

Future<bool> _createMailUsingAndroidIntent() async {
   const intent = AndroidIntent(
     action: 'android.intent.action.SENDTO',
     data: 'mailto:[email protected]',
   );
   try {
     await intent.launch();
     return true;
   } on PlatformException catch (_) {
     return false;
   }
}

Of course this is only needed for Android, for iOS you can use the url_launcher lib.