#Region Service Attributes
#StartAtBoot: true
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all module
Dim RV As RemoteViews
Dim PhneEvents As PhoneEvents
End Sub
Sub Globals
Dim BatLvl As Int
Dim lblLvl As Label
Dim imgLvl As ImageView
imgLvl.Initialize("")
lblLvl.Initialize ("")
Dim pnlwidget As Panel
pnlwidget.Initialize ("")
imgLvl.Bitmap = LoadBitmap(File.DirAssets, "geekbatloadbg.gif")
End Sub
Sub Service_Create
RV = ConfigureHomeWidget("l1","RV",5,"geekBat",True)
End Sub
Sub Service_Start (StartingIntent As Intent)
If RV.HandleWidgetEvents(StartingIntent) Then Return
PhneEvents.Initialize("phneevents")
End Sub
Sub Service_Destroy
End Sub
Sub rv_RequestUpdate
'PhneEvnts_BatteryChanged
RV.UpdateWidget
End Sub
Sub rv_Disabled
StopService("")
End Sub
Sub PhneEvnts_BatteryChanged (Level As Int, Scale As Int, Plugged As Boolean, Intent As Intent)
Dim BatLvl As Int
Dim lblLvl As Label
Dim imgLvl As ImageView
lblLvl.Initialize ("")
BatLvl = Level
lblLvl.Text = Level
imgLvl.Initialize ("")
If Plugged = True Then
imgLvl.Bitmap = LoadBitmap(File.DirAssets,"geekbatblubg.gif")
Else
If BatLvl >50 Then
imgLvl.Bitmap = LoadBitmap(File.DirAssets,"geekbatbatlvlgrn.gif")
Else If BatLvl > 25 Then
imgLvl.Bitmap = LoadBitmap(File.DirAssets,"geekbatbatlvlylo.gif")
Else If BatLvl > 15 Then
imgLvl.Bitmap = LoadBitmap(File.DirAssets,"geekbatbatlvlorg.gif")
Else If BatLvl > 0 Then
imgLvl.Bitmap = LoadBitmap(File.DirAssets,"geekbatbatlvlred.gif")
Else
'Do Nothing
End If
End If
End Sub