No, the browser uses startActivity().  The user is clicking on something,
something should happen in the UI.  Just having a service start in the
background would not be expected.  You need to implement an activity.

On Wed, May 25, 2011 at 6:18 PM, PostPC Developer <[email protected]>wrote:

> I was experimenting on creating a service that can be called in a
> browser but unfortunately it doesn't get called at all. Is there
> something wrong with this intent-filter I placed for the service?
>
> <service android:name=".MyService" android:label="@string/app_name"
> android:enabled="true">
>   <intent-filter>
>      <action android:name="android.intent.action.VIEW" />
>      <category android:name="android.intent.category.DEFAULT" />
>      <category android:name="android.intent.category.BROWSABLE" />
>      <data android:scheme="myService" android:host="www.sample.com"/>
>   </intent-filter>
> </service>
>
> For the service code, I just extend the IntentService class and place
> my logic on the onHandleIntent method.
>
> This is how I call it in the website:
> <html>
> <head></head>
> <body>
> <a href="myService://www.sample.com?Data=my sample data">Call Service</
> a>
> </body>
> </html>
>
> That intent-filter works if I placed it on an activity but when it is
> a service, it does not work. I will get this error from the LogCat:
> tag=Tab
> Message=onReceivedError -10 myService://www.sample.com?Data=my sample
> data
>
> Any idea if it is possible to call the service from a browser at all?
>
> --
> 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