2

First of all, thanks for all the help. I use stackoverflow daily to solve almost every single code problem I have, it's a brilliant platform with brilliant people.

To my problem:

My initial goal was to add a custom Connection (action button) to the contacts on Android, with custom actions to execute in my app (Example: Call with my app). I already managed to get that done with Accounts and Sync Providers in most devices thanks to posts like this one, being my code similar to the response by Rene Ummels and the c99.org tutorial:

Display the app icon if the contact is associated with the application in phone address book

The action works perfectly in three test devices with Android 4.0.4, 4.3.1 and 4.4.3, and shows up like this: enter image description here

The problem is that, from my test devices, there is one in which it doesn't work. The device details (up) and what doesn't work (down):

enter image description here

Basically, it seems to me like this version of Android (4.4.2) has a different way to deal with Connections.

My custom app icon in this case is like a dead button, you click it and it does nothing. I know it's possible to have it execute actions because the Facebook button right beside it works, it takes you to the Facebook feed of that Contact.

My question is: How do I activate that Custom App button to initiate my Activity as intended in this device?

Has anyone had the same problem? I didn't find anything similar by searching on the Internet.

Thanks a lot, I hope I gave enough details and someone can lead me to an answer.

Community
  • 1
  • 1

1 Answers1

0

Solved it.

As far as I know, the problem was in a naming convention.

The relevant bit was in my ContactsSyncAdapter, in a part that looked like this:

builder = ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI);
        builder.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0);
        builder.withValue(ContactsContract.Data.MIMETYPE, "vnd.android.cursor.item/com.example.precall.contact_activity");

All I had to do is change that "contact_activity" name, which was the layout I wanted to access with the button, to "profile", then rename the contact_activity.xml I had built to profile.xml. It looks like so:

builder = ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI);
        builder.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0);
        builder.withValue(ContactsContract.Data.MIMETYPE, "vnd.android.cursor.item/com.example.precall.profile");

(Then of course I had to change the Manifest to accommodate this edit)

As far as I know and unless I'm completely wrong about the reason, this is a naming convention that doesn't show up in the documentation, it is just assumed by example that it should be named like that.

It seems pretty cheap and hard-cody to me that in this particular case you have to name your .xml a certain way, or else it won't be a button in KitKat, just a dead image.

Either way, I hope this helps someone if they arrive to the same frustrating issue.

:D