Sync adapter not running on Xiaomi

I wrote a sync adapter in Xamarin but there is a problem with Xiaomi MiUI.

There are two ways to start the sync adapter, one is "settings -> accounts -> sync" over the phone, the other is in the application using ContentResolver.RequestSync ().

First of all, I had to enable MiUI AutoStart for my application. Otherwise, the security system logged the error.

I / AutoStartManagerService: MIUILOG- Service Failure: Intent {act = android.content.SyncAdapter cmp = com.fingrad.dashboard / .AdapterService (has additional functions)} userId: 0 uid: 10186 E / SyncManager: Attempt to merge failed - target : ComponentInfo {com.fingrad.dashboard / com.fingrad.dashboard.AdapterService}

However, the first method does not work if the application process is already in the phone memory. The second method does not work unless the SyncAdapterService has cleared the Process attribute. See example below.

[Service(Name = "com.fingrad.dashboard.SyncAdapterService"  
, Exported = true, Process = ":sync")] 
[IntentFilter(new[] { "android.content.SyncAdapter" })] 
[MetaData("android.content.SyncAdapter", Resource = "@xml/syncadapter")] 
class SyncAdapterService : Service

      

In other words, the adapter does not work if any of the conditions are met. 1) The adapter service has a process attribute 2) There is no application instance in the phone memory.

Obviously the source of the problem is MiUI security. MiUI launches synchronizer, launches another process that does not have autorun permission. I tried to set the default process name to "Process =" but it didn't help.

UPDATE PS Time has passed, but the problem remains. Redmi Note 4, MIUI 9.5, Android 7 and Redmi Note 3, MIUI 9.5, Android 6.

+3


source to share


1 answer


I found out how to get MIUI to launch Sync Adapter. You must do the following:

  • Open Settings -> Installed Application
  • Select your application
  • Enable autorun
  • Disable all battery limitations.


enter image description here

0


source







All Articles