Personally I would say that for any question that implies you are
subclassing Application, the answer is "no". :)

Subclassing from Application doesn't let you do anything more than you
could other ways, and there is a good chance it is going to lead you into a
worse app design that you will ultimately be fighting with.

For something like navigation, the correct way to do this is to use a
Service, and call Service.startForeground() when you are actively doing
work the user cares about (navigating).  This will also require that you
post a notification, making the user aware of what you are doing (which by
definition they already are, since the only reason to be foreground is
because this is something the user directly cares about, so the
notification gives them a facility to get back to it and manage it).

On Mon, Mar 19, 2012 at 10:09 AM, RedBullet <[email protected]>wrote:

> Yea, that is sort of where I am going too. It does seem like what the
> Application class is for...
>
> On Monday, March 19, 2012 12:54:12 PM UTC-4, TreKing wrote:
>
>> On Mon, Mar 19, 2012 at 11:40 AM, RedBullet <> wrote:
>>
>>> I am wondering if it makes sense to contain all that state/logic in the
>>> service, or if I should put as much of the common state into an Application
>>> class, and let the activities/services access it through the application
>>> class.
>>
>>
>> Well, now you're getting into architecture questions for your
>> business-specific logic, so that's really ultimately up to you. Personally,
>> I would abstract that logic into its own class(es), which are then accessed
>> from wherever they're needed, whether it be the background service the
>> current foreground activity. As Singletons, perhaps?
>>
>> ------------------------------**------------------------------**
>> ------------------------------**-------
>> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
>> transit tracking app for Android-powered 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
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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