Android Question Calling an Intent with extra data

Discussion in 'Android Questions' started by ihatton, May 20, 2015.

  1. ihatton

    ihatton Member Licensed 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?
     
  2. ihatton

    ihatton Member Licensed 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)
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice