Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Region Project Attributes
- #ApplicationLabel: B4A Example
- #VersionCode: 1
- #VersionName:
- 'SupportedOrientations possible values: unspecified, landscape or portrait.
- #SupportedOrientations: unspecified
- #CanInstallToExternalStorage: False
- #BridgeLogger: True
- #End Region
- #Region Activity Attributes
- #FullScreen: False
- #IncludeTitle: True
- #End Region
- 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
- End Sub
- Sub Globals
- 'These global variables will be redeclared each time the activity is created.
- 'These variables can only be accessed from this module.
- Private SeekBar1 As SeekBar
- Private seek_label As Label
- End Sub
- Sub BroadcastReceiver_OnReceive (Action As String, i As Object) 'https://www.b4x.com/android/forum/threads/broadcastreceiver.12493/
- Dim retIn As Intent
- retIn = i
- Msgbox("Received value from Automagic" & retIn.ExtrasToString,"")
- Log(retIn.ExtrasToString)
- End Sub
- Sub Activity_Create(FirstTime As Boolean)
- 'Do not forget to load the layout file created with the visual designer. For example:
- 'Activity.LoadLayout("Layout1")
- 'Msgbox("Welcome to B4A!", "")
- BroadCast.Initialize("BroadcastReceiver")
- Activity.LoadLayout("b4a_am4a_v1")
- seek_label.Text = SeekBar1.Value
- Log("Started...")
- BroadCast.addAction("b4a.action.1")
- BroadCast.SetPriority(999)
- BroadCast.registerReceiver("")
- End Sub
- Sub lvgrm_OFF_Click
- Dim i As Intent
- i.Initialize("automagic.Turn_OFF_lv_light","")
- i.SetComponent("ch.gridvision.ppam.androidautomagic") ',"ch.gridvision.ppam.androidautomagic")
- Dim p As Phone
- p.SendBroadcastIntent(i)
- Msgbox("Sent OFF!", "")
- End Sub
- Sub lvgrm_ON_Click
- Dim i As Intent
- i.Initialize("automagic.Turn_ON_lv_light","")
- i.SetComponent("ch.gridvision.ppam.androidautomagic") ',"ch.gridvision.ppam.androidautomagic")
- Dim p As Phone
- p.SendBroadcastIntent(i)
- Msgbox("Sent ON!", "")
- End Sub
- Sub SeekBar1_ValueChanged (Value As Int, UserChanged As Boolean)
- seek_label.Text = Value
- End Sub
- Sub sendAM_Click
- Dim i As Intent
- Dim s As String
- i.Initialize("automagic.b4a_test","")
- i.SetComponent("ch.gridvision.ppam.androidautomagic") ',"ch.gridvision.ppam.androidautomagic")
- s = SeekBar1.Value
- i.PutExtra("param1",s)
- Dim p As Phone
- p.SendBroadcastIntent(i)
- 'Msgbox("Sent to Automagic!", "")
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment