Friday, July 22, 2011

Re: [android-developers] Re: How to know what internal process runs an application

Be we are still not getting to the core problem -- why do you need to have your "app initialized" certain different ways depending on these uses?  How have you gotten to this point?  It is the fundamental problem.  This is just not naturally how Android works -- processes are simply containers to host specific components like activities and services.

On Mon, Jul 18, 2011 at 11:19 AM, elDoudou <the.edouard.mercier@gmail.com> wrote:
Thank you Diane.

I may have a problem with my design, but if I'm wrong, I'd be
delighted to be well guided.

I would like my application to initialize a certain way when it is
started with an Activity (for instance, I want to set up some caching
stuff), whereas when launched via a Service, I do not need it to be
initialized that way. The solution that I have found so far is to
override the "Application.onCreate()" method, so as to be notified
every time the application process starts, and quick-initialize some
stuff.

I have declared two "android:processes" because I thought that it
might be possible to distinguish the cause of the application process
start, but if you say that it is not possible to determine the
"android:process" responsible for the start of the process, how can I
solve my problem, please?

Do you have in mind another design pattern which enables the
application to be notified at startup, whatever Activity,
BroadcastReceiver, Service causes its process to start so as to
initialize some stuff, and to distinguish a specific Service where no
initialization is supposed to be run, please?

I would be very grateful to the person who is able to unblock me. And
please, do not tell me that I have a design problem eventually ;)

Regards,
Édouard


On 14 juil, 20:05, Dianne Hackborn <hack...@android.com> wrote:
> Sorry, there is no way to know.  Processes are basically anonymous
> containers in which to run code.  If you are needing to distinguish them,
> you have a problem in your design.
>
> On Tue, Jul 12, 2011 at 1:43 AM, elDoudou <the.edouard.merc...@gmail.com>wrote:
>
>
>
>
>
>
>
>
>
> > Hello Doug and thank you.
>
> > The process id does not indicate the Android declared process in the
> > AndroidManifest.xml file, unfortunately. What I need to know is the
> > "android:process" which causes the process to start. If I declare a
> > service in the manifest with a specific process name (tag
> > "android:process"), how do I know at runtime when this specific
> > service process causes the "Application::onCreate()" method to be
> > invoked, please?
>
> > Thank you for your time and support. Regards,
> > Édouard
>
> > --
> > 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+unsubscribe@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en



--
Dianne Hackborn
Android framework engineer
hackbod@android.com

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

No comments:

Post a Comment