Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.
   Dim Broadcast As BroadCastReceiver
   Dim rv As RemoteViews
 
   ' // widget intent broadcasts, intents are strings :)
   Dim ACTION_SHOWCLOCK As String = "yourapp.action.SHOWCLOCK"
   Dim ACTION_SHOWSETTINGS As String = "widget.action.SHOWSETTINGS"
end sub
Sub Service_Create
  
   rv = ConfigureHomeWidget("widgetlayout","rv",0,"Widget Title",True)
   ' // initialise the lib
   Broadcast.Initialize("Broadcast")
   ' // add the intent  you want to listen for
   Broadcast.addAction(ACTION_SHOWCLOCK )
   ' // set the priority
   Broadcast.SetPriority(999)
   ' // register the intent with android
   Broadcast.registerReceiver(ACTION_SHOWCLOCK )
End Sub
Sub Service_Start (StartingIntent As Intent)
    
   If rv.HandleWidgetEvents(StartingIntent) Then
     Return
   End If
End Sub
Sub Service_Destroy
   Broadcast.unregisterReceiver
End Sub
Sub rv_RequestUpdate
   rv.UpdateWidget
End Sub
Sub rv_disabled
   StopService("")
End Sub
' // this is the client event of your image view control, the control is called 'ivSettings'
Sub ivSettings_Click
   
    ' // transmit "widget.action.SHOWSETTINGS"
    Broadcast.sendBroadcast(ACTION_SHOWSETTINGS)
End Sub
' // this will receive
Sub Broadcast_OnReceive (ACTION As String, i As Object)
   Dim In As Intent
  
   ' // get the intent data locally
   In = i
  
   Log("WIDGET " & In.ACTION & ", " & In.ExtrasToString )
    
 
   If ACTION = ACTION_SHOWCLOCK  Then
     ' // just checking for a key and it's value, you app will have set this
     If In.GetExtra("show_clock") = 1 Then
        'do show clock code
     End If
     If In.GetExtra("show_clock") = 0 Then
        'do hide clock code
     End If
   End If
  
   rv.UpdateWidget
End Sub