gpt4 book ai didi

android - Syncadapter 适用于手机但不适用于平板电脑

转载 作者:行者123 更新时间:2023-11-29 20:49:21 26 4
gpt4 key购买 nike

我实现了一个简单的 syncadapter,它在 Moto G 上运行良好,但在 Nexus 7 上却不行(永远不会调用 onPerformSync)

为了测试,我像这样手动启动同步:

Bundle settingsBundle = new Bundle();
settingsBundle.putBoolean(
ContentResolver.SYNC_EXTRAS_MANUAL, true);
settingsBundle.putBoolean(
ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
/*
* Request the sync for the default account, authority, and
* manual sync settings
*/
ContentResolver.requestSync(mAccount, DbContract.AUTHORITY, settingsBundle);

我的 manifest.xml 看起来像这样:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="app.com.jeldrik.teacherslittlehelper" >
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:authorities="app.com.jeldrik.teacherslittlehelper.data"
android:name="app.com.jeldrik.teacherslittlehelper.data.ClassContentProvider">
</provider>

<service
android:name="app.com.jeldrik.teacherslittlehelper.DataTransfer.AuthenticatorService">
<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="app.com.jeldrik.teacherslittlehelper.DataTransfer.SyncService"
android:exported="true"
android:process=":sync">
<intent-filter>
<action android:name="android.content.SyncAdapter"/>
</intent-filter>
<meta-data
android:name="android.content.SyncAdapter"
android:resource="@xml/syncadapter" />
</service>

</application>

最佳答案

好吧,愚蠢的错误和简单的解决方案:Android 发出警告说我的平板电脑内存快满了。似乎在这种情况下所有同步都被自动禁用。删除了一些东西,现在可以同步了:P

关于android - Syncadapter 适用于手机但不适用于平板电脑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29571523/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com