Start a new topic

Cache and Offline Policy not working

I have Tried the Cache and Offline Policy, look like they are both not working. here is my code


myBranches.setCache(new InMemoryLRUCache(), CachePolicy.BOTH);
myBranches.setOffline(OfflinePolicy.LOCAL_FIRST, new SqlLiteOfflineStore<MacauBranches>(this));
myBranches.get(new KinveyListCallback<MacauBranches>() {
@Override
public void onSuccess(MacauBranches[] macauBranches) {

chinaAddressAdapter = new ChinaAddressAdapter(getApplicationContext(), R.layout.china_address_row, macauBranches,userName);
if (chinaAddressLiseView != null) {

chinaAddressLiseView.setAdapter(chinaAddressAdapter);
}

}

@Override
public void onFailure(Throwable throwable) {

}

}


I also add everything needed in Manifest


<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<service
android:name="com.kinvey.android.offline.KinveySyncService"
android:exported="true"
android:process=":backgroundsync">
<intent-filter>
<action android:name="com.kinvey.android.ACTION_OFFLINE_SYNC" />
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
<action android:name="android.net.wifi.STATE_CHANGE" />
</intent-filter>
</service>


It just doesn't work when I am in Airplane Mode, nothing is Cache. Is there anything I am missing? BTW I am using  2.10.4. because 2.10.5 somehow just crash on my app


compile(name: 'kinvey-android-2.10.4', ext: 'aar')




Login or Signup to post a comment