Launch Mx Player through intent

[亡魂溺海] 提交于 2020-01-01 00:48:33

问题


here is my code to call mxplayer but it didn't work, why ?

Intent myIntent ;
PackageManager manager = getPackageManager();
myIntent = manager.getLaunchIntentForPackage("com.mxtech.videoplayer.ad");
startActivity(myIntent);

回答1:


The developer of MX Player documented its package namespaces here: https://sites.google.com/site/mxvpen/api

So if you have installed the pro version, you need to use another name.

[Package]
com.mxtech.videoplayer.pro  - Pro Edition
com.mxtech.videoplayer.ad - Free Edition.

Further more you can catch the exception for the case, that the MX Player isn't installed on the system:

Intent myIntent;
    PackageManager pm = getPackageManager();
    try {
        myIntent = pm.getLaunchIntentForPackage(YourPackageName);
        if (null != myIntent)
            this.startActivity(myIntent);
    } catch (ActivityNotFoundException e) {

    }



回答2:


The official explanation is to say, What is your program if there is an error message? Return a "good" intent to launch a front-door activity in a package, for use for example to implement an "open" button when browsing through packages.



来源:https://stackoverflow.com/questions/14559406/launch-mx-player-through-intent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!