I am trying to get the list of contact writable accounts in my device using the following code
public static final String SYNC_META_DATA = "android.content.SyncAdapter";
public static final String[] METADATA_CONTACTS_NAMES = new String[] {
"android.provider.ALTERNATE_CONTACTS_STRUCTURE",
"android.provider.CONTACTS_STRUCTURE"
};
final Intent intent = new Intent(SYNC_META_DATA).setPackage(resPackageName);
final List<ResolveInfo> intentServices =
pm.queryIntentServices(intent, PackageManager.GET_META_DATA);
if (intentServices != null) {
for (final ResolveInfo resolveInfo : intentServices) {
final ServiceInfo serviceInfo = resolveInfo.serviceInfo;
if (serviceInfo == null) {
continue;
}
for (String metadataName : METADATA_CONTACTS_NAMES) {
final XmlResourceParser parser = serviceInfo.loadXmlMetaData(
pm, metadataName);
if (parser != null) {
return parser;
}
}
}
}
but I am always getting XmlResourceParser parser as null. so please help me how can I fetch the list of contact writable accounts in android