Android Question [HALTED]Broadcast intent

Martincg

Member
Licensed User
Longtime User
I want to switch something ON or OFF by sending an intent to an application. The information given for intents like this is
---------------------------------------------------
OFF:'abc.android.Appname.TurnOff'

Extras
UDN:'SwichDevice_Sk1'
--------------------------------------------------

Amingst other things I tried this
B4X:
Dim Intent1 As Intent
   Intent1.Initialize(Intent1.ACTION_MAIN, "")
   Intent1.SetComponent("abc.android.Appname.TurnOff")
   Intent1.PutExtra("UDN","SwichDevice_Sk1")
   StartActivity(Intent1)
but it had no effect.
There is also information on broadcast intents, such as

ON:'abc.android.Appname.OFF.SwichDevice_Sk1'

I have also tried this using the broadcast-reciever library but not suceeded here either.

Can someone tell me where I can find information which explains how to use intents in B4A? It might be that I am not understanding the instructions the app gives.
 

DonManfred

Expert
Licensed User
Longtime User
It might be that I am not understanding the instructions the app gives.
Which app you are talking about?

Post the documentation you are talking about.

I have also tried this using the broadcast-reciever library but not suceeded here either.
The BCR Lib does not help you sending an Intent. It is to receive/listento Intents.
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
Try this:

B4X:
Dim Context As JavaObject
Context.InitializeContext

Dim Intent1 As Intent
Intent1.Initialize(Intent1.ACTION_MAIN, "")
Intent1.SetComponent("abc.android.Appname.TurnOff")
Intent1.PutExtra("UDN","SwichDevice_Sk1")
StartActivity(Intent1)

Context.RunMethod("sendBroadcast", Array As Object(Intent1))
 
Upvote 0
Top