Handling custom url for http protocol in Android -
when use custom scheme (for example myhttp) works expected, if use http , not handle, , every time browser opens host (eg:192.168.1.111).
how can solve problem?
my manifest.xml
<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="http"/> <data android:host="192.168.1.111"/> </intent-filter>
my activity:
public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); final intent intent = getintent(); log.i("mytag", "here--01"); }
give intent filter higher priority default browser:
http://developer.android.com/guide/topics/manifest/intent-filter-element.html#priority
<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="http"/> <data android:host="192.168.1.111"/> <android:priority="999"/> </intent-filter>
it controls order in broadcast receivers executed receive broadcast messages. higher priority values called before lower values. (the order applies synchronous messages; it's ignored asynchronous messages.)
the value must integer, such "100". higher numbers have higher priority. default value 0. value must greater -1000 , less 1000.
also if dealing browser. @ 1 time may have set chrome default app open intent. have reset this.
goto settings > apps > chrome (or firefox or w/e) > clear defaults
you can use app called default app manager check defaults have set
Comments
Post a Comment