open app from flutter web app in mobile if already installed then simply open the app. from web app i can’t open my app that is already installed.
in code when i run in android then my app will open but when i run in chrome then other myapp will not opened
void openMyApp() async {
final myAppUrl = "myapp://open"; // Custom URL scheme for your app
final playStoreUrl = "https://play.google.com/store/apps/details?id=com.mxtech.videoplayer.ad";
// Try to open the app
if (await canLaunchUrl(Uri.parse(myAppUrl))) {
print("launch app");
await launchUrl(Uri.parse(myAppUrl));
} else {
// If the app is not installed, open the Play Store link after a delay
await Future.delayed(const Duration(milliseconds: 1500), () async {
if (await canLaunch(playStoreUrl)) {
await launch(playStoreUrl);
}
});
}
}
}
2
Answers
Is the other app you’re launching made by you? If so, you can tell Android to launch it when a certain URL is encountered, using app links:
https://developer.android.com/training/app-links#android-app-links
You can add an HTTP(S) URL to your manifest file. When the user has your app installed opening the URL will open the app, and if your app is not installed, they are redirected to the HTTP(S) site in their browser (which may redirect them to the Play Store or some other place.
If not, maybe try to clarify the text in your question a little bit. It’s a bit confusing to read.
For open your mobile app from a Flutter web app using a custom URL scheme
AndroidManifest.xml
Info.plist
Flutter code