Reputation: 11090
I want to open my Activity
when user clicks on certain url
.
I created intent-filter
this way:
<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"
android:host="mysite.com"
android:pathPrefix="/prefix/" />
</intent-filter>
When I open that url
from my sms or notes it works fine (my activity opens), but when I click on that url
from chrome browser it redirects me to the web-site.
I heard that there is a problem with chrome 23+
, but I can not create any url
that could redirect me to my activity
from chrome
.
What am i doing wrong?
Upvotes: 0
Views: 1172
Reputation: 162
One of my application, i am using as mentioned below (Please replace host, pathPrefix and port with your values). In my case i am using different host, port and pathPrefix for dev, qa and production. That is why i add all scenarios in intent filter. Its working fine for me. Could you please try like this.
<activity
android:name=".SampleActivity"
android:label="@string/sample"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE"/>
<!--Dev-->
<data
android:host="dev.mysite.com"
android:pathPrefix="/your path/"
android:port="4000"
android:scheme="http" />
<data
android:host="mysite.com"
android:path="/your path/"
android:port="4000"
android:scheme="https" />
<!--Qa-->
<data
android:host="qa.mysite.com"
android:pathPrefix="/your path/"
android:port="8000"
android:scheme="http" />
<data
android:host="qa.mysite.com"
android:path="/your path/"
android:port="8000"
android:scheme="https" />
<!--Production-->
<data
android:host="mysite.com"
android:pathPrefix="/your path/"
android:scheme="http" />
<data
android:host="mysite.com"
android:path="/your path/"
android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
</activity>
Upvotes: 1