Re: [android-developers] How to start an Activity from a Service and getting a result from it

2010-02-12 Thread Kevin Duffey
The whole purpose of a service is to stay in the background doing something,
so not sure why you would want to display a UI in a non-UI based app. As
Dianne said, post a notification that shows up on the status bar... when the
user slides it down and clicks on it, that can launch an activity... which
can then bind to the service to pass it info if need be. I'd still argue
that would not be a good idea either. Can you elaborate on why you need some
user interaction with your service.. is it something that can't be, perhaps
set in a user preferences within an activity that the user launches the
first time (or later to change settings)?


On Thu, Feb 11, 2010 at 7:53 PM, Dianne Hackborn wrote:

> You can't do this, nor should you.  This would pop your UI in front of the
> user, disrupting whatever they are doing.  This is highly discouraged.  The
> proper way to do this is to post a notification, which the user can respond
> to when desired and can cause your own activity to be launched, which can
> then launch the other activity.
>
>
> On Thu, Feb 11, 2010 at 11:17 AM, Menny  wrote:
>
>> Hi,
>> I have a Service which needs to receive data from external packages.
>> So, to locate the data providing external packages, I use activity-
>> filter and PackageManager.queryIntentActivities function to locate the
>> interesting packages.
>> Now, from each such package, I need to get a ContentProvider URI.
>> So I want to start the external Activity and the external activity
>> will return a result to my service - something like
>> "startActivityForResult".
>> The problem is that there is no way to call "startActivityForResult"
>> from a Service, only Activity can do that, and my project does not
>> have any Activity, and probably can't show UI for the user.
>>
>> The bottom line:
>> Can anyone suggest a way to get ContentProvider URI from an external
>> package, while my package has only a Service?
>>
>> Thanks,
>> Menny.
>>
>> --
>> 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
>>
>
>
>
> --
> 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+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] How to start an Activity from a Service and getting a result from it

2010-02-11 Thread Dianne Hackborn
You can't do this, nor should you.  This would pop your UI in front of the
user, disrupting whatever they are doing.  This is highly discouraged.  The
proper way to do this is to post a notification, which the user can respond
to when desired and can cause your own activity to be launched, which can
then launch the other activity.

On Thu, Feb 11, 2010 at 11:17 AM, Menny  wrote:

> Hi,
> I have a Service which needs to receive data from external packages.
> So, to locate the data providing external packages, I use activity-
> filter and PackageManager.queryIntentActivities function to locate the
> interesting packages.
> Now, from each such package, I need to get a ContentProvider URI.
> So I want to start the external Activity and the external activity
> will return a result to my service - something like
> "startActivityForResult".
> The problem is that there is no way to call "startActivityForResult"
> from a Service, only Activity can do that, and my project does not
> have any Activity, and probably can't show UI for the user.
>
> The bottom line:
> Can anyone suggest a way to get ContentProvider URI from an external
> package, while my package has only a Service?
>
> Thanks,
> Menny.
>
> --
> 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
>



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