Re: [android-developers] Followup questions about detecting install / first launch

2012-03-15 Thread Kostya Vasilyev
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  написал:
>
> 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  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 android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Followup questions about detecting install / first launch

2012-03-15 Thread Mark Murphy
On Thu, Mar 15, 2012 at 1:46 PM, Ted Scott  wrote:
> 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 don't know what you mean by "start the app as the default". When a
user installs an app from Play, if they left the Play app open, the
"Install" button turns into an "Open" button that, when clicked,
launches the app. If the user did not leave the Play app open, and
they tap on the "installed!" notification, that launches the app. The
app does not automatically launch without user intervention.

> API 12 gave us ACTION_PACKAGE_FIRST_LAUNCH and ACTION_MY_PACKAGE_REPLACED.

Yes, and they will certainly be helpful for these scenarios, once
there's more than a few percent of devices running API Level 12+. :-)

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android App Developer Books: http://commonsware.com/books

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Followup questions about detecting install / first launch

2012-03-15 Thread Ted Scott


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  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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en