nextcloud / news-android

📱🗞️ Android client for the Nextcloud news/feed reader app
https://play.google.com/store/apps/details?id=de.luhmer.owncloudnewsreader
GNU Affero General Public License v3.0
697 stars 258 forks source link

Sync functionality is never executed #1448

Closed sake closed 4 months ago

sake commented 4 months ago

Since a few days the app is not syncing anymore. I finally found some time to investigate, but I hit a limit, so I want to share my findings, hoping to get some more input or a solution.

As most people in the issues seem to have problems with the server, I checked everything there and indeed it looks fine. There are no errors in the logs, also nothing suspicious in the debug level.

When I clear the app data and log in with either the nextcloud app, or with the manual method, I arrive at the empty unread items screen. The account symbol is not set and triggers a new login once pressed. However I can confirm, that the login seems to work at least partly, as I see a successful request to the news versions endpoint of the logged in user in the servers access log. When triggering an update by pulling down the screen, it loads forever and again there is no request arriving at the server. The sidebar with the feeds contains no entries as expected when nothing is retrieved from the server. I then tried to add a feed which is already configured in the account and there was an error message, that the particular feed is already present. I also gave the two apps the ability to execute background tasks, so I can rule out some weird powersaving mechanism killing the sync task.

I then pulled the app and tried debugging. To my understanding, OwnCloudSyncAdapter.onPerformSync should be executed. Here I could neither hit a breakpoint, nor get any log prints in logcat.

I am not familiar with Sync Adapters and I don't fully understand how this code should be triggered. In the debug app the following code is executed with two accounts, one of type nextcloud and one from this app. I guess this is the trigger for the manual account. Where is the trigger for the nextcloud app account?

for (Account acc : accounts) {
    String accountType = AccountGeneral.getAccountType(this);
    if (acc.type.equals(accountType)) {
                    ContentResolver.requestSync(acc, accountType, accBundle);
       }
}

Any hints where I can look further are much appreciated.

sake commented 4 months ago

I rebooted my phone and now the sync is working again. Should have done that earlier, although I didn't expect that these things are still necessary these days.

I don't know if there is still something that can be learned from that, so I let the maintainer close the issue. For me it's working again and I have a workaround to try if it happens again.

David-Development commented 4 months ago

Thank you for the report! Interesting that it caused such issues. Depending on wether you used SSO or not it could be an issue in the communication with the Nextcloud Files app or maybe an Account Sync issue in Android (not sure if it's an official Android ROM / Custom ROM). Glad it's working again after a restart. Hopefully this issue helps others in case they have a similar problem.