Market / Play don't launch apps after the installation - the user is presented with a button to do that, but is not required to press it (except maybe on devices capable of delivering electric shock... :)
Starting with Android 3.1 (IIRC) freshly installed apps are in disabled state, which includes their manifest-declared receivers. If you need to detect the first time your app is run, I don't see anything wrong with using a shared prefs value. If you need to detect when it's run after just having been upgraded, I don't see anything wrong with storing the last known version code and comparing that to the current value (which can be obtained from the PackageManager). -- K 15 марта 2012 г. 21:46 пользователь Ted Scott <[email protected]> написал: > > I'm still getting my head around the API and can use a check if I'm > understanding this right. > > On 3/15/2012 6:48 AM, Mark Murphy wrote: >> >> On Thu, Mar 15, 2012 at 4:06 AM, giles ian<[email protected]> wrote: >>> >>> I need to execute some code on app install event. How do i do it. >> >> You don't. > > > Ok, I understand that ACTION_PACKAGE_INSTALL wasn't implemented. There is no > broadcast to the app when its package is installed. Doesn't the installer > from Market^H^H^H^H^H^H Play start the app as the default? I haven't > published an app as yet so I'm not sure if it's configurable from the > deployment console. > >>> After some googleing i found there is no direct way. So which is the best >>> work around for that. >> >> You do the work when the user first runs your app. > > > API 12 gave us ACTION_PACKAGE_FIRST_LAUNCH and ACTION_MY_PACKAGE_REPLACED. > I've been writing to 8 and piggybacked my first run code to the DB helper, > since what I'm doing needs a DB. I suppose it's easy enough to store an > already ran flag in preferences and check that. > > What are the techniques people have been using to manage this? Storing > static versioning and checking it? Using the manifest versioning data? This > may seem like a lame question, but curiosity has gotten the better of me. I > guess what I'm asking is there are a lot of ways to skin this cat, what are > people doing? > > Is it worth using the broadcasts and maintaining your own state to provide > backward compatibility or is everyone saying bag that and just rolling their > own? > > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

