Android Question Services and Toast message

Hi ,
I start a service with startserviceat that activate an alert message at a given time and set the next scheduled alert.
1. When the phone is not connected to the computer I dont get the alert message.
2. How can i have a message in the notification on the top of the phone.
The service doesn t run any activy just message and update list of
code:
Sub AlerterMessage
    Log("AlerterMessage")
    Dim lstDay, lsthour, lstminute,nowDay, nowHour, nowMinute  As Int
    
    nowDay = DateTime.GetDayOfWeek(DateTime.Now)
    nowHour = DateTime.GetHour(DateTime.Now)
    nowMinute = DateTime.GetMinute(DateTime.Now)
    
    For i = 0 To nextMessagesMapsList.Size - 1
        Log(i)
        
        Dim m As Map
        m.Initialize
        m = nextMessagesMapsList.Get(i)
        lstDay = m.Get("dayOfWeek")
        lsthour = m.Get("hours")
        lstminute = m.Get("minutes")
        Dim lstmessage As String = "m.Get(message) :" & m.Get("message")
        Log(lstDay & ":" & lstDay & ":" &lstDay & ":" & lstmessage)
        If (lstDay <> nowDay) Or (lsthour <> nowHour) Or (lstminute <> nowMinute) Then
            Log("return")
            Return
        End If
        Log(lstmessage)
        'PlayAlarm
        'Dim cs As CSBuilder
        'cs.Initialize.Bold.Size(20).Underline.Append(lstmessage).Pop
        'ToastMessageShow(cs, True)
        
        
        ShowCustomToast("lstmessage", True, Colors.Green)
        Sleep(3000)
        Dim cs As CSBuilder
        cs.Initialize.Color(Colors.Blue).Size(20).Append(lstmessage).PopAll
        ShowCustomToast(cs, True, Colors.Red)
    Next
End Sub


Sub ShowCustomToast(Text As Object, LongDuration As Boolean, BackgroundColor As Int)
    Dim ctxt As JavaObject
    ctxt.InitializeContext
    Dim duration As Int
    If LongDuration Then duration = 1 Else duration = 0
    Dim toast As JavaObject
    toast = toast.InitializeStatic("android.widget.Toast").RunMethod("makeText", Array(ctxt, Text, duration))
    Dim v As View = toast.RunMethod("getView", Null)
    Dim cd As ColorDrawable
    cd.Initialize(BackgroundColor, 20dip)
    v.Background = cd
    'uncomment to show toast in the center:
    '   toast.RunMethod("setGravity", Array( _
    '       Bit.Or(Gravity.CENTER_HORIZONTAL, Gravity.CENTER_VERTICAL), 0, 0))
    toast.RunMethod("show", Null)
End Sub
 
Top