I would like to start an Android service using a URI scheme. Is this possible?
At the moment I have the following:
<service android:name="com.domain.app.services.MyService" >
<intent-filter>
<data android:scheme="myapp1"/>
</intent-filter>
</service>
<receiver android:name="com.domain.app.receivers.MyReceiver" >
<intent-filter>
<data android:scheme="myapp2"/>
</intent-filter>
</receiver>
But when I try to start it with a browser writting the cusom URI scheme (myapp1://hello or myapp2://hello) niether of them are started.
Does someone know how to do this?
I think you have to use
intent-filer
with scheme to launch an application from browser. You can read this tutorial for more information about the implementation in manifest file. Or this answer.Sample code:
A broadcast receiver (short receiver) is an Android component which allows you to register for system or application events. All registered receivers for an event are notified by the Android runtime once this event happens.
So broadcast receiver is for system or application events, not for you to launch your application from browser. You can read this tutorial for more information about broadcast receiver in Android.