Sub Process_Globals
Private Timer1 As Timer
Private joStarter As JavaObject
End Sub
Sub Service_Create
Dim cls As String = Me
cls = cls.SubString("class ".Length)
joStarter.InitializeNewInstance (cls, Null)
joStarter.GetField ("processBA")
Timer1.Initialize ("Timer1", 1000)
Timer1.Enabled = True
End Sub
Sub Service_Start (StartingIntent As Intent)
End Sub
Sub Service_TaskRemoved
'This event will be raised when the user removes the app from the recent apps list.
End Sub
'Return true to allow the OS default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Sub Service_Destroy
End Sub
Sub Timer1_Tick
If joStarter.RunMethod ("IsPhoneInCall", Null) Then
Log ("Red")
Else If joStarter.RunMethod ("IsRingtone", Null) Then
Log ("Yellow")
Else
Log ("Green")
End If
End Sub
#IF Java
import android.content.Context;
import android.media.AudioManager;
public boolean IsPhoneInCall ()
{
AudioManager manager = (AudioManager) processBA.context.getSystemService (Context.AUDIO_SERVICE);
if (manager.getMode () == AudioManager.MODE_IN_CALL) { return true; } else { return false; }
}
public boolean IsRingtone ()
{
AudioManager manager = (AudioManager) processBA.context.getSystemService (Context.AUDIO_SERVICE);
if (manager.getMode () == AudioManager.MODE_RINGTONE) { return true; } else { return false; }
}
#End If