Android: Get Installed Shortcuts

前端 未结 4 1586
名媛妹妹
名媛妹妹 2021-01-17 22:27

I have seen ways to make shortcuts, but I need to find a way to get a list of shortcuts installed on the phone.

I want my user to be able to select one of his/her sh

4条回答
  •  离开以前
    2021-01-17 23:02

    I'm trying to do the same and there a lot of things not clear about this topic, at least not clear to me...........An example is Openapp market that create shortcuts everytime you "download" an app, but the shortcuts it is actually only a link to an html page. Anyway i have 2 android phones and in the firstone is working in the second one is not creating any shortcuts.......

    in may app i do the following:

     Intent shortcutIntent = new Intent(this,FinestraPrincipaleActivity.class);
     shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
     shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
      shortcutIntent.putExtra("someParameter", "HelloWorld");
    
     Intent addIntent = new Intent();
     addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
     addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "Shortcut Name");
      addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,  
     Intent.ShortcutIconResource.fromContext(this, R.drawable.icon));
    
    addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
     this.sendBroadcast(addIntent);
    

    But someone told me that the is wrong but i didn't find anyother way to create shortcuts....

提交回复
热议问题