user3455150
user3455150

Reputation: 87

How to show chooser Intent with my own android app on click of WhatsApp location?

If there's a WhatsApp chat which has location shared, when clicked it shows a chooser intent with some set of applications. I want to write an intent filter so that my application will also be listed there.

Upvotes: 1

Views: 795

Answers (2)

user3455150
user3455150

Reputation: 87

Add this to your Manifest file (Particular activity):

<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="geo" />
</intent-filter>

Upvotes: 0

Ghulam Moinul Quadir
Ghulam Moinul Quadir

Reputation: 1648

You can do it by supporting implicit intent to your Activity. Define intent-filter to Activity to which you want to open after clicking to your Application from options.

<activity android:name=".BrowserActivitiy"
          android:label="@string/app_name">

      <intent-filter>
         <action android:name="android.intent.action.VIEW" />
         <category android:name="android.intent.category.DEFAULT" />
         <data android:scheme="http"/>
         <data android:scheme="geo"/>
      </intent-filter>
</activity>

To know more about Intents and Intent filters go to official website. https://developer.android.com/guide/components/intents-filters

Upvotes: 2

Related Questions