我正在使用Vitamio Lib在我的Android应用程序中播放(.m3u8),我可以检查用户的手机上是否有sdk,如果没有,请给他下载链接?
最佳答案
您可以在启动播放器之前先进行以下操作
public boolean checkVitamioInstallation(最终上下文上下文){
try {
VitamioInstaller.checkVitamioInstallation(context
.getApplicationContext());
return true;
} catch (VitamioNotCompatibleException e) {
TGLogger.e(this, "Not compatible", e);
TGLogger.i(this, "Not compatible");
OnClickListener listener = new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Uri marketUri = Uri.parse("market://details?id="
+ VitamioInstaller.getCompatiblePackage());
Intent marketIntent = new Intent(Intent.ACTION_VIEW,
marketUri);
context.startActivity(marketIntent);
}
};
Builder dialog = getDialog(context.getResources().getString(
R.string.not_compatible_plugin), context.getResources()
.getString(R.string.install_plugin_msg), context
.getResources().getString(R.string.install_msg), context,
listener);
dialog.show();
} catch (VitamioNotFoundException e) {
TGLogger.e(this, "plugin not found", e);
OnClickListener listener = new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Uri marketUri = Uri.parse("market://details?id="
+ VitamioInstaller.getCompatiblePackage());
Intent marketIntent = new Intent(Intent.ACTION_VIEW,
marketUri);
context.startActivity(marketIntent);
}
};
Builder dialog = getDialog(context.getResources().getString(
R.string.plugin_not_found), context.getResources()
.getString(R.string.fresh_plugin_install), context
.getResources().getString(R.string.install_msg), context,
listener);
dialog.show();
}
return false;
}
关于android - 检查是否在移动设备上安装了SDK(Vitamtio和.m3u8),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8625048/