Sripaul
Sripaul

Reputation: 2235

Android Contacts Plugin or option

I need an option say "Chat with this Contact" included in the options list when you click Contacts in Android and then select options.

Basically what I want to find out is if I can link my application feature say chat directly with the contacts menu in Android? Are there any examples for that?

Upvotes: 1

Views: 127

Answers (1)

Purush Pawar
Purush Pawar

Reputation: 4283

I don't think we can do that. The options we see on pressing the hard option key ( or soft one on recent handsets) are generated from either xml or by programatically. They are not some kind of a global properties to be set (kind of like Blackberry apps). So, NO...

If you want to send user to your chatting/communication application, you can do that by registering the android.intent.action.SENDTO and/or android.intent.action.SEND intent filters with your activity.

Here's how I did it.

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

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <action android:name="android.intent.action.SENDTO" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="sms" />
                <data android:scheme="smsto" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.SEND" />

                <category android:name="android.intent.category.DEFAULT" />

                <data android:mimeType="text/*" />
            </intent-filter>
</activity>

If you set these intent filters appropriately, on clicking any contact user will get a prompt to chose between the default messaging application and your application which, I think, fairly serves your purpose.

Upvotes: 2

Related Questions