Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim JavaObject1 As JavaObject
Private Api As Int
Private r As Reflector
End Sub
Sub Service_Create
'This is the program entry point.
'This is a good place to load resources that are not specific to a single activity.
Api = r.GetStaticField("android.os.Build$VERSION", "SDK_INT")
Log(Api)
If Api>=23 Then
' Dim JavaObject1 As JavaObject
JavaObject1.InitializeContext
Dim Ignoring As Boolean=JavaObject1.RunMethod("isIgnoringBatteryOptimizations", Null)
If Ignoring=False Then
MsgboxAsync("Please confirm the following form to exclude the app from battery optimization.", "Battery optimization")
'RuntimePermissions1.CheckAndRequest("android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS")
' Dim JavaObject1 As JavaObject
JavaObject1.InitializeContext
JavaObject1.RunMethod("ShowPermissionDialog", Null)
End If
End If
End Sub