Android Question Intent problem with bar code scanner - solved

Mr_fifty4

Member
Licensed User
Hi all,

i'm writing my first app that run in android bar code scanner (DataLogic DL-Axist) with android 4.4.4.
For test i use intent wedge available in this scanner with this code:

(MAIN)

#Region Project Attributes
#ApplicationLabel: Scantest
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False
#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 ScanTxt As String
Dim Timer1 As Timer


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.

Dim ScanLabel As Label

End Sub

Sub Activity_Create(FirstTime As Boolean)

Timer1.Initialize("Timer1", 100)
Timer1.Enabled= True

Activity.LoadLayout("Main")

End Sub

Sub Activity_Resume

End Sub


Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Timer1_Tick
ScanLabel.Text=ScanTxt

End Sub


(In service module: WedgeService)

#Region Service Attributes
#StartAtBoot: False
#End Region

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

End Sub
Sub Service_Create

End Sub

Sub Service_Start (StartingIntent As Intent)

If StartingIntent.Action ="com.datalogic.decodewedge.decode_action" Then

Log("Extra :"& StartingIntent.GetExtra("com.datalogic.decode.intentwedge.barcode_string"))

Main.ScanTxt=StartingIntent.GetExtra("com.datalogic.decode.intentwedge.barcode_string")

End If

End Sub

Sub Service_Destroy

End Sub


(MANIFEST EDITOR)

'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")

AddReceiverText(WedgeService, <intent-filter>
<action android:name="com.datalogic.decodewedge.decode_action" />
<category android:name="com.datalogic.decodewedge.decode_category" />
<extra android:name="com.datalogic.decodewedge.intentwedge.barcode_string" />
</intent-filter>)


The code run correctly for first scan and for all scans but only if wait about 10..15 seconds between 2 scans.
if scans are fast (every 2..3 seconds) the intent service "store" all scans that appear together in logs view after 10..15 seconds.

I test code in debug mode and also in release mode with BA7.30.
I notice that sometimes on app appear a toast message "Waiting for IDE debugger to connect" but i had compiled in release mode for sure.
I try to unintall app and install again from APK deleting cache and data with no results.

Any suggestion about this strange topic?

thanks
 

Mr_fifty4

Member
Licensed User
Erel,
i apoligeze for this.

About the topic: i notice that every time coming data from intent service a toast message appears for 2 seconds "Waiting for IDE debugger to connect"
This happens always :
B4ABridge (v2.31) running on device or not (app in release mode)
IDE open (connect with bridge) or close
compile in debug mode or release mode.
I also commented log code line in wedgeservice but the same, never change.
i don't know if there is a relation from this effect and delay from scan data..
This test program is really simple and i have no idea where looking for (i'm also at first steps with B4A)

Could be a problem with my B4A installation?
I start with version 7.0, 7.01, 7.30beta, 7.30 (last official) running on Win7-32 virtualized with VMWARE

If i use the scanner in wedge keyboard emulation (on edittext with focus) every scans are well received (this was at beginning test) but this mode is not suitable for my application.

any help will be appreciated.

thanks
 
Upvote 0

Mr_fifty4

Member
Licensed User
Solved !

In target device i had 2 apps installed with the same intent reference (even if only one app was in run at time).
With only one app installed this run perfectly without scan delay and toast message.

Good to know. I still have many things to learn...

Thanks Erel.
 
Upvote 0
Top