Search code examples
androidemailhttpandroid-activitydynamic-url

Starting android app on click dynamic link in email


I need to start an app from email using link (which contain some parameter) for example http://www.this-so-does-not-exist.com/something

I am able to start my app after click a simple email using following in intent-filter.

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

            <data
                android:host="www.this-so-does-not-exist.com/something"
                android:scheme="http"/>
        </intent-filter>

now i want to pass some information along with email link like http://www.this-so-does-not-exist.com/something?id=4545

how i can read this from my android app.

any help will be much appreciated. thanks in advance.


Solution

  • getIntent().getData() from your Activity will give you the Uri that was used to launch your app. Query parameters are available from a variety of methods on Uri, such as getQueryParameter().