0

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

Robin
  • 709
  • 2
  • 8
  • 20
  • possible duplicate of [Android create shortcuts on the home screen](http://stackoverflow.com/questions/6337431/android-create-shortcuts-on-the-home-screen) – 2Dee Jul 23 '15 at 08:10

2 Answers2

1

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

Georgy
  • 364
  • 2
  • 14
0

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

Mohammad Hammadi
  • 733
  • 2
  • 11
  • 34