时间:2021-05-19
之前的文章向大家介绍了几个项目中常用的实用功能,那么在这篇文中,我将向大家介绍如何获取Android手机中已经安装的手机应用程序,好了,废话不多说,直接上代码
private String getInstalledAppListAsString(){ PackageManager pm = context.getPackageManager(); List<ApplicationInfo> apps = pm.getInstalledApplications(PackageManager.GET_GIDS); StringBuffer stringBuffer = new StringBuffer(); for (ApplicationInfo app : apps) { if(pm.getLaunchIntentForPackage(app.packageName) != null) { // apps with launcher intent if((app.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) == 1) { // updated system apps } else if ((app.flags & ApplicationInfo.FLAG_SYSTEM) == 1) { // system apps } else { // user installed apps stringBuffer.append(app.packageName).append(';'); } } } return stringBuffer.toString(); }下面我们看看具体如何获取各个应用的相关信息呢
package cn.lyz.mobilesafe.domain;import android.graphics.drawable.Drawable;/** * 获取的应用基本信息实体类 * @author liuyazhuang * */public class AppInfo { //图标 private Drawable app_icon; //应用名称 private String app_name; //应用版本号 private String app_version; //应用包名 private String packagename; //是否是用户app private boolean isUserApp; public AppInfo() { super(); // TODO Auto-generated constructor stub } public AppInfo(Drawable app_icon, String app_name, String app_version, String packagename) { super(); this.app_icon = app_icon; this.app_name = app_name; this.app_version = app_version; this.packagename = packagename; } public AppInfo(Drawable app_icon, String app_name, String app_version, String packagename, boolean isUserApp) { super(); this.app_icon = app_icon; this.app_name = app_name; this.app_version = app_version; this.packagename = packagename; this.isUserApp = isUserApp; } public Drawable getApp_icon() { return app_icon; } public void setApp_icon(Drawable app_icon) { this.app_icon = app_icon; } public String getApp_name() { return app_name; } public void setApp_name(String app_name) { this.app_name = app_name; } public String getApp_version() { return app_version; } public void setApp_version(String app_version) { this.app_version = app_version; } public String getPackagename() { return packagename; } public void setPackagename(String packagename) { this.packagename = packagename; } public boolean isUserApp() { return isUserApp; } public void setUserApp(boolean isUserApp) { this.isUserApp = isUserApp; } @Override public String toString() { return "AppInfo [app_icon=" + app_icon + ", app_name=" + app_name + ", app_version=" + app_version + ", packagename=" + packagename + ", isUserApp=" + isUserApp + "]"; }}声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
Centos中基于IP的虚拟主机搭建首先,检查是否已安装httpd软件包安装httpd软件包安装完成启动服务主配置文件是/etc/httpd/conf/http
以安卓手机解析软件包为例,其出现问题可能是由于下载zd的apk程序本身就有问题,程序的压缩包可能在下载过程中被损坏了,建议请重新下载一次。 软件包(SoftW
有时候在使用php上传安卓apk包的时候,我们需要获取安卓apk包内的信息,本文以实例形式讲述了php获取apk包信息的方法。具体实现方法如下:open($ta
QQ里发送软件iOS不能安装,苹果手机装软件只能通过AppStore。qq发来的文件是一般是apk格式的,只有安卓系统才能识别的安装包格式,苹果手机安装包格式特
ROOT软件获取安卓手机里的ROOT权限。 2、手机ROOT成功后,我们打开强力安卓恢复精灵这款安卓手机数据恢复软件,我们可以在软件界面上看到这款软件拥有多种