本文介绍了通过意向启动的Mx播放器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的code调用mxplayer,但它没有工作,为什么?
意图myIntent;
PackageManager经理= getPackageManager();
myIntent = manager.getLaunchIntentForPackage(com.mxtech.videoplayer.ad);
startActivity(myIntent);
解决方案
MX播放器的开发者记录其包装命名空间此处的
所以,如果你已经安装了专业版,您需要使用另一个名字。
[包装]
com.mxtech.videoplayer.pro - 专业版
com.mxtech.videoplayer.ad - 免费版。
此外更可以捕获该异常的情况下,将MX播放器没有安装在系统上:
意图myIntent;
PackageManager下午= getPackageManager();
尝试 {
myIntent = pm.getLaunchIntentForPackage(YourPackageName);
如果(NULL!= myIntent)
this.startActivity(myIntent);
}赶上(ActivityNotFoundException E){
}
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) {
}
这篇关于通过意向启动的Mx播放器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!