How can I let my user create a shortcut to an app, into my app (like a launcher)?

Search This thread

nex7er

Senior Member
Feb 3, 2008
449
163
Bergen
I can't for the life of me find ANYTHING written about how to create a shortcut to an app. All over stackoverflow it's just about having ones app get created as a shortcut onto users own launcher.

I want the user to be able to click my button which opens a dialog, in where the user can then select an app of their choosing, rename the shortcut and lastly hit the "Ok" button which should then let that app sit in my apps fragment until the user decides to remove it.

How would I go about doing this?
 

SimplicityApks

Senior Member
May 26, 2013
354
344
Aachen
I can't for the life of me find ANYTHING written about how to create a shortcut to an app. All over stackoverflow it's just about having ones app get created as a shortcut onto users own launcher.

I want the user to be able to click my button which opens a dialog, in where the user can then select an app of their choosing, rename the shortcut and lastly hit the "Ok" button which should then let that app sit in my apps fragment until the user decides to remove it.

How would I go about doing this?

To get a list of all installed applications, use
Code:
 final PackageManager pm = getPackageManager(); //get a list of installed apps.
 List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);

To start them just create a new Intent(packageName) and start it with startActivity(intent);
 
  • Like
Reactions: nex7er

nex7er

Senior Member
Feb 3, 2008
449
163
Bergen
To get a list of all installed applications, use
Code:
 final PackageManager pm = getPackageManager(); //get a list of installed apps.
 List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);

To start them just create a new Intent(packageName) and start it with startActivity(intent);

Hey, thanks for the quick reply! That works wonders! Half way already. Thanks a lot. :D

Now how would I go about having it so that the apps I select in the list of apps stay selected, then upon an onClick of a button they get returned to my fragment (activity)? And to have them saved after that, would I need to read up on sqlite?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    I can't for the life of me find ANYTHING written about how to create a shortcut to an app. All over stackoverflow it's just about having ones app get created as a shortcut onto users own launcher.

    I want the user to be able to click my button which opens a dialog, in where the user can then select an app of their choosing, rename the shortcut and lastly hit the "Ok" button which should then let that app sit in my apps fragment until the user decides to remove it.

    How would I go about doing this?

    To get a list of all installed applications, use
    Code:
     final PackageManager pm = getPackageManager(); //get a list of installed apps.
     List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);

    To start them just create a new Intent(packageName) and start it with startActivity(intent);