我创建了一个程序,用户可以读取pdf文件,如果pdf reader不存在,程序就会从网站上自动安装。阅读pdf文件代码:
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);
}
我的问题是:
1. 如何检查 adobe reader是否在电话中安装了?
2. 如何在电话中以代码的形式安装 adobe reader?