2013-08-29 6 views
0

J'ai tout essayé, mais quand j'installe mon application Android à partir d'USB. Le raccourci sur le bureau n'est pas créé. S'il vous plaît aidez.Icône de l'application pas sur le bureau

Après mon code:

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(); 
    } 
+1

Pouvez-vous poster votre manifeste? – gwin003

Répondre

2

Seule l'installation de Play Store facilite cette chose. Pour cela, vous devez ajouter l'autorisation suivante à votre manifeste.

<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/> 
+0

Je ne pense pas qu'il soit nécessaire d'ajouter cette ligne. Il est automatiquement créé même si vous n'ajoutez pas cette ligne. – Mohit

+0

mais parfois il crée un problème pour certains appareils comme je l'ai moi-même vécu la même chose. –

+0

pourriez-vous être plus précis (quelle gamme d'appareils e.ct)? En fait, j'ai aussi quelques applications sur google play mais je n'ai pas encore reçu un tel rapport. – Mohit

Questions connexes