में गलत दिखाए गए डिफ़ॉल्ट ऐप्स की सूची मैं एंड्रॉइड एल में सभी डिफ़ॉल्ट ऐप्स प्राप्त करना चाहता हूं। मैंने कोड कोड का उपयोग किया लेकिन वे मुझे गलत समाधान देते हैं। मेरे कोड को पहले देखेंएंड्रॉइड एल
private void getMyAppLauncherDefault() {
final IntentFilter filter = new IntentFilter(Intent.ACTION_MAIN);
filter.addCategory(Intent.CATEGORY_HOME);
List<IntentFilter> filters = new ArrayList<IntentFilter>();
filters.add(filter);
List<ComponentName> activities = new ArrayList<ComponentName>();
final PackageManager packageManager = (PackageManager) getPackageManager();
packageManager.getPreferredActivities(filters, activities, null);
for (ComponentName activity : activities) {
Log.d(TAG,"======packet default:==="+activity.getPackageName());
}
}
और यह लॉग है। लॉग com.google.android.googlequicksearchbox
और com.vlingo.midas
के बीच गलत परिणाम दिखाता है। वे दोनों वॉयस ऐप हैं, लेकिन मैंने डिफ़ॉल्ट रूप से com.google.android.googlequicksearchbox
सेट अप किया है। मुझे नहीं पता कि लॉग com.vlingo.midas
क्यों दिखाता है। मेरे द्वारा यह कैसे किया जा सकता है? धन्यवाद
16:02:44.817 /com.exam D/Sample: ======packet default:===com.sec.android.gallery3d
16:02:44.827 /com.exam D/Sample: ======packet default:===com.android.mms
16:02:44.827 /com.exam D/Sample: ======packet default:===com.android.mms
16:02:44.827 /com.exam D/Sample: ======packet default:===com.vlingo.midas
16:02:44.827 /com.exam D/Sample: ======packet default:===com.sec.android.app.sbrowser
16:02:44.827 /com.exam D/Sample: ======packet default:===com.sec.android.gallery3d
16:02:44.827 /com.exam D/Sample: ======packet default:===com.android.mms
16:02:44.827 /com.exam D/Sample: ======packet default:===com.sec.android.app.launcher
16:02:44.827 /com.exam D/Sample: ======packet default:===com.sec.android.app.sbrowser
16:02:44.827 /com.exam D/Sample: ======packet default:===com.android.mms
16:02:44.827 /com.exam D/Sample: ======packet default:===com.google.android.googlequicksearchbox
16:02:44.827 /com.exam D/Sample: ======packet default:===com.sec.android.app.sbrowser
16:02:44.827 /com.exam D/Sample: ======packet default:===com.sec.android.gallery3d
16:02:44.827 /com.exam D/Sample: ======packet default:===com.android.mms
16:02:44.827 /com.exam D/Sample: ======packet default:===com.google.android.apps.plus
अद्यतन:
public static boolean isMyAppDefault(Context context) {
final IntentFilter filter = new IntentFilter(Intent.ACTION_MAIN);
filter.addCategory(Intent.CATEGORY_HOME);
List<IntentFilter> filters = new ArrayList<IntentFilter>();
filters.add(filter);
final String myPackageName = context.getPackageName();
List<ComponentName> activities = new ArrayList<ComponentName>();
final PackageManager packageManager = (PackageManager) context.getPackageManager();
packageManager.getPreferredActivities(filters, activities, null);
for (ComponentName activity : activities) {
if (myPackageName.equals(activity.getPackageName())) {
return true;
}
}
return false;
}
यह संभावना है कि 'com.vlingo.midas' एक अतिरिक्त फ़िल्टर का समर्थन करता है, जिसके लिए यह दिखाता है। इसके लिए जांचने के लिए पैकेज नाम के साथ संबंधित फ़िल्टर मुद्रित करें। – F43nd1r
@ F43nd1r: हम इसे कैसे प्रिंट कर सकते हैं? 'फ़िल्टर' आकार केवल 1 है, जबकि' फ़िल्टर' आकार 4 है। लेकिन मैं फिल्टर – Jame
का नाम प्रिंट नहीं कर सकता com.vlingo.midas अलग-अलग उद्देश्य/एप्लिकेशन के लिए डिफ़ॉल्ट हो सकता है। –