经常出现在系统提示要安装apk或者插件时,会默认打开一系列市场或者其他程序,如何让自己的程序也出现在这些列表里?
答案是,在系统的启动activity的intent-filter描述里加上search过滤
<intent-filter>
要测试的话,可使用如下代码启动
Market 相关
1. //寻找某个应用
2. Uri uri = Uri.parse("market://search?q=pname:pkg_name");
3. Intent it = new Intent(Intent.ACTION_VIEW, uri);
4. startActivity(it);
5. //where pkg_name is the full package path for an application
1. //显示某个应用的相关信息
2. Uri uri = Uri.parse("market://details?id=app_id");
3. Intent it = new Intent(Intent.ACTION_VIEW, uri);
4. startActivity(it);
5. //where app_id is the application ID, find the ID
6. //by clicking on your application on Market home
7. //page, and notice the ID from the address bar
其中pkg_name 就是要下载的应用的包名, 假如要在lanchuer中点击某个ICON跳转到应用详情页,就可以通过这种方式