Like I said, you can't do this.  The appropriate list would probably be
android-porting; I can't move the thread for you.

You can create a Service without an Activity, that's one of the points of a
Service, but you still need to be running in a process created by the
activity manager (from an .apk with a manifest etc).

It might help if you describe what you are actually trying to do, what
context this is coming from (you are building your own platform, creating
something to upload to market, etc).

On Fri, May 15, 2009 at 11:35 AM, SGAdrian <[email protected]> wrote:

>
> So where can ask this question? Could you move this thread to the
> correct forum?
>
> So how can I get hold of a functional Context, if that means I have to
> go through the ActivityManager?
>
> Can I create a Service without an Activity? I dont want anything
> visible to the user.
>
> BR,
> Sven
>
> On 15 Maj, 19:09, Dianne Hackborn <[email protected]> wrote:
> > You are in the wrong group -- this group is for programming against the
> SDK,
> > which you are well outside the bounds of.
> >
> > That said, you can't really get a functional Context from outside of
> > processes not launched by the activity manager.  You'll notice that the
> > monkey, am, and pm commands all don't use a Context for this reason.
> >
> >
> >
> > On Fri, May 15, 2009 at 6:41 AM, SGAdrian <[email protected]>
> wrote:
> >
> > > Sorry but I dont get it.
> >
> > > I am starting my java program with app_process, i.e I am not running
> > > any Service or Activity. Just like the Monkey.java program is doing.
> >
> > > Ex.
> >
> > > public class Main {
> > >        public static void main(String[] args) {
> > >               // How can I get hold of a Context instance here?
> > >               //
> > >       }
> > > }
> >
> > > BR,
> > > Sven
> >
> > > On May 15, 2:50 pm, "Mark Murphy" <[email protected]> wrote:
> > > > > When you are developing on an application level(Services,
> Activities)
> > > > > you always get this Context reference automatically.
> >
> > > > > But what if I am on a lower level and developing a program started
> > > > > with app_process, how can I get hold of a Context then? Its a huge
> > > > > part of the API that need this context.
> >
> > > > Have it passed to you via the API to your lower level. In other
> words,
> > > > just as the Android API requires you to pass in a Context, your API
> to
> > > > your higher levels will require those higher levels to pass in a
> Context.
> >
> > > > > What the proper way to create a Context instance?
> >
> > > > AFAIK, you don't create Context instances -- you use the ones created
> for
> > > > you by Android (e.g., Activity, Service).
> >
> > > > --
> > > > Mark Murphy (a Commons Guy)http://commonsware.com
> > > > _The Busy Coder's Guide to Android Development_ Version 2.0
> Available!
> >
> > --
> > 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.
> >
>


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