android判断快捷方式是否已经创建的方法

public boolean checkShortcut()
{
boolean isInstallShortcut = false ;
final ContentResolver cr =this.getContentResolver();
final String AUTHORITY = "com.android.launcher.settings";
final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/favorites?notify=true");
Cursor c = cr.query(CONTENT_URI,new String[] {"title","iconResource" },"title=?",
new String[] {"ARecorder" }, null);//Arecorder表示应用名称,在这里检查应用程序名称
if(c!=null && c.getCount()>0){
isInstallShortcut = true ;
}
return isInstallShortcut ;
}
要有权限:

Tags: 

延伸阅读

最新评论

发表评论