android – How can I enable the sync option by default when false in app?-ThrowExceptions

Exception or error:

I use odoo mobile framework. How can I enable the sync option on app startup? (The option is disabled by default.)

enter image description here

How to solve:

odoo has a customer_sync_adapter.xml and a CustomersSyncProvider.java; when looking at the referenced ResPartner.java, it says that, String AUTHORITY = BuildConfig.APPLICATION_ID + ".core.provider.content.sync.res_partner";. An Account of type com.odoo.auth is expected, while assigning the proper content authority is important, else it will resolve nothing.

ContentResolver.setSyncAutomatically(account, ResPartner.AUTHORITY, true);

for the other one sync-adapter, the respective contentAuthority & accountType are required.

would only enable it on first run, or just ask the user. when always enabling it, it is difficult to disable it.

Leave a Reply

Your email address will not be published. Required fields are marked *