ZBAR (you need to have library RuntimePermission enabled):Probably not, I´m using the original version of the apps in the forums.
Until this last updates worked fine...
#Region Project Attributes
#ApplicationLabel: ZbarBarcodeScanner
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: landscape
#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 rp As RuntimePermissions
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.
Private zb1 As ZbarBarcodeScanner
Private b1 As Button
Private b2 As Button
Private b3 As Button
Private l1 As Label
Dim frontCamId As Int
Dim backCamId As Int
Dim cnt As Int = 0
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("main")
Dim Result As Boolean = True
If Not(rp.Check(rp.PERMISSION_CAMERA)) Then
rp.CheckAndRequest(rp.PERMISSION_CAMERA)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
End If
If Result Then
zb1.LaserColor = Colors.Yellow
zb1.MaskColor = Colors.ARGB(150, 0, 0, 200)
zb1.BorderColor = Colors.Magenta
zb1.BorderStrokeWidth = 5
zb1.BorderLineLength = 40
zb1.Visible = True
zb1.ScanDelay = 200
frontCamId = zb1.FrontFacingCamera
Log("frontCamId = " & frontCamId)
backCamId = zb1.BackFacingCamera
Log("backCamId = " & backCamId)
Else
ToastMessageShow("Permission not granted", True)
Return
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
zb1.Visible = False
zb1.stopScanner
End Sub
Sub b1_Click
zb1.toggleFlash
End Sub
Sub b2_Click
zb1.Visible = True
Log("trying to start scanner")
zb1.startScanner(0)
End Sub
Sub b3_Click
zb1.Visible = False
zb1.stopScanner
End Sub
Sub zb1_scan_result(scantext As String, scanformat As String)
cnt = cnt + 1
Log("B4A scantext = " & scantext)
Log("B4A scanformat = " & scanformat)
l1.Text = scantext & " : " & cnt
End Sub
AddManifestText(
<uses-sdk android:minSdkVersion="17" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
'AddManifestText(<uses-feature android:name="android.hardware.telephony" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera.flash" android:required="false" />)
'AddPermission("android.permission.ACCESS_COARSE_LOCATION")
'AddPermission("android.permission.INTERNET")
'AddPermission("android.permission.ACCESS_FINE_LOCATION")
'AddPermission("android.permission.WAKE_LOCK")
'AddPermission("android.permission.DEVICE_POWER")
'AddPermission("android.permission.ACCESS_COARSE_UPDATES")
'AddPermission("android.permission.READ_PHONE_STATE")
'AddPermission("android.permission.VIBRATE")
AddPermission("android.permission.CAMERA")
AddPermission("android.permission.FLASHLIGHT")
'AddPermission("android.hardware.camera")
'AddPermission("android.permission.INTERACT_ACROSS_USERS_FULL")
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
#Region Project Attributes
#ApplicationLabel: ZxingBarcodeScanner
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: landscape
#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.
Private nativeMe As JavaObject
Dim rp As RuntimePermissions
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.
Private zx1 As ZxingBarcodeScanner
Private b1 As Button
Private b2 As Button
Private b3 As Button
Private l1 As Label
Dim flag As Int = 0
Dim runningavg As Int = 127
Private l2 As Label
Private l3 As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("main")
Dim Result As Boolean = True
If Not(rp.Check(rp.PERMISSION_CAMERA)) Then
rp.CheckAndRequest(rp.PERMISSION_CAMERA)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
End If
If Result Then
nativeMe.InitializeContext
l3.Text = ""
zx1.LaserColor = Colors.Yellow
zx1.MaskColor = Colors.ARGB(150, 0, 0, 200)
zx1.BorderColor = Colors.Magenta
zx1.BorderStrokeWidth = 5
zx1.BorderLineLength = 40
zx1.AutoFocusInterval = 500
zx1.AutoFocus = True
zx1.FocusMode = zx1.FOCUS_MODE_AUTO
zx1.Visible = False
Else
ToastMessageShow("Permission not granted", True)
Return
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
zx1.Visible = False
zx1.stopScanner
End Sub
Sub b1_Click
zx1.toggleFlash
End Sub
Sub b2_Click
zx1.Visible = True
zx1.startScanner
zx1.TurnFlashOn
Log(zx1.isFlashOn)
End Sub
Sub b3_Click
zx1.Visible = False
zx1.stopScanner
l1.Text = ""
l2.Text = ""
End Sub
Sub zx1_scan_result (scantext As String, scanformat As String)
nativeMe.RunMethod("playTone", Null)
Dim tim As Long = 100
nativeMe.RunMethod("vibrateOnce", Array(tim))
Log ("B4A scan text = " & scantext)
Log ("B4A scan format = " & scanformat)
Log("isFlashOn = " & zx1.isFlashOn)
l2.Text = scantext & " (type = " & scanformat & ")"
End Sub
Sub zx1_brightness_changed (bright As Int ) 'ADDED 6 MARCH 2016
' Log("bright = " & bright) 'this is the average brightness of the frame that was captured for possible barcode extraction
flag = flag + 1
l1.Text = "Brigtness = " & bright
If flag = 30 Then 'I only want to use the average brightness of every 30th frame to calculate a running brigtness average
flag = 0 'reset the count to zero for the next 30 frames
If bright < 150 Then 'discard excessive high brigness values
runningavg = (runningavg + bright) / 2
' Log("runningavg brightness = " & runningavg)
If runningavg < 70 Then
If Not(zx1.isFlashOn) Then zx1.TurnFlashOn
Else if runningavg > 115 Then
If zx1.isFlashOn Then zx1.TurnFlashOff
End If
End If
End If
l3.Text = "isFlashOn = " & zx1.isFlashOn
End Sub
#If Java
import android.os.Vibrator;
import android.content.Context;
import android.media.ToneGenerator;
import android.media.AudioManager;
/**
*Vibrate with a given pattern.
*Pass in an array of Longs that are the durations for which to turn on or off the vibrator in milliseconds.
*The first value indicates the number of milliseconds to wait before turning the vibrator on. The next
*value indicates the number of milliseconds for which to keep the vibrator on before turning it off.
*Subsequent values alternate between durations in milliseconds to turn the vibrator off or to turn the vibrator on.
*Parameters:
*pattern ---> an array of longs of times for which to turn the vibrator on or off.
*repeat ---> the index into pattern at which to repeat, or -1 if you don't want to repeat.
*
*You need to add the following to the manifest file of the B4A project:
*AddPermission("android.permission.VIBRATE")
*/
public void vibratePattern(long[] pattern, int repeat) {
Vibrator v = (Vibrator) BA.applicationContext.getSystemService(Context.VIBRATOR_SERVICE);
if (v.hasVibrator()) {
v.vibrate(pattern, repeat);
}
}
/**
*Cancel vibration (in case of method vibratePattern being active)
*You need to add the following to the manifest file of the B4A project:
*AddPermission("android.permission.VIBRATE")
*
*/
public void vibrateCancel(int dummy) {
Vibrator v = (Vibrator) BA.applicationContext.getSystemService(Context.VIBRATOR_SERVICE);
if (v.hasVibrator()) {
v.cancel();
}
}
/**
*Vibrate continuously for the specified number of milliseconds
*You need to add the following to the manifest file of the B4A project:
*AddPermission("android.permission.VIBRATE")
*/
public void vibrateOnce(long duration) {
Vibrator v = (Vibrator) BA.applicationContext.getSystemService(Context.VIBRATOR_SERVICE);
if (v.hasVibrator()) {
v.vibrate(duration);
}
}
public void playTone() {
final ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100);
tg.startTone(ToneGenerator.TONE_PROP_BEEP);
}
#End If
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
AddManifestText(<uses-feature android:name="android.hardware.telephony" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera.flash" android:required="false" />)
'AddPermission("android.permission.ACCESS_COARSE_LOCATION")
AddPermission("android.permission.INTERNET")
AddPermission("android.permission.ACCESS_FINE_LOCATION")
AddPermission("android.permission.WAKE_LOCK")
AddPermission("android.permission.DEVICE_POWER")
'AddPermission("android.permission.ACCESS_COARSE_UPDATES")
AddPermission("android.permission.READ_PHONE_STATE")
AddPermission("android.permission.VIBRATE")
'AddPermission("android.permission.CAMERA")
'AddPermission("android.permission.FLASHLIGHT")
'AddPermission("android.hardware.camera")
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
If a app crashes then there is ALWAYS something in the LOG. Maybe the unfiltered, but NEVER nothing. There is no crash in Android without anything in the LOG.ZBAR or ZXING stopped to work after Android 10 updates...
No messages, just don´t open the camera in any mode, Debug or Release.
Help please