मुझे लगता है कि मैंने इंटरनेट पर मिलने वाले सभी समाधानों का प्रयास किया है, लेकिन कोई भी काम नहीं करता है- कोई बल बंद नहीं होता है, लेकिन डेस्कटॉप पर कुछ भी नहीं दिखाई देता है।डेस्कटॉप पर किसी भी ऐप के लिए शॉर्टकट बनाएं
public Intent getIntentShortcut()
{
Intent i = new Intent();
i.setClassName(packageName, name);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
return i;
}
और प्रकट में:
<permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
मैं क्या याद आ रही है
private void createShortcutOnDesktop(Application app) {
Intent shortcutIntent = new Intent();
shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, app.getIntentShortcut());
shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, app.getName());
shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(context, R.drawable.home_button));
shortcutIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
this.sendBroadcast(shortcutIntent);
finish();
}
app.getIntentShortcut() यह है: अब, मैं इस किया है? धन्यवाद।
संदर्भ के लिए, आपके सवाल का संपादन यह टक्कर अप करने के लिए पर्याप्त है सामने वाले पृष्ठ पर फिर से। –
क्या आप कृपया पूर्ण स्रोत कोड प्रदान कर सकते हैं। – Nirav