Now I am working on an application. Through my app users can read pdf files and if pdf reader is not there then my app automatically will install it from the site. This is the code I used for reading pdf file.
File file = new File("/sdcard/sample.pdf");
PackageManager packageManager = getPackageManager();
Intent testIntent = new Intent(Intent.ACTION_VIEW);
testIntent.setType("application/pdf");
List list = packageManager.queryIntentActivities(testIntent, PackageManager.MATCH_DEFAULT_ONLY);
if (list.size() > 0 && file.isFile()) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
Uri uri = Uri.fromFile(file);
intent.setDataAndType(uri, "application/pdf");
startActivity(intent);
}
My doubts are:
- How to check there is a adobe reader installed in phone or not?
- How to programatically install the adobe reader on a phone?