I would like to create a simple app in Flutter that contains for example 3 button , the event onPressed
in the button should open another external app , is that possible in Flutter and how should I proceed?
Asked
Active
Viewed 5,041 times
0

CopsOnRoad
- 237,138
- 77
- 654
- 440

Abderrazek Ahlamouche
- 3
- 1
- 2
-
1Does this answer your question? [Launch an app from within another (iPhone)](https://stackoverflow.com/questions/419119/launch-an-app-from-within-another-iphone) – Ferdz Nov 13 '19 at 16:22
2 Answers
2
You can use Column
/Row
to create your buttons. And after that you can simply use a RaisedButton
like this:
ElevatedButton(
onPressed: () {
// use android_intent package to open other app
final intent = AndroidIntent(package: "com.android.facebook", action: "action_view");
intent.launch();
},
child: Text("Open Facebook")
)
It's easy to do it in Android using android_intent_plus
and for iOS you can do it natively, this will help you.

CopsOnRoad
- 237,138
- 77
- 654
- 440
-
thank you so much for your help does "your_ui_here" has to be like "com.android.facebook" for example,? and what about IOS ? – Abderrazek Ahlamouche Nov 13 '19 at 15:45
-
Yes, it should be the package name. And for iOS there is no way of launching it. Sorry! – CopsOnRoad Nov 13 '19 at 15:48
-
is it possibile if we work with react native or Ionic ? or i have to develop on swift separatly ? – Abderrazek Ahlamouche Nov 13 '19 at 15:53
-
I am not sure if RN, or Ionic would be able to that, and you may do it natively, here is the [link](https://stackoverflow.com/questions/419119/launch-an-app-from-within-another-iphone) – CopsOnRoad Nov 13 '19 at 16:03
-
although i installed android intent package it always ndicates an error about the Launch et canLaunch as undefined a – Abderrazek Ahlamouche Nov 14 '19 at 08:10
-
I actually combined `url_launcher` code with that, please checkout the updated solution. – CopsOnRoad Nov 14 '19 at 08:15
-
E/flutter (32361): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: 'package:android_intent/android_intent.dart': Failed assertion: line 35 pos 16: 'action != null': is not true. – Abderrazek Ahlamouche Nov 15 '19 at 07:51
-
-
You should pass an `action`, I updated the code, unfortunately I am not on Facebook so not able to test it on my own, please give it a try and let me know. – CopsOnRoad Nov 15 '19 at 08:59
-
i ve tried the package in the link below https://pub.dev/packages/device_apps#-readme-tab- – Abderrazek Ahlamouche Nov 15 '19 at 13:38
-
it worked but it is mentioned that it only for android for the moment – Abderrazek Ahlamouche Nov 15 '19 at 13:39
0
In my case action: "action_view" caused app selection dialog getting opened. We can open specific component using below.
You can try android_intent library for launching external app. Documentation has some sample codes. You may use sample code below.
var map={"AuthParams":authParam};
var intent=AndroidIntent(package:"in.app",arguments: map,componentName: "in.app.ui.splash.SplashActivity",/*action: "action_view"*/);
await intent.launch();

Swapnil Chaudhari
- 542
- 5
- 23