通过意向启动的Mx播放器播放器、意向、Mx

2023-09-05 10:59:06 作者:旧言虐心   ゅ

这是我的code调用mxplayer,但它没有工作,为什么?

 意图myIntent;
PackageManager经理= getPackageManager();
myIntent = manager.getLaunchIntentForPackage(com.mxtech.videoplayer.ad);
startActivity(myIntent);
 

解决方案

MX播放器的开发者记录其包装命名空间此处的 https://sites.google.com/site/mxvpen/api

所以,如果你已经安装了专业版,您需要使用另一个名字。

  [包装]
com.mxtech.videoplayer.pro  - 专业版
com.mxtech.videoplayer.ad  - 免费版。
 

此外更可以捕获该异常的情况下,将MX播放器没有安装在系统上:

 意图myIntent;
    PackageManager下午= getPackageManager();
    尝试 {
        myIntent = pm.getLaunchIntentForPackage(YourPackageName);
        如果(NULL!= myIntent)
            this.startActivity(myIntent);
    }赶上(ActivityNotFoundException E){

    }
 
TV本地视频播放器哪款好 暴风影音与MX播放器对比分析

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);

解决方案

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) {

    }