Android Question Calling an Intent with extra data

ihatton

Member
Licensed User
Longtime User
Hi,

I need to make an Intent call which in Java is described as follows:

Function Prototype:

Intent i = new Intent();
i.setAction(ACTION);
i.putExtra(EXTRA_DATA, “<parameter>”);

Parameters

ACTION: String “com.motorolasolutions.emdk.datawedge.api.ACTION_
SOFTSCANTRIGGER”

EXTRA_DATA: String “com.motorolasolutions.emdk.datawedge.api.EXTRA_
PARAMETER”
<parameter>: The parameter as a string, either of the following;
“START_SCANNING” – to start scanning
“STOP_SCANNING” – to stop scanning
“TOGGLE_SCANNING” – to toggle between start scanning and
stop scanning

My B4A code to make the above call is :

Dim i As Intent
i.Initialize("com.motorolasolutions.emdk.datawedge.api.ACTION_SOFTSCANTRIGGER","")
i.PutExtra("START_SCANNING","com.motorolasolutions.emdk.datawedge.api.EXTRA_PARAMETER")

When I run this on the target device , I get an error message 'no activity found to handle intent'. Any ideas as to what is wrong with my code above i.e. is there anything obviously in the wrong place or missing?
 

ihatton

Member
Licensed User
Longtime User
Just got it working after some digging around in other posts - the correct code is as follows (clue was in the error message!):

Dim i As Intent
Dim ph As Phone

i.Initialize("com.motorolasolutions.emdk.datawedge.api.ACTION_SOFTSCANTRIGGER","")

i.PutExtra("com.motorolasolutions.emdk.datawedge.api.EXTRA_PARAMETER","TOGGLE_SCANNING")

ph.SendBroadcastIntent(i)
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…