How do I programmatically launch a specific application?

后端 未结 10 677
余生分开走
余生分开走 2020-11-29 03:43

I want to launch a specif application.

I know how to do Intents but I want to avoid the selection menu if there are multiple apps that can handle the intent, I want

10条回答
  •  迷失自我
    2020-11-29 04:35

    What i do to open apps is this

    private void _LaunchApp(final String _Pack) {
        Intent launchi = new Intent(Intent.ACTION_VIEW);
        launchi.setData(Uri.parse("android-app://".concat(_Pack)));
        startActivity(launchi);
    }
    

    and the usage

    _LaunchApp("your.package.here");
    

提交回复
热议问题