ContentResolver requestSync not triggering SyncAdapter onPerformSync when wifi not available but cellular data is on samsung device
Asked Answered
R

0

6

The problem is as follows. I have a working SyncAdapter and ContentResolver setup. The problem that SyncAdapters onPerformSync is not triggered happens when I have wifi turned on but the wifi does not have an internet connection (it is connected to an IOT device). I have a sim card and cellular data is available. In the app I have NetworkManager set so I request cellular data like so:

val req = NetworkRequest.Builder()
req.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR)
req.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)

And if I create an API request instead of triggering ContentResolver.requestSync it works normally.

This code also works normally on a Huawei tablet but not on Samsung.

So basically. I have cellular internet but SyncAdapter does not realise this(on Samsung device) and does not trigger onPerformSync. Anyway to make SyncAdapter realise this?

Roughandready answered 3/9, 2020 at 12:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.