Android Question RingerMode and AI hint code

Elric

Well-Known Member
Licensed User
Hello everyone!

I've asked a couple of thing to Gemini 3.0 and it suggest to change this code:
B4X:
    'RINGER_SILENT = 0
    'RINGER_VIBRATE = 1
    'RINGER_NORMAL = 2 Audible & Vibrate
    dim mPhone as Phone
    mPhone.SetRingerMode(mPhone.RINGER_SILENT)
in this code
B4X:
    Try
        Dim myjoContext As JavaObject
        myjoContext.InitializeContext
        
        Dim myjoAudio As JavaObject = myjoContext.RunMethod("getSystemService", Array("audio"))
        
        ' 0 = RINGER_SILENT
        myjoAudio.RunMethod("setRingerMode", Array(0)) ' or Array(1) for RINGER_VIBRATE or Array (2) for RINGER__NORMAL
        
    Catch
        LastException.Message
    End Try
because it is renow by every or almost every phone.

I've tried AI and sometimes give good hints some other it is a terrible coding assistant!

Should I follow this hint? What do you think?

Thanks!
 
Top