I have a couple of services in my application which need to be marked
as foreground to prevent them from being killed unnecessarily.

Currently I am building my application with the 2.0 SDK but I have
    android:minSdkVersion="3"
    android:targetSdkVersion="5"
in my manifest file so that I can support 1.5, 1.6 or 2.0 devices.  I
am currently using only the 1.5 APIs so that my application will run
correctly on the 1.5 devices.

2.0 introduced a nicer startForground method that combines setting the
foreground flag and starting a notification which can be used to
control the service.  The 2.0 documentation says that startForground
replaces setForeground, and that due to the fact that many
applications were mistakenly using setForeground without a
notification that could be used to control and close down the service,
that the older setForeground method had been changed so it no longer
does anything on 2.0.

I tried using the newer 2.0 interface but it caused an exception for
phones running 1.5 or 1.6.  So I am still using the older
setForeground interface and calling notify separately.  But it appears
that since I am building with the 2.0 SDK the older interface isn't
really preventing my services from being killed.

I would appreciate some guidance on the proper way to use these APIs
so that my appliction will work correctly on 1.5, 1.6 and 2.0 devices.

-- 
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

Reply via email to