Tuesday, January 31, 2012

How to check whether the flash is installed on android device or not?


Below method is to check flash is present or not!!!!


public boolean isFlashInstalled(){
 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;
 }
 return flashInstalled;
 }



String htmlPre = "<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"utf-8\"></head><body style='margin:0; pading:0; background-color: black;'>";
String htmlCode = " <embed style='width:100%; height:100%' src='http://www.platipus.nl/flvplayer/download/1.0/FLVPlayer.swf?fullscreen=true&video=@VIDEO@' " +"  autoplay='true' " +"  quality='high' bgcolor='#000000' " +
"  name='VideoPlayer' align='middle'" + // width='640' height='480'
"  allowScriptAccess='*' allowFullScreen='true'" +
"  type='application/x-shockwave-flash' " +
"  pluginspage='http://www.macromedia.com/go/getflashplayer' />" +
"";
String htmlPost = "</body></html>";



if(isFlashInstalled()){
                 //Load the flash content if not found it will open the installation site
mWebView.loadDataWithBaseURL("null", htmlPre+htmlCode+htmlPost, "text/html", "UTF-8", "");
}
else{
                //Not present
}

No comments:

Post a Comment