I have a problem with unlock screen rutine

psdos

Active Member
Licensed User
Longtime User
I use in my program this rutine for lock and unlock screen, and it not go in my new Galaxy Note 2 with android 4.1.1

B4X:
Sub SetShowWhenLocked
    Dim r As Reflector
    r.Target = r.GetActivity
    r.Target = r.RunMethod("getWindow")
    r.RunMethod2("addFlags", 6815872, "java.lang.int")
End Sub

I use for unlock screen

B4X:
r.RunMethod2("addFlags", 6815872, "java.lang.int")

and for lock screen

B4X:
r.RunMethod2("clearFlags", 6815872, "java.lang.int")
 

psdos

Active Member
Licensed User
Longtime User
Yes, i think that there is some change in android 4.1.1 or is a problem only of Galaxy Note 2... if anyone can probe this method in other device with 4.1.1... or if anyone know other method for unlock screen.

Thanks.

SOLVED:

In my application i use this code

B4X:
Sub Activity_Resume 'Ejecuta esta rutina cuando despertamos el equipo.
    If CheckBox2.Checked = True Then
      ShowWhenLocked("addFlags") 'Una vez que logramos activar la pantalla, esta rutina muestra lo que hay debajo de la pantalla de bloqueo, o sea nuestro programa.
      Timer2.Initialize("Timer2", 10000)'Tras estos 10 seg se permite que el equipo se ponga en reposo de nuevo.
       Timer2.Enabled = True   
   End If
End Sub

I dont know whats happens that now when i do ShowWhenLocked("addFlags") launch event Activity_Pause and after Activity_Resume, so i add this code to my program

B4X:
Sub Activity_Pause (UserClosed As Boolean) 'Ejecuta esta rutina justo antes de abandonar el programa.
   If CheckBox2.Checked = True Then ShowWhenLocked("addFlags")
   TTS1.Release
   Awake.ReleaseKeepAlive
End Sub

With this add code now my device wakeup perfect for me.
 
Last edited:
Upvote 0
Top