0

I am at my wits end with this. I am trying to have the user click on a link in a text message and the phone direct them to my app. However it autommatically goes to browser. Please help!

My android manifest looks like this:

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


    <!-- Main activity -->
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:uiOptions="splitActionBarWhenNarrow"
        android:windowSoftInputMode="adjustResize">

        <meta-data android:name="android.support.UI_OPTIONS"
            android:value="splitActionBarWhenNarrow" />
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.LAUNCHER" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="http" />
            <data android:host="www.myapp.com"/>      
        </intent-filter>
    </activity>

Looking at every forum I am doing this correctly yet it still does not work. Please help!

2 Answers2

0

You need to use a broadcast receiver, it is the receiver that has to be configured on the intents you're listening on, when such an intent takes place your receiver should bring to foreground an activity or do whatever else you need to.

Marius M
  • 496
  • 9
  • 16
  • Can you give an example or website? I have searched for doing hyperlinks with broadcast receiver but so far nothing. I just want the app to be a selection on my phone if selecting the hyperlink http://www.myapp.com – user3108923 Sep 24 '14 at 15:55
0

Something like this may help you achieve what your trying to do :

https://stackoverflow.com/a/525086/1542720

Community
  • 1
  • 1
Adnan Mulla
  • 2,872
  • 3
  • 25
  • 35