Android Question Error on setMasterSyncAutomatically

MaAncheNo

Member
Licensed User
Hi all,

I would want to set this flag: setMasterSyncAutomatically
with this code:
B4X:
Sub CheckBox1_CheckedChange(Checked As Boolean)
  Dim r1 As Reflector
  Dim args(3) As Object
  Dim types(3) As String
  r1.Target = r1.GetContext
  args(0) = r1.RunMethod("getContentResolver")
  types(0) = "android.content.ContentResolver"
  args(1) = "setMasterSyncAutomatically"
  types(1) = "java.lang.String"
  args(2) = Checked
  types(2) = "java.lang.boolean"
  r1.RunStaticMethod("android.provider.Settings$Secure", "putBoolean", args, types)
End Sub
but I receive this error:
B4X:
java.lang.NoSuchMethodException: putBoolean [class android.content.ContentResolver, class java.lang.String, boolean]
I added this to android manifest:
B4X:
AddPermission(android.permission.WRITE_SYNC_SETTINGS)
What is wrong?
 
Top