1

I need some help with this scenario fro my application: When the user is going to a specific contact and click that link icon (like What's up ), the application (eq. WhatsUp) is opened with that contact id.

Here you can see the links icons

So far what I did: - I succeed to add my custom data for a specific contact . I have my app icon and the mimedata custom data with that contact. The mimetype that I defined within the contact data is: "vnd.android.cursor.item/com.sunny.contacts.Account"

Now on manifest I configured main activity the following:

    <activity
       android:name=".ActivityMain"
       android:label="@string/app_name"
       android:windowSoftInputMode="adjustResize|adjustPan">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />     
        </intent-filter>    
        <intent-filter>         
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="vnd.android.cursor.item/com.sunny.contacts.Account"/>      
        </intent-filter>    
   </activity>

On ActivityMain::OnCreate I'm reading the Intent data but unfortunately the application is not opened and I have no idea what is wrong.

Thank you for your help,

Colateral
  • 1,736
  • 2
  • 18
  • 22

1 Answers1

1

Instead of <data android:mimeType="vnd.android.cursor.item/com.sunny.contacts.Account"/> use this <data android:mimeType="vnd.android.cursor.item/vnd.com.sunny.contacts.profile"/>

which you defined in xml

<ContactsSource xmlns:android="http://schemas.android.com/apk/res/android">
    <ContactsDataKind
        android:icon="@drawable/ic_launcher"
        android:mimeType="vnd.android.cursor.item/vnd.com.sunny.contacts.profile"
        android:summaryColumn="data2"
        android:detailColumn="data3"
        android:detailSocialSummary="true" />
</ContactsSource> 
dastan
  • 892
  • 10
  • 17
  • can anyone suggest code how to get contact data from intent in ViewActivity. – Suresh Oct 04 '18 at 06:38
  • are you looking this: https://stackoverflow.com/questions/41327416/pick-contact-directly-from-contact-picker-intent – dastan Oct 18 '18 at 09:19