Android Question Check if smartphone/tablet has enabled security option

Magma

Expert
Licensed User
Longtime User
@Erel i am having problem when the device wake up and need slide or pin with my app (my app has service for gps + mariadb sql writing) - when the app wake up without pin and slide - works perfect.. but when need pin or slide going dead... :-(
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
with which error?
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
To be more specific... the problem is when having PIN screen type...

I can give you the activity resume and pause but no more (it 's a big project and for time i don't want to share it, understand me):

B4X:
Sub Activity_Pause (UserClosed As Boolean)

'If UserClosed=True Then
    showactiva=0
       
    If TTSON=True Then
    If TTS1.IsInitialized=True Then TTS1.Release
    End If
    If camEx.IsInitialized=True Then
        camEx.Release
    End If

        'audiorec.releaseRecorder
    If goon="1" Then

        timer2.Enabled=False
        timer3.Enabled=False
        timer4.Enabled=False
        rectimer.Enabled=False
        timerexit.Enabled=False
   
    End If
'End If
   
   
End Sub

Sub Activity_Resume
Log("realfirst:" & realfirst)
    If mustexit=1 Then
        ExitApplication
    End If
    If goon="1" Then
        showactiva=1
        If realfirst>0 Then
            If TTSON=True Then
                If TTS1.IsInitialized = False Then
                    TTS1.Initialize("TTS1")
                    'Sleep(1000)
                    'selecttts
                End If
            End If
            'If camEx.IsInitialized=False Then
           
                InitializeCamera
   

            timer2.Enabled=True
            timer3.Enabled=True
            timer4.Enabled=True
            Else
            startall
        End If
       
        Else
        StartActivity("check")
    End If
End Sub


The problem is only when i have pin lock type (slide works ok)

FROM Logs after pressing power-button to close screen and need to set pin after re-open - seems to resuming ???

lib:queryasync()~i:** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = false **
running waiting messages (1)
** Activity (main) Resume **
....here doing what doing when starting....
...here pressing button to open screen... but...

Reposting event: mysql_execresult
lib:queryasync()
main_timer3_tick (java line: 5778)
java.lang.NullPointerException: Attempt to invoke virtual method 'int anywheresoftware.b4a.objects.TabStripViewPager.getCurrentPage()' on a null object reference
at mvt.client.main._timer3_tick(main.java:5778)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5624)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
*** Service (starter) Create ***
** Service (starter) Start **
** Service (gpstrack) Create **
** Service (gpstrack) Start **

what happening.... as i said at slide works perfect... at pin... get the above... TABSTRIP error


Forgot tell you that using this code:

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

+If before pressing power button - press home to hide activity and go at home..after pressing power button will not get/take error...
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
Upvote 0
Top