Hi, I am attempting to intercept the Power Switch on a rooted device.
However, it is not seeing the switch "press".
My Code:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
and in the Manifest:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
			
			However, it is not seeing the switch "press".
My Code:
			
				B4X:
			
		
		
		Sub Activity_KeyPress(KeyCode As Int) As Boolean
'POWER OFF
    If KeyCode = KeyCodes.KEYCODE_POWER Then
        Dim result As Int
        result = Msgbox2("SWITCH OFF YOUR TABLET?", "eBuki Assistant", "SWITCH OFF", "NO", "",LoadBitmap (File.DirAssets, "eBuki-notification-logo.png"))
        If result = DialogResponse.Positive Then
            Log("Switch OFF")
            If TCPServer.Socket1.connected = True Then
                TCPServer.Socket1.Close
            End If
            Shutdown
        Else
            ' Selected CANCEL
        End If
   
    Else
    Return True
    End If
'    Return True
End Sub
			
				B4X:
			
		
		
		<uses-permission android:name="android.permission.PREVENT_POWER_KEY" /> 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		