How do i make flutter application that open another app within it and not webview

Viewed 1279

I have tried to make flutter app in which within it I have a list of another application. I want on tap of any app within a list to open that app, like the code below. How to do it in flutter ?

openExternalApp : function(packageName) {
 
  try {
    var KonyMain = java.import("com.konylabs.android.KonyMain");
    var context = KonyMain.getAppContext();
    var pm = KonyMain.getAppContext().getPackageManager();
    var intent = pm.getLaunchIntentForPackage(packageName);
 
    if(intent !== null && intent!== undefined){
      context.startActivity(intent);
    }
    else {
      var url = "https://play.google.com/store/apps/details?id="+packageName;
      kony.application.openURL(url);
    }
  } catch(e) {
    kony.print("error opening app external: "+e)
  } 
}
1 Answers

If i understood correctly you want to do something like kindle which allows the user to open a book (in this case an app) directly from your app.

That being the case, maybe this package can help you https://pub.dev/packages/device_apps

to check for installed apps List<Application> apps = await DeviceApps.getInstalledApplications();

and to launch the app DeviceApps.openApp('package.name');

This package currently only supports android.

Related