Question about android syncadapter: Sync is not performed in a certain period. Is it a problem with a particular device?

Asked 2 years ago, Updated 2 years ago, 138 views

Hello. We are developing an app that fetches data through API every hour with Android syncadapter. The emulator works fine. Sync is not performed on the physical device (Galaxy S7). The code itself does not seem to be a big problem because it works normally in the emulator. The problem is this. When I tested it with the "Synchronize Now" feature, it was disabled on my phone.

Synchronization now works fine with the emulator.

What's the problem? Does this problem only occur in Galaxy S7? The privileges granted in relation to the syncadapter are as follows:


    <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.AUTHENTICATE_ACCOUNTS"/>

syncadapter android

2022-09-22 19:50

1 Answers

If you have a Samsung device, please install the app of the source code below and test it for 3 to 4 hours before you reply. I found that the syncadapter, a component used in the app I made and the app I made with tutorial on Google, did not work properly on Samsung devices. Not only me, but I also found people who made inquiries about this in stackoverflow and reddit.

https://stackoverflow.com/questions/44384867/android-syncadapter-doesnt-syncs-on-my-device-samsung-s6-edge-plus-nougatsyncs

https://www.reddit.com/r/androiddev/comments/6lmk8x/is_syncadapter_broken_on_newest_samsung_devices/

To give you specific symptoms, the app that synchronizes at a set period using a synchronizer does not work normally. I tested it by myself for about a month No matter how you set up SYNC_INTERVAL and SYNC_FLEXTIME, we found that you sync only once a day (when you first start APP, you create an account and force it to sync). It works fine with the emulator and works fine as I set it up on all my Android devices, but it only happens with my Galaxy 7. I'm just guessing that the power management software on the Galaxy s7 is interfering with the syncadapter, and I've got no answer for this anywhere.

Leave the source code address so you can test it yourself. This is the sunshine app source code for the Developing Android Apps course provided by udacity so that you can learn the Android development process in tutorial format on Google.

https://github.com/udacity/Sunshine-Version-2

The source code address for the suncadapter is as follows (here, it is supposed to be synchronized once every three hours, but it is also synchronized only once a day on the Samsung device)

https://github.com/udacity/Sunshine-Version-2/blob/sunshine_master/app/src/main/java/com/example/android/sunshine/app/sync/SunshineSyncAdapter.java

They want me to check if it's synchronized once in 24 hours without knowingly like me No, please monitor the log and leave a reply if the SunShine app is not synchronized every three hours as set.


2022-09-22 19:50

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.