Sub Globals
Dim OP As OverlayPermission '---> permiso para Aparecer encima
End Sub
Sub Activity_Create(FirstTime As Boolean)
If OP.RequestPermission("OP") Then
'A permission to draw overlays over applications is required
Wait For OP_DrawPermission(Allowed As Boolean) '-----> Verás que te lleva directamente a la página para aceptar el permiso, si no sobreescribes la app
' tras haberlo aceptado anteriormente
End If
If OP.IsAllowed Then
Dim Button1 As Button
Button1.Initialize("Button1")
Button1.Text = "Start Activity 2"
Activity.AddView(Button1, 20dip, 100dip, 220dip, 48dip)
End If
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
If KeyCode = KeyCodes.KEYCODE_BACK Then 'In case you pull back that the app does not close and follow the counter after clicking the button
tmrActSome1.Enabled = False
StopService(svcProgrOvl)
Return True
End If
Return False
End Sub
Sub Button1_Click
Log("Button1_Click")
tmrActSome1.Initialize("tmrActSome1", 2000) ' Simulates some timeconsuming actions
tmrActSome1.Enabled = True
svcProgrOvl.lngCount = 0
CallSubDelayed(svcProgrOvl, "ShowWindow")
End Sub