0

I'm having trouble starting my app from a URL using intent-filters. I have checked Android app not opening from URL using intent-filter and Open Android app from URL using intent-filter not working and even some more without making it work.

Do I have to do something special in the activity?

This is the activity I'm trying to start when browsing everything under http://www.speedle.se

 <activity
        android:name=".activity.LoginActivity"
        android:label="@string/title_activity_login"
        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" />

            <data
                android:host="www.speedle.se"
                android:pathPattern=".*"
                android:scheme="http" />
        </intent-filter>


        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>



    </activity>

Regards and thanks Mattias

Community
  • 1
  • 1
Mattias Johansson
  • 611
  • 2
  • 6
  • 18
  • You should not need the `android:pathPattern`. Beyond that, what exactly is the behavior that you are seeing? – CommonsWare Mar 19 '15 at 21:54
  • I expect to see the activity picker when I browse to http://www.speedle.se, but currently nothing happens (the browser opens the page) – Mattias Johansson Mar 20 '15 at 07:57
  • How are you trying to use your URL? Are you typing it into a browser address bar? Are you clicking on a link in a Web page in a browser? Are you clicking on a link in a `WebView`? Are you clicking on a link in another ordinary Android app? Bear in mind that the first two scenarios may not trigger your activity, simply because the Web browser may handle the link internally. There is no requirement for all Web browsers to scan all links to see if they can be handled by some third-party app. – CommonsWare Mar 20 '15 at 11:11
  • Ah, maybe that's why then, I type the link in the standard Android internet browser. I try to get deep linking from a twitter app card to work, what's the best practise, to create my own scheme? – Mattias Johansson Mar 21 '15 at 08:00
  • I am not quite sure what "a twitter app card" is. A custom scheme is somewhat more likely to cause a browser on Android to invoke `ACTION_VIEW` on the `Uri` rather than try to handle it internally. OTOH, it is not a guarantee, and custom schemes are more difficult to keep unique. – CommonsWare Mar 21 '15 at 11:19
  • Ok, I see, I'll have to read up more how this iss supposed to work. Btw this is Twitter App Cards https://dev.twitter.com/cards/types/app – Mattias Johansson Mar 22 '15 at 16:29
  • Now it's working from the twitter app card, and from Facebook, thanks for all the help. My issue with Twitter was that Prerender.io had cached my page, and thus Twitter didn't get the new meta data. – Mattias Johansson Mar 29 '15 at 13:45

2 Answers2

0

Please refer to following answer and see if it solves your query

https://stackoverflow.com/a/2958870/2802705

Let me know if you need further help.

Community
  • 1
  • 1
Suraj Dubey
  • 496
  • 6
  • 11
0

Now it's working from the twitter app card, and from Facebook, thanks for all the help. My issue with Twitter was that Prerender.io had cached my page, and thus Twitter didn't get the new meta data.

Mattias Johansson
  • 611
  • 2
  • 6
  • 18