6 Replies Latest reply on May 15, 2017 9:13 AM by Darryn Campbell

    Data Capture using Intent using Profile Manager

    App Developer

      Hi,

       

      I have been trying to follow the sample tutorial for data capture using intent. The intent action always comes as android.intent.action.MAIN. I do not get the RECVR intent  action in the method handleDecodeData. I am using EMDK 6.3 and the device used is TC56.

      Is there anything I could be missing here?

       

      Your help would be very much appreciated.

        • Re: Data Capture using Intent using Profile Manager
          Derek Warren

          Can you share your EMDKConfig.xml under /assets in your project?

           

          Make sure you're changing the delivery method of your intent profile to Broadcast Intent.Screen Shot 2017-05-12 at 1.17.02 PM.png

            • Re: Data Capture using Intent using Profile Manager
              App Developer

              I have added the EMDKConfig.xml and it is being moderated currently. Please find below the Java file being used. It is the similar to the sample.

               

              I would like to know when handleDecodeData should be called. It is called once at first when the activity is launched. However, it is not called again when I scan a barcode. So, I think when I scan a barcode, the new intent is not being triggered.

               

              package com.bozzutos.scanningtutorial;

               

              import android.app.Activity;

              import android.content.Intent;

              import android.support.v7.app.AppCompatActivity;

              import android.os.Bundle;

              import android.widget.TextView;

               

              import com.symbol.emdk.*;

              import com.symbol.emdk.EMDKManager.EMDKListener;

               

              public class MainActivity extends Activity implements EMDKListener{

               

                 //Assign the profile name used in EMDKConfig.xml
                 private String profileName = "DataCaptureProfile";

               

                 //Declare a variable to store ProfileManager object
                 private ProfileManager mProfileManager = null;

               

                 //Declare a variable to store EMDKManager object
                 private EMDKManager emdkManager = null;

               

                 //Declare a variable to store the textViewBarcode
                 private TextView textViewBarcode = null;

                 @Override
                 protected void onCreate(Bundle savedInstanceState) {

                 super.onCreate(savedInstanceState);

                setContentView(R.layout.activity_main);

               

                 //The EMDKManager object will be created and returned in the callback.
                 EMDKResults results = EMDKManager.getEMDKManager(getApplicationContext(), this);

               

                 //Get the textViewBarcode
                 textViewBarcode = (TextView) findViewById(R.id.textViewBarcode);

              //Check the return status of getEMDKManager
                 if(results.statusCode == EMDKResults.STATUS_CODE.FAILURE)

                {

                 //Failed to create EMDKManager object

                 }

               

                 //In case we have been launched by the DataWedge intent plug-in
                 Intent i = getIntent();

                handleDecodeData(i);

                }

                 //We need to handle any incoming intents, so let override the onNewIntent method
                 @Override
                 public void onNewIntent(Intent i) {

                System.out.println("on new intent...."+i.getAction());

                handleDecodeData(i);

               

                }

                 //This function is responsible for getting the data from the intent
                 private void handleDecodeData(Intent i)

                {

                System.out.println("----------------------------------------------------------------------------in handledecode data : "+i.getAction());

                 //Check the intent action is for us
                 if (i.getAction().contentEquals("com.bozzutos.scanningtutorial.RECVR") ) {

                 //Get the source of the data
                 String source = i.getStringExtra("com.motorolasolutions.emdk.datawedge.source");

               

              //Check if the data has come from the Barcode scanner
                 if(source.equalsIgnoreCase("scanner"))

                {

                 //Get the data from the intent
                 String data = i.getStringExtra("com.motorolasolutions.emdk.datawedge.data_string");

                System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");

                System.out.println("SCanned data : "+data);

              //Check that we have received data
                 if(data != null && data.length() > 0)

                {

                 //Display the data to the text view
                 textViewBarcode.setText("Data = " + data);

                }

                }

                }

                }

                 @Override
                 public void onClosed() {

                 // TODO Auto-generated method stub
                 }

                 @Override
                 public void onOpened(EMDKManager emdkManager) {

                 // TODO Auto-generated method stub
                 this.emdkManager = emdkManager;

              //Get the ProfileManager object to process the profiles
                 mProfileManager = (ProfileManager) emdkManager.getInstance(EMDKManager.FEATURE_TYPE.PROFILE);

                 if(mProfileManager != null)

                {

                 try{

               

                String[] modifyData = new String[1];

                EMDKResults results = mProfileManager.processProfile(profileName, ProfileManager.PROFILE_FLAG.SET, modifyData);

                 if(results.statusCode == EMDKResults.STATUS_CODE.FAILURE)

                {

                }

                }catch (Exception ex){

                ex.printStackTrace();

                 // Handle any exception
                 }

               

               

                }

                }

               

               

                 @Override
                 protected void onDestroy() {

                 // TODO Auto-generated method stub
                 super.onDestroy();

                 //Clean up the objects created by EMDK manager
                 emdkManager.release();

                }

              }

              • Re: Data Capture using Intent using Profile Manager
                App Developer

                Thank you for responding! Please find below the EMDKConfig.xml. The delivery method was previously 'Send via startActivity' as per demo. I changed it to BroadcastIntent. But that does not help either.

                 

                Also, is there anything required to be done with the default DataWedge profile that comes with the device or anything else at all with respect to data wedge?

                 

                <wap-provisioningdoc>

                  <characteristic type="ProfileInfo">

                  <parm name="created_wizard_version" value="6.3.1"/>

                  </characteristic>

                  <characteristic type="Profile">

                  <parm name="ProfileName" value="DataCaptureProfile"/>

                  <parm name="ModifiedDate" value="2017-05-12 13:49:55"/>

                  <parm name="TargetSystemVersion" value="4.2"/>

                 

                 

                  <characteristic type="ActivitySelection" version="0.1">

                  <parm name="emdk_name" value=""/>

                  </characteristic>

                  <characteristic type="Barcode" version="6.3">

                  <parm name="emdk_name" value=""/>

                  <parm name="scanner_input_enabled" value="true"/>

                  <parm name="ScannerSelection" value="INTERNAL_IMAGER1"/>

                  <parm name="trigger-wakeup" value="Default"/>

                  <characteristic type="Decoders">

                  <parm name="decoder_upca" value="Default"/>

                  <parm name="decoder_upce0" value="Default"/>

                  <parm name="decoder_ean13" value="Default"/>

                  <parm name="decoder_ean8" value="Default"/>

                  <parm name="decoder_code128" value="Default"/>

                  <parm name="decoder_code39" value="Default"/>

                  <parm name="decoder_i2of5" value="true"/>

                  <parm name="decoder_gs1_databar" value="Default"/>

                  <parm name="decoder_gs1_databar_lim" value="Default"/>

                  <parm name="decoder_gs1_databar_exp" value="Default"/>

                  <parm name="decoder_datamatrix" value="Default"/>

                  <parm name="decoder_qrcode" value="Default"/>

                  <parm name="decoder_pdf417" value="Default"/>

                  <parm name="decoder_composite_ab" value="Default"/>

                  <parm name="decoder_composite_c" value="Default"/>

                  <parm name="decoder_microqr" value="Default"/>

                  <parm name="decoder_aztec" value="Default"/>

                  <parm name="decoder_maxicode" value="Default"/>

                  <parm name="decoder_micropdf" value="Default"/>

                  <parm name="decoder_uspostnet" value="Default"/>

                  <parm name="decoder_usplanet" value="Default"/>

                  <parm name="decoder_uk_postal" value="Default"/>

                  <parm name="decoder_japanese_postal" value="Default"/>

                  <parm name="decoder_australian_postal" value="Default"/>

                  <parm name="decoder_canadian_postal" value="Default"/>

                  <parm name="decoder_dutch_postal" value="Default"/>

                  <parm name="decoder_us4state" value="Default"/>

                  <parm name="decoder_us4state_fics" value="Default"/>

                  <parm name="decoder_codabar" value="Default"/>

                  <parm name="decoder_msi" value="Default"/>

                  <parm name="decoder_code93" value="Default"/>

                  <parm name="decoder_trioptic39" value="Default"/>

                  <parm name="decoder_d2of5" value="Default"/>

                  <parm name="decoder_chinese_2of5" value="Default"/>

                  <parm name="decoder_korean_3of5" value="Default"/>

                  <parm name="decoder_code11" value="Default"/>

                  <parm name="decoder_tlc39" value="Default"/>

                  <parm name="decoder_mailmark" value="Default"/>

                  <parm name="decoder_hanxin" value="Default"/>

                  <parm name="decoder_signature" value="Default"/>

                  <parm name="decoder_webcode" value="Default"/>

                  <parm name="decoder_matrix_2of5" value="Default"/>

                  <parm name="decoder_upce1" value="Default"/>

                  </characteristic>

                  <characteristic type="DecoderParams">

                  <characteristic type="UPCA">

                  <parm name="decoder_upca_report_check_digit" value="Default"/>

                  <parm name="decoder_upca_preamble" value="Default"/>

                  </characteristic>

                  <characteristic type="UPCE0">

                  <parm name="decoder_upce0_report_check_digit" value="Default"/>

                  <parm name="decoder_upce0_preamble" value="Default"/>

                  <parm name="decoder_upce0_convert_to_upca" value="Default"/>

                  </characteristic>

                  <characteristic type="EAN8">

                  <parm name="decoder_ean8_convert_to_ean13" value="Default"/>

                  </characteristic>

                  <characteristic type="Code128">

                  <parm name="decoder_code128_length1" value="0"/>

                  <parm name="decoder_code128_length2" value="55"/>

                  <parm name="decoder_code128_redundancy" value="Default"/>

                  <parm name="decoder_code128_enable_plain" value="Default"/>

                  <parm name="decoder_code128_enable_ean128" value="Default"/>

                  <parm name="decoder_code128_enable_isbt128" value="Default"/>

                  <parm name="decoder_code128_isbt128_concat_mode" value="Default"/>

                  <parm name="decoder_code128_check_isbt_table" value="Default"/>

                  <parm name="decoder_code128_security_level" value="Default"/>

                  <parm name="code128_enable_marginless_decode" value="Default"/>

                  <parm name="code128_ignore_fnc4" value="Default"/>

                  </characteristic>

                  <characteristic type="Code39">

                  <parm name="decoder_code39_length1" value="0"/>

                  <parm name="decoder_code39_length2" value="55"/>

                  <parm name="decoder_code39_verify_check_digit" value="Default"/>

                  <parm name="decoder_code39_report_check_digit" value="Default"/>

                  <parm name="decoder_code39_full_ascii" value="Default"/>

                  <parm name="decoder_code39_redundancy" value="Default"/>

                  <parm name="decoder_code39_convert_to_code32" value="Default"/>

                  <parm name="decoder_code39_report_code32_prefix" value="Default"/>

                  <parm name="decoder_code39_security_level" value="Default"/>

                  <parm name="code39_enable_marginless_decode" value="Default"/>

                  </characteristic>

                  <characteristic type="Interleaved_2of5">

                  <parm name="decoder_i2of5_length1" value="14"/>

                  <parm name="decoder_i2of5_length2" value="10"/>

                  <parm name="decoder_i2of5_redundancy" value="Default"/>

                  <parm name="decoder_i2of5_check_digit" value="Default"/>

                  <parm name="decoder_i2of5_report_check_digit" value="Default"/>

                  <parm name="decoder_itf14_convert_to_ean13" value="Default"/>

                  <parm name="decoder_i2of5_security_level" value="Default"/>

                  <parm name="i20f5_enable_marginless_decode" value="Default"/>

                  </characteristic>

                  <characteristic type="GS1_Databar_Limited">

                  <parm name="decoder_gs1_lim_security_level" value="Default"/>

                  </characteristic>

                  <characteristic type="Composite_AB">

                  <parm name="decoder_composite_ab_ucc_link_mode" value="Default"/>

                  </characteristic>

                  <characteristic type="US_Postnet">

                  <parm name="decoder_uspostnet_report_check_digit" value="Default"/>

                  </characteristic>

                  <characteristic type="US_Planet">

                  <parm name="decoder_usplanet_report_check_digit" value="Default"/>

                  </characteristic>

                  <characteristic type="UK_Postal">

                  <parm name="decoder_uk_postal_report_check_digit" value="Default"/>

                  </characteristic>

                  <characteristic type="Codabar">

                  <parm name="decoder_codabar_length1" value="6"/>

                  <parm name="decoder_codabar_length2" value="55"/>

                  <parm name="decoder_codabar_redundancy" value="Default"/>

                  <parm name="decoder_codabar_clsi_editing" value="Default"/>

                  <parm name="decoder_codabar_notis_editing" value="Default"/>

                  </characteristic>

                  <characteristic type="MSI">

                  <parm name="decoder_msi_length1" value="4"/>

                  <parm name="decoder_msi_length2" value="55"/>

                  <parm name="decoder_msi_redundancy" value="Default"/>

                  <parm name="decoder_msi_check_digit" value="Default"/>

                  <parm name="decoder_msi_check_digit_scheme" value="Default"/>

                  <parm name="decoder_msi_report_check_digit" value="Default"/>

                  </characteristic>

                  <characteristic type="Code93">

                  <parm name="decoder_code93_length1" value="0"/>

                  <parm name="decoder_code93_length2" value="55"/>

                  <parm name="decoder_code93_redundancy" value="Default"/>

                  </characteristic>

                  <characteristic type="Trioptic_39">

                  <parm name="decoder_trioptic39_redundancy" value="Default"/>

                  </characteristic>

                  <characteristic type="Discrete_2of5">

                  <parm name="decoder_d2of5_length1" value="0"/>

                  <parm name="decoder_d2of5_length2" value="14"/>

                  <parm name="decoder_d2of5_redundancy" value="Default"/>

                  </characteristic>

                  <characteristic type="Code11">

                  <parm name="decoder_code11_length1" value="4"/>

                  <parm name="decoder_code11_length2" value="55"/>

                  <parm name="decoder_code11_redundancy" value="Default"/>

                  <parm name="decoder_code11_verify_check_digit" value="Default"/>

                  <parm name="decoder_code11_report_check_digit" value="Default"/>

                  </characteristic>

                  <characteristic type="Han_Xin">

                  <parm name="decoder_hanxin_inverse" value="Default"/>

                  </characteristic>

                  <characteristic type="Matrix_2of5">

                  <parm name="decoder_matrix_2of5_length1" value="10"/>

                  <parm name="decoder_matrix_2of5_length2" value="0"/>

                  <parm name="decoder_matrix_2of5_redundancy" value="Default"/>

                  <parm name="decoder_matrix_2of5_report_check_digit" value="Default"/>

                  <parm name="decoder_matrix_2of5_verify_check_digit" value="Default"/>

                  </characteristic>

                  <characteristic type="UPCE1">

                  <parm name="decoder_upce1_report_check_digit" value="Default"/>

                  <parm name="decoder_upce1_preamble" value="Default"/>

                  <parm name="decoder_upce1_convert_to_upca" value="Default"/>

                  </characteristic>

                  </characteristic>

                  <characteristic type="UpcEanParams">

                  <parm name="upcean_security_level" value="Default"/>

                  <parm name="upcean_supplemental2" value="Default"/>

                  <parm name="upcean_supplemental5" value="Default"/>

                  <parm name="upcean_supplemental_mode" value="Default"/>

                  <parm name="upcean_retry_count" value="10"/>

                  <parm name="upcean_random_weight_check_digit" value="Default"/>

                  <parm name="upcean_linear_decode" value="Default"/>

                  <parm name="upcean_bookland" value="Default"/>

                  <parm name="upcean_coupon" value="Default"/>

                  <parm name="upcean_coupon_report" value="Default"/>

                  <parm name="upcean_ean_zero_extend" value="Default"/>

                  <parm name="upcean_bookland_format" value="Default"/>

                  <parm name="databar_to_upc_ean" value="Default"/>

                  <parm name="upc_enable_marginless_decode" value="Default"/>

                  </characteristic>

                  <characteristic type="ReaderParams">

                  <parm name="aim_mode" value="Default"/>

                  <parm name="beam_timer" value="15000"/>

                  <parm name="Adaptive_Scanning" value="Default"/>

                  <parm name="Beam_Width" value="Default"/>

                  <parm name="power_mode" value="Default"/>

                  <parm name="mpd_mode" value="Default"/>

                  <parm name="reader_mode" value="Default"/>

                  <parm name="linear_security_level" value="Default"/>

                  <parm name="picklist" value="Default"/>

                  <parm name="aim_type" value="Default"/>

                  <parm name="aim_timer" value="500"/>

                  <parm name="same_barcode_timeout" value="500"/>

                  <parm name="different_barcode_timeout" value="500"/>

                  <parm name="illumination_mode" value="Default"/>

                  <parm name="lcd_mode" value="Default"/>

                  <parm name="low_power_timeout" value="250"/>

                  <parm name="delay_to_low_power_mode" value="Default"/>

                  <parm name="illumination_brightness" value="10"/>

                  <parm name="inverse_1d_mode" value="Default"/>

                  <parm name="viewfinder_size" value="100"/>

                  <parm name="viewfinder_posx" value="0"/>

                  <parm name="viewfinder_posy" value="0"/>

                  <parm name="1d_marginless_decode_effort_level" value="Default"/>

                  <parm name="poor_quality_bcdecode_effort_level" value="Default"/>

                  <parm name="charset_name" value="Default"/>

                  <parm name="viewfinder_mode" value="Default"/>

                  </characteristic>

                  <characteristic type="ScanParams">

                  <parm name="code_id_type" value="Default"/>

                  <parm name="volume_slider_type" value="Default"/>

                  <parm name="decode_audio_feedback_uri" value="/system/media/audio/notifications/optimized-beep.ogg"/>

                  <parm name="decode_haptic_feedback" value="Default"/>

                  <parm name="bt_disconnect_on_exit" value="Default"/>

                  <parm name="connection_idle_time" value="600"/>

                  <parm name="establish_connection_time" value="45"/>

                  <parm name="remote_scanner_audio_feedback_mode" value="Default"/>

                  <parm name="remote_scanner_led_feedback_mode" value="Default"/>

                  <parm name="display_bt_address_barcode" value="Default"/>

                  <parm name="good_decode_led_timer" value="75"/>

                  <parm name="decoding_led_feedback" value="Default"/>

                  </characteristic>

                  </characteristic>

                  <characteristic type="Intent" version="6.3">

                  <parm name="emdk_name" value=""/>

                  <parm name="intent_output_enabled" value="true"/>

                  <parm name="intent_action" value="com.bozzutos.scanningtutorial.RECVR"/>

                  <parm name="intent_category" value="android.intent.category.DEFAULT"/>

                  <parm name="intent_delivery" value="2"/>

                  <parm name="intent_flag_receiver_foreground" value="Default"/>

                  <characteristic type="BasicDataFormatting">

                  <parm name="bdf_enabled" value="true"/>

                  <parm name="bdf_prefix" value=""/>

                  <parm name="bdf_suffix" value=""/>

                  <parm name="bdf_send_data" value="true"/>

                  <parm name="bdf_send_hex" value="Default"/>

                  <parm name="bdf_send_tab" value="Default"/>

                  <parm name="bdf_send_enter" value="Default"/>

                  </characteristic>

                  </characteristic>

                  <characteristic type="Keystroke" version="6.3">

                  <parm name="emdk_name" value=""/>

                  <parm name="ime_output_enabled" value="true"/>

                  <parm name="keystroke_action_char" value="Default"/>

                  <parm name="keystroke_delay_extended_ascii" value="0"/>

                  <parm name="keystroke_delay_control_chars" value="0"/>

                  <characteristic type="BasicDataFormatting">

                  <parm name="bdf_enabled" value="Default"/>

                  <parm name="bdf_prefix" value=""/>

                  <parm name="bdf_suffix" value=""/>

                  <parm name="bdf_send_data" value="true"/>

                  <parm name="bdf_send_hex" value="Default"/>

                  <parm name="bdf_send_tab" value="Default"/>

                  <parm name="bdf_send_enter" value="Default"/>

                  </characteristic>

                  </characteristic>

                  </characteristic>

                </wap-provisioningdoc>