Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/228.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 联系人应用程序未传递意图_Android_Android Intent_Uri_Contacts_Phonebook - Fatal编程技术网

Android 联系人应用程序未传递意图

Android 联系人应用程序未传递意图,android,android-intent,uri,contacts,phonebook,Android,Android Intent,Uri,Contacts,Phonebook,我正在开发android应用程序,我需要在我的应用程序的特定联系人中添加自定义行。到目前为止,我可以在联系人中添加行,但当我单击该行时,它不会打开我的应用程序,而是显示如下内容:“找不到处理此操作的应用程序” 我在谷歌上搜索了很多次,但没有找到运气 这是我的密码: 在特定联系人中添加自定义行的方法: private void addContact(Account account, ContactDTO dto) { Log.e("addContact", "dto : " + d

我正在开发android应用程序,我需要在我的应用程序的特定联系人中添加自定义行。到目前为止,我可以在联系人中添加行,但当我单击该行时,它不会打开我的应用程序,而是显示如下内容:“找不到处理此操作的应用程序”

我在谷歌上搜索了很多次,但没有找到运气

这是我的密码: 在特定联系人中添加自定义行的方法:

private void addContact(Account account, ContactDTO dto) {
        Log.e("addContact", "dto : " + dto.displayName + " & dto : " + dto.contactID);
        Log.e("addContact", "account.name : " + account.name + " & account.type : " + account.type);
        ArrayList<ContentProviderOperation> operationList = new ArrayList<ContentProviderOperation>();

        ContentProviderOperation.Builder builder = ContentProviderOperation.newInsert(RawContacts.CONTENT_URI);
        builder.withValue(RawContacts.ACCOUNT_NAME, account.name);
        builder.withValue(RawContacts.ACCOUNT_TYPE, account.type);
        builder.withValue(RawContacts.SYNC1, dto.displayName);
        operationList.add(builder.build());

        builder = ContentProviderOperation.newInsert(Data.CONTENT_URI);
        builder.withValueBackReference(Data.RAW_CONTACT_ID, 0);
        builder.withValue(Data.MIMETYPE, getResources().getString(R.string.mimeType));
        builder.withValue(Data.DATA1, dto.displayName);
        builder.withValue(Data.DATA2, dto.phoneNo);
        builder.withValue(Data.DATA3, "View App");
        operationList.add(builder.build());

        operationList.add(ContentProviderOperation.newUpdate(AggregationExceptions.CONTENT_URI)
                .withValue(AggregationExceptions.TYPE, AggregationExceptions.TYPE_KEEP_TOGETHER)
                .withValueBackReference(AggregationExceptions.RAW_CONTACT_ID1, 0)
                .withValue(AggregationExceptions.RAW_CONTACT_ID2, dto.contactID)
                .withValue(AggregationExceptions.CONTENT_ITEM_TYPE, getResources().getString(R.string.mimeType))
                .build());
        try {
            mContentResolver.applyBatch(ContactsContract.AUTHORITY, operationList);
        } catch (OperationApplicationException e) {
            e.printStackTrace();
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
private void addContact(帐户,ContactDTO到dto){
Log.e(“addContact”、“dto:+dto.displayName+”和dto:+dto.contactID”);
Log.e(“addContact”、“account.name:”+account.name+“&account.type:”+account.type);
ArrayList operationList=新建ArrayList();
ContentProviderOperation.Builder=ContentProviderOperation.newInsert(RawContacts.CONTENT\u URI);
builder.withValue(rawscontacts.ACCOUNT\u NAME,ACCOUNT.NAME);
builder.withValue(rawscontacts.ACCOUNT\u类型,ACCOUNT.TYPE);
builder.withValue(rawscontacts.SYNC1,dto.displayName);
add(builder.build());
builder=ContentProviderOperation.newInsert(Data.CONTENT\u URI);
builder.withValueBackReference(Data.RAW\u CONTACT\u ID,0);
builder.withValue(Data.MIMETYPE,getResources().getString(R.string.MIMETYPE));
builder.withValue(Data.DATA1,dto.displayName);
builder.withValue(Data.DATA2,dto.phoneNo);
builder.withValue(Data.DATA3,“查看应用程序”);
add(builder.build());
operationList.add(ContentProviderOperation.newUpdate(AggregationExceptions.CONTENT\u URI)
.withValue(AggregationExceptions.TYPE、AggregationExceptions.TYPE_保持在一起)
.带ValueBackReference(AggregationExceptions.RAW\u CONTACT\u ID1,0)
.withValue(AggregationExceptions.RAW_CONTACT_ID2,dto.contactID)
.withValue(AggregationExceptions.CONTENT\u ITEM\u TYPE,getResources().getString(R.string.mimeType))
.build());
试一试{
mContentResolver.applyBatch(contacts contract.AUTHORITY,operationList);
}捕获(操作应用程序异常e){
e、 printStackTrace();
}捕获(远程异常){
e、 printStackTrace();
}
}
Manifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="in.demosample">

    <uses-permission
        android:name="android.permission.AUTHENTICATE_ACCOUNTS"
        android:maxSdkVersion="22" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
    <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@drawable/ic_launcher"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">

            <intent-filter android:icon="@drawable/ic_launcher">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter android:icon="@drawable/ic_launcher">
                <!--<action android:name="android.intent.action.VIEW" />-->
                <action android:name="android.intent.action.VIEW" />
                <action android:name="fm.last.android.sync.LOGIN" />

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

                <data
                    android:scheme="vnd.android.cursor.item/fm.last.android.sync.login" />

                <!--<data android:host="ccc.in.demosample.mainactivity" />-->
                <!--<data android:scheme="http" />-->
                <!--<data android:pathPattern="/.*" />-->
                <data android:mimeType="vnd.android.cursor.item/fm.last.android.sync.login" />
            </intent-filter>
        </activity>

        <service
            android:name=".AccountAuthenticatorService"
            android:exported="true"
            android:process=":auth">
            <intent-filter>
                <action android:name="android.accounts.AccountAuthenticator" />
            </intent-filter>
            <meta-data
                android:name="android.accounts.AccountAuthenticator"
                android:resource="@xml/authenticator" />
        </service>

        <service
            android:name=".ContactsSyncAdapterService"
            android:exported="true"
            android:process=":contacts">
            <intent-filter>
                <action android:name="android.content.SyncAdapter" />
            </intent-filter>

            <meta-data
                android:name="android.content.SyncAdapter"
                android:resource="@xml/sync_contacts" />
            <meta-data
                android:name="android.provider.CONTACTS_STRUCTURE"
                android:resource="@xml/contacts" />
        </service>

    </application>

</manifest>
<?xml version="1.0" encoding="utf-8"?>
<ContactsSource xmlns:android="http://schemas.android.com/apk/res/android">
    <ContactsDataKind
        android:detailColumn="data3"
        android:detailSocialSummary="true"
        android:mimeType="vnd.android.cursor.item/fm.last.android.sync.login"
        android:summaryColumn="data2" />
</ContactsSource>
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android">
</PreferenceScreen>
<?xml version="1.0" encoding="utf-8"?>
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
    android:accountPreferences="@xml/account_preferences"
    android:accountType="@string/ACCOUNT_TYPE"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:smallIcon="@drawable/ic_launcher" />
<?xml version="1.0" encoding="utf-8"?>
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
    android:accountType="@string/ACCOUNT_TYPE"
    android:contentAuthority="com.android.contacts"
    android:supportsUploading="false" />

contacts.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="in.demosample">

    <uses-permission
        android:name="android.permission.AUTHENTICATE_ACCOUNTS"
        android:maxSdkVersion="22" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
    <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@drawable/ic_launcher"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">

            <intent-filter android:icon="@drawable/ic_launcher">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter android:icon="@drawable/ic_launcher">
                <!--<action android:name="android.intent.action.VIEW" />-->
                <action android:name="android.intent.action.VIEW" />
                <action android:name="fm.last.android.sync.LOGIN" />

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

                <data
                    android:scheme="vnd.android.cursor.item/fm.last.android.sync.login" />

                <!--<data android:host="ccc.in.demosample.mainactivity" />-->
                <!--<data android:scheme="http" />-->
                <!--<data android:pathPattern="/.*" />-->
                <data android:mimeType="vnd.android.cursor.item/fm.last.android.sync.login" />
            </intent-filter>
        </activity>

        <service
            android:name=".AccountAuthenticatorService"
            android:exported="true"
            android:process=":auth">
            <intent-filter>
                <action android:name="android.accounts.AccountAuthenticator" />
            </intent-filter>
            <meta-data
                android:name="android.accounts.AccountAuthenticator"
                android:resource="@xml/authenticator" />
        </service>

        <service
            android:name=".ContactsSyncAdapterService"
            android:exported="true"
            android:process=":contacts">
            <intent-filter>
                <action android:name="android.content.SyncAdapter" />
            </intent-filter>

            <meta-data
                android:name="android.content.SyncAdapter"
                android:resource="@xml/sync_contacts" />
            <meta-data
                android:name="android.provider.CONTACTS_STRUCTURE"
                android:resource="@xml/contacts" />
        </service>

    </application>

</manifest>
<?xml version="1.0" encoding="utf-8"?>
<ContactsSource xmlns:android="http://schemas.android.com/apk/res/android">
    <ContactsDataKind
        android:detailColumn="data3"
        android:detailSocialSummary="true"
        android:mimeType="vnd.android.cursor.item/fm.last.android.sync.login"
        android:summaryColumn="data2" />
</ContactsSource>
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android">
</PreferenceScreen>
<?xml version="1.0" encoding="utf-8"?>
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
    android:accountPreferences="@xml/account_preferences"
    android:accountType="@string/ACCOUNT_TYPE"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:smallIcon="@drawable/ic_launcher" />
<?xml version="1.0" encoding="utf-8"?>
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
    android:accountType="@string/ACCOUNT_TYPE"
    android:contentAuthority="com.android.contacts"
    android:supportsUploading="false" />

account\u preferences.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="in.demosample">

    <uses-permission
        android:name="android.permission.AUTHENTICATE_ACCOUNTS"
        android:maxSdkVersion="22" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
    <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@drawable/ic_launcher"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">

            <intent-filter android:icon="@drawable/ic_launcher">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter android:icon="@drawable/ic_launcher">
                <!--<action android:name="android.intent.action.VIEW" />-->
                <action android:name="android.intent.action.VIEW" />
                <action android:name="fm.last.android.sync.LOGIN" />

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

                <data
                    android:scheme="vnd.android.cursor.item/fm.last.android.sync.login" />

                <!--<data android:host="ccc.in.demosample.mainactivity" />-->
                <!--<data android:scheme="http" />-->
                <!--<data android:pathPattern="/.*" />-->
                <data android:mimeType="vnd.android.cursor.item/fm.last.android.sync.login" />
            </intent-filter>
        </activity>

        <service
            android:name=".AccountAuthenticatorService"
            android:exported="true"
            android:process=":auth">
            <intent-filter>
                <action android:name="android.accounts.AccountAuthenticator" />
            </intent-filter>
            <meta-data
                android:name="android.accounts.AccountAuthenticator"
                android:resource="@xml/authenticator" />
        </service>

        <service
            android:name=".ContactsSyncAdapterService"
            android:exported="true"
            android:process=":contacts">
            <intent-filter>
                <action android:name="android.content.SyncAdapter" />
            </intent-filter>

            <meta-data
                android:name="android.content.SyncAdapter"
                android:resource="@xml/sync_contacts" />
            <meta-data
                android:name="android.provider.CONTACTS_STRUCTURE"
                android:resource="@xml/contacts" />
        </service>

    </application>

</manifest>
<?xml version="1.0" encoding="utf-8"?>
<ContactsSource xmlns:android="http://schemas.android.com/apk/res/android">
    <ContactsDataKind
        android:detailColumn="data3"
        android:detailSocialSummary="true"
        android:mimeType="vnd.android.cursor.item/fm.last.android.sync.login"
        android:summaryColumn="data2" />
</ContactsSource>
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android">
</PreferenceScreen>
<?xml version="1.0" encoding="utf-8"?>
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
    android:accountPreferences="@xml/account_preferences"
    android:accountType="@string/ACCOUNT_TYPE"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:smallIcon="@drawable/ic_launcher" />
<?xml version="1.0" encoding="utf-8"?>
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
    android:accountType="@string/ACCOUNT_TYPE"
    android:contentAuthority="com.android.contacts"
    android:supportsUploading="false" />

authenticator.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="in.demosample">

    <uses-permission
        android:name="android.permission.AUTHENTICATE_ACCOUNTS"
        android:maxSdkVersion="22" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
    <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@drawable/ic_launcher"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">

            <intent-filter android:icon="@drawable/ic_launcher">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter android:icon="@drawable/ic_launcher">
                <!--<action android:name="android.intent.action.VIEW" />-->
                <action android:name="android.intent.action.VIEW" />
                <action android:name="fm.last.android.sync.LOGIN" />

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

                <data
                    android:scheme="vnd.android.cursor.item/fm.last.android.sync.login" />

                <!--<data android:host="ccc.in.demosample.mainactivity" />-->
                <!--<data android:scheme="http" />-->
                <!--<data android:pathPattern="/.*" />-->
                <data android:mimeType="vnd.android.cursor.item/fm.last.android.sync.login" />
            </intent-filter>
        </activity>

        <service
            android:name=".AccountAuthenticatorService"
            android:exported="true"
            android:process=":auth">
            <intent-filter>
                <action android:name="android.accounts.AccountAuthenticator" />
            </intent-filter>
            <meta-data
                android:name="android.accounts.AccountAuthenticator"
                android:resource="@xml/authenticator" />
        </service>

        <service
            android:name=".ContactsSyncAdapterService"
            android:exported="true"
            android:process=":contacts">
            <intent-filter>
                <action android:name="android.content.SyncAdapter" />
            </intent-filter>

            <meta-data
                android:name="android.content.SyncAdapter"
                android:resource="@xml/sync_contacts" />
            <meta-data
                android:name="android.provider.CONTACTS_STRUCTURE"
                android:resource="@xml/contacts" />
        </service>

    </application>

</manifest>
<?xml version="1.0" encoding="utf-8"?>
<ContactsSource xmlns:android="http://schemas.android.com/apk/res/android">
    <ContactsDataKind
        android:detailColumn="data3"
        android:detailSocialSummary="true"
        android:mimeType="vnd.android.cursor.item/fm.last.android.sync.login"
        android:summaryColumn="data2" />
</ContactsSource>
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android">
</PreferenceScreen>
<?xml version="1.0" encoding="utf-8"?>
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
    android:accountPreferences="@xml/account_preferences"
    android:accountType="@string/ACCOUNT_TYPE"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:smallIcon="@drawable/ic_launcher" />
<?xml version="1.0" encoding="utf-8"?>
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
    android:accountType="@string/ACCOUNT_TYPE"
    android:contentAuthority="com.android.contacts"
    android:supportsUploading="false" />

sync_contacts.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="in.demosample">

    <uses-permission
        android:name="android.permission.AUTHENTICATE_ACCOUNTS"
        android:maxSdkVersion="22" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
    <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@drawable/ic_launcher"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">

            <intent-filter android:icon="@drawable/ic_launcher">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter android:icon="@drawable/ic_launcher">
                <!--<action android:name="android.intent.action.VIEW" />-->
                <action android:name="android.intent.action.VIEW" />
                <action android:name="fm.last.android.sync.LOGIN" />

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

                <data
                    android:scheme="vnd.android.cursor.item/fm.last.android.sync.login" />

                <!--<data android:host="ccc.in.demosample.mainactivity" />-->
                <!--<data android:scheme="http" />-->
                <!--<data android:pathPattern="/.*" />-->
                <data android:mimeType="vnd.android.cursor.item/fm.last.android.sync.login" />
            </intent-filter>
        </activity>

        <service
            android:name=".AccountAuthenticatorService"
            android:exported="true"
            android:process=":auth">
            <intent-filter>
                <action android:name="android.accounts.AccountAuthenticator" />
            </intent-filter>
            <meta-data
                android:name="android.accounts.AccountAuthenticator"
                android:resource="@xml/authenticator" />
        </service>

        <service
            android:name=".ContactsSyncAdapterService"
            android:exported="true"
            android:process=":contacts">
            <intent-filter>
                <action android:name="android.content.SyncAdapter" />
            </intent-filter>

            <meta-data
                android:name="android.content.SyncAdapter"
                android:resource="@xml/sync_contacts" />
            <meta-data
                android:name="android.provider.CONTACTS_STRUCTURE"
                android:resource="@xml/contacts" />
        </service>

    </application>

</manifest>
<?xml version="1.0" encoding="utf-8"?>
<ContactsSource xmlns:android="http://schemas.android.com/apk/res/android">
    <ContactsDataKind
        android:detailColumn="data3"
        android:detailSocialSummary="true"
        android:mimeType="vnd.android.cursor.item/fm.last.android.sync.login"
        android:summaryColumn="data2" />
</ContactsSource>
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android">
</PreferenceScreen>
<?xml version="1.0" encoding="utf-8"?>
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
    android:accountPreferences="@xml/account_preferences"
    android:accountType="@string/ACCOUNT_TYPE"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:smallIcon="@drawable/ic_launcher" />
<?xml version="1.0" encoding="utf-8"?>
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
    android:accountType="@string/ACCOUNT_TYPE"
    android:contentAuthority="com.android.contacts"
    android:supportsUploading="false" />

就这样。 请告诉我哪里出了问题。
上面的代码将在contact中添加自定义行,但不带应用程序图标,单击该行将显示toast,并且不会打开我的应用程序。

我在棉花糖设备中遇到了相同的问题。唯一有效的方法就是改变mimeType

尝试从更改您的mimeType

<data android:mimeType="vnd.android.cursor.item/fm.last.android.sync.login" />


无论您在哪里使用,都要进行此更改