Robin
Robin

Reputation: 709

How to add shortcut on home screen when app gets install

I know it's not the best practice, but it is a requested feature (e.g. for business apps). When the App gets installed, I need to automatically place it on the home screen. I saw a lot of code on the internet, but all of the code only works on button click when the app starts. But I need to place a shortcut on the homescreen immediately after the app is installed and before the app starts. Is there a way I can achieve this?

PS: To make the question more clear: The app will be distributed without Google Play Store, so that's not an option.

Thanks for your help!

Best regards,

Robin

Upvotes: 0

Views: 615

Answers (2)

Georgy
Georgy

Reputation: 384

You can't run any code in your application before the user starts your application for first time during to restrictions since Android 3.1. Check this for more information

Upvotes: 1

Mohammad Hammadi
Mohammad Hammadi

Reputation: 793

That's an optional feature of the Market app, not of the apps themselves. When designing an application , it does not receive a broadcast about itself being installed.

the first time the app launched can create it.

You can achieve that by creating a method in your main activity and call this method from oncreate and create a boolean variable andsave it in shared preferences

Upvotes: 0

Related Questions