检测是否安装在Android Flash和嵌入在活动Flash视频 [英] Detect if Flash is installed on Android and embed a Flash video in an Activity

查看:119
本文介绍了检测是否安装在Android Flash和嵌入在活动Flash视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这的确是一个问题的两个部分。首先,是可以检测是否安装在Android设备上的Flash?其次,如果已安装,是否有可能显示在活动Flash视频?我想你必须使用的WebView小部件的活动中,以显示Flash内容,而不是像VideoView东西。是Flash甚至web视图控件中支持或只支持实际的浏览器应用程序?

This is really a two part question. First, is it possible to detect if Flash is installed on an Android device? Second, if it is installed, is it possible to display a flash video in an Activity? I'm thinking you'd have to use a WebView widget within your Activity to display the Flash content instead of something like a VideoView. Is Flash even supported within the WebView widget or is it only supported by the actual Browser app?

推荐答案

在回答你的问题,这两个部分是是,对第一第二部分队伍。

The answer to both parts of your questions is "yes", with the second part contingent on the first.

(1)如果安装的Flash检测。

(1) Detecting if Flash is installed.

使用的PackageManager试图获取应用程序信息的Flash播放器包。它会抛出一个异常这样的包装是不存在的。

Use the PackageManager to attempt to obtain the Application Info for the Flash Player package. It will throw an exception of such a package doesn't exist.

boolean flashInstalled = false;
try {
  PackageManager pm = getPackageManager();
  ApplicationInfo ai = pm.getApplicationInfo("com.adobe.flashplayer", 0);
  if (ai != null)
    flashInstalled = true;
} catch (NameNotFoundException e) {
  flashInstalled = false;
}

(2)提供的,安装的Flash,您可以通过一个web视图中嵌入它显示你的活动中的Flash视频。 Flash插件提供了一个web视图作为本地浏览器同样的支持。

(2) Provided Flash is installed, you can display a Flash video within your Activity by embedding it within a WebView. The Flash plugin provides the same support for a WebView as the native browser.

如果在第1部分为假支票,最好的做法是将隐藏的WebView,并用一个错误信息说明要求的Flash,或更好的替代,一个链接,下载从Android Market Flash插件。

If your check in Part 1 returns false, best practice would be to hide your WebView and replace it with either an error message explaining the requirement for Flash, or better still, a link to download the Flash plugin from the Android Market.

这篇关于检测是否安装在Android Flash和嵌入在活动Flash视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆