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!
Public Ph As Phone
Sub SilenziaTelefono
Try
Ph.SetRingerMode(Ph.RINGER_SILENT)
Catch
Log(LastException)
End Try
End Sub
Sub RipristinaSuoneria(Modo As Int)
Try
Ph.SetRingerMode(Modo)
Catch
Log(LastException)
End Try
End Sub
Yes, this code works very well, I use it in an app, no problem
I'm wondering if in this case I should follow the AI hints because some "far east manufacturer" (as the AI wrote) makes it more difficult than usual or if such hints are just (one of many) "AI fake hints" (as I supppose).
I'm wondering if in this case I should follow the AI hints because some "far east manufacturer" (as the AI wrote) makes it more difficult than usual or if such hints are just (one of many) "AI fake hints" (as I supppose).