public static boolean hasShortCut(Context context) {
String url = "";
System.out.println(getSystemVersion());
if(getSystemVersion() < 8){
url = "content://com.android.launcher.settings/favorites?notify=true";
}else{
url = "content://com.android.launcher2.settings/favorites?notify=true";
}
ContentResolver resolver = context.getContentResolver();
Cursor cursor = resolver.query(Uri.parse(url), null, "title=?",
new String[] {context.getString(R.string.app_name)}, null); if (cursor != null && cursor.moveToFirst()) {
cursor.close();
return true;
} return false;
}
private static int getSystemVersion(){
return android.os.Build.VERSION.SDK_INT;
}http://lipeng88213.iteye.com/blog/1172526
String url = "";
System.out.println(getSystemVersion());
if(getSystemVersion() < 8){
url = "content://com.android.launcher.settings/favorites?notify=true";
}else{
url = "content://com.android.launcher2.settings/favorites?notify=true";
}
ContentResolver resolver = context.getContentResolver();
Cursor cursor = resolver.query(Uri.parse(url), null, "title=?",
new String[] {context.getString(R.string.app_name)}, null); if (cursor != null && cursor.moveToFirst()) {
cursor.close();
return true;
} return false;
}
private static int getSystemVersion(){
return android.os.Build.VERSION.SDK_INT;
}http://lipeng88213.iteye.com/blog/1172526
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货