D 
		
				
			
		Deleted member 103
Guest
Hi,
what is the equivalente of SetAirplaneMode in B4i?
But as I have read, this function is not allowed by Apple, is it true?
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
			
			what is the equivalente of SetAirplaneMode in B4i?
But as I have read, this function is not allowed by Apple, is it true?
			
				B4X:
			
		
		
		Sub SetAirplaneMode(On As Boolean)
    Dim p As Phone
    If On = GetAirplaneMode Then Return 'already in the correct state
    Dim R As Reflector
    Dim contentResolver As Object
    R.Target = R.GetContext
    contentResolver = R.RunMethod("getContentResolver")
    Dim state As Int
    If On Then state = 1 Else state = 0
    R.RunStaticMethod("android.provider.Settings$System", "putInt", _
        Array As Object(contentResolver, "airplane_mode_on", state), _
        Array As String("android.content.ContentResolver", "java.lang.String", "java.lang.int"))
    Dim i As Intent
    i.Initialize("android.intent.action.AIRPLANE_MODE", "")
    i.PutExtra("state", "" & On)
    p.SendBroadcastIntent(i)
End Sub
Sub GetAirplaneMode As Boolean
    Dim p As Phone
    Return p.GetSettings("airplane_mode_on") = 1
End Sub 
				 
 
		 
 
		 
 
		 
 
		 
 
		