See
http://developer.android.com/reference/android/os/PowerManager.html#isInteractive() for more info about
Dont know how but this shouild be doneable with Reflection and/or Javaobject
This does not work, probably as I am not too familiar with jo and java.
Sub is_wakelock_set() As Boolean
Dim j As JavaObject
Return j.InitializeStatic("android.os.PowerManager.WakeLock").RunMethod("isHeld",Null)
End Sub
This is the error, wanna help fix it
java.lang.IllegalArgumentException: expected receiver of type android.os.PowerManager$WakeLock, but got java.lang.Class<android.os.PowerManager$WakeLock>
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:130)
at com.is.vitllinkSOS.mod_functions._is_wakelock_set(mod_functions.java:432)
at com.is.vitllinkSOS.svc_gps._service_create(svc_gps.java:451)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at com.is.vitllinkSOS.svc_gps.onCreate(svc_gps.java:46)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2571)
at android.app.ActivityThread.access$1600(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1326)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:4977)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
java.lang.RuntimeException: Unable to create service com.is.vitllinkSOS.svc_gps: java.lang.RuntimeException: java.lang.IllegalArgumentException: expected receiver of type android.os.PowerManager$WakeLock, but got java.lang.Class<android.os.PowerManager$WakeLock>
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2593)
at android.app.ActivityThread.access$1600(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1326)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:4977)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: expected receiver of type android.os.PowerManager$WakeLock, but got java.lang.Class<android.os.PowerManager$WakeLock>
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at com.is.vitllinkSOS.svc_gps.onCreate(svc_gps.java:46)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2571)
... 10 more
Caused by: java.lang.IllegalArgumentException: expected receiver of type android.os.PowerManager$WakeLock, but got java.lang.Class<android.os.PowerManager$WakeLock>
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:130)
at com.is.vitllinkSOS.mod_functions._is_wakelock_set(mod_functions.java:432)
at com.is.vitllinkSOS.svc_gps._service_create(svc_gps.java:451)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
... 13 more