0

I am working on application in which I need to integrate socket mobile sdk of bluetooth scanner.They have provided sample code but it's not working when i started pairing a device.How to run that code?

enter image description here enter image description here enter image description here enter image description here

These are the steps that SingleEntry App have.

Ashok Kateshiya
  • 659
  • 4
  • 10

2 Answers2

1

You have not configured your device correctly. To configure it correctly you need to do following:-

  1. Unpair the SocketMobile from bluetooth setting screen and Switch of the device bluetooth.
  2. Factory Reset the Socket mobile by scanning bar code for factory reset (In booklet).
  3. Switch On the Socket mobile.
  4. Scan SPP Mode Bar code (Defined in booklet).
  5. Switch on Bluetooth and search for the Socket Mobile.
  6. Pair with socket mobile.
  7. Open the android application and select "Pair Scanner".
  8. Selects your socket mobile and pair it.
  9. After connected Socket mobile will beap and connected.

If your problem solves dont forget to Upvote. If you face any problem then free to ask with comment.

To resolve -27 you need to include ZXing library in the android application and following code should be used in the AndroidManifest File

 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.sample.scanqrcode"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="21" />

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.FLASHLIGHT" />
    <uses-permission android:name="android.permission.BLUETOOTH"/>
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <application
        android:allowBackup="true"
        android:name="com.sample.scanqrcode.ScanQRCodeApplication"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >


        <activity
            android:name="com.SocketMobile.ScanAPI.SoftScanActivity"
            android:configChanges="keyboardHidden|orientation"
            android:screenOrientation="landscape"
            android:theme="@android:style/Theme.NoTitleBar" />

        <activity
            android:name="com.sample.scanqrcode.HomeActivity"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.google.zxing.client.android.CaptureActivity"
            android:configChanges="orientation|keyboardHidden"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
            android:windowSoftInputMode="stateAlwaysHidden" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <intent-filter>
                <action android:name="com.google.zxing.client.android.SCAN" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity android:name="com.sample.scanqrcode.EzPairActivity"></activity>
    </application>

</manifest>
Amit Thaper
  • 2,117
  • 4
  • 26
  • 49
  • 2
    If your Scanner is connected with other mobile devices then also -27 will occur – Amit Thaper Jan 07 '15 at 12:25
  • Yes, Its required and it is mentioned in the ScanApi Sdk document – Amit Thaper Jan 07 '15 at 12:33
  • Are you using camera for scanning barcodes? or socket mobile device because from your manifest Main activity is capture activity aof zxing library. can you please share your sample app code? – Ashok Kateshiya Jan 07 '15 at 12:38
  • I also faced the same issue before. After i add ZXing library and Update SocketScanner to SPP mode its resolved. May be your scanner is in HID mode not in SPP Mode. When you scan SPP bar code then one beep will sound. – Amit Thaper Jan 07 '15 at 12:46
  • When I scan barcode I can hear only one beep.I am not able to figure out what is the problem.Can u share your code on github or mediafire? – Ashok Kateshiya Jan 07 '15 at 12:54
  • Sorry i cant share my code because of security reason. Please send your code i will update it and send it you – Amit Thaper Jan 07 '15 at 12:59
  • Please find code on http://www.mediafire.com/download/o12num6izk9vwl0/SingleEntry.zip – Ashok Kateshiya Jan 08 '15 at 04:20
  • No.I have uploaded SingleEntry sample app code please check and update it if needed.I am not able to pair bluetooth scanner with this code.Thanks. – Ashok Kateshiya Jan 08 '15 at 06:07
  • Brother, Its working fine in my side. Please clarify one thing when you do scan bar code its enter in any edit text field. Will Keyboard open at that time? – Amit Thaper Jan 08 '15 at 10:23
  • From above code I am not able to pair bluetooth scanner with my android device.When I run EzPair it gives me error "ScanAPI is reporting an error: -27" and then error ":-47".When I check Input device option from bluetooth settings I am able to scan and see it's output in any edittext.It is not opening keyboard. – Ashok Kateshiya Jan 08 '15 at 10:46
  • Now get the issue. If Soft keyboard not open then Scanner is in HID mode and application will show -27 (Port not open). If scanner is in SPP mode then keyboard opens while selecting edit text and user can edit the value. Please unpair your socket mobile from mobile devices and do factory reset then scan bar code for SPP mode. – Amit Thaper Jan 08 '15 at 11:02
  • Select project->right click->properties->Android->Select android of version 8 – Amit Thaper Jan 08 '15 at 13:01
  • selecting android version to 8 is also didn't worked. – Ashok Kateshiya Jan 09 '15 at 04:43
  • What is the max android version you installed in SDK. Have you got any compile error or same -27 error – Amit Thaper Jan 09 '15 at 04:48
  • Hi, I am working on POS application so when product is scanned by using socket mobile barcode scanner I want to add it to the list of items on screen.How to use barcode scanner in this application as I have read user guide it is written that SPP mode is recommended mode.Would you please guide me how to achieve this? – Ashok Kateshiya Jan 09 '15 at 04:54
  • 1
    I told you already please scan the barcode of SPP mode on page 3 of http://www.socketmobile.com/pdf/data-collection/command-barcodes-sheet-7c.pdf I told you before your scanner should be in SPP mode. To verify when you scan any bar code then keyboard will be open for editing. – Amit Thaper Jan 09 '15 at 04:58
  • Can u show me how to pair device using single entry application? – Ashok Kateshiya Jan 09 '15 at 05:07
  • On click of paired to scanner and select paired scanner and select pair. Yes just like you say – Amit Thaper Jan 09 '15 at 05:10
  • I have added screenshots with question when I try to pair device. – Ashok Kateshiya Jan 09 '15 at 05:13
  • thanks for your help I am able to scan in spp mode.I have installed socket scan application from play store and configure device by scanning barcode from mobile screen. – Ashok Kateshiya Jan 09 '15 at 06:26
0

@user2455320, I am sorry to see you were having issues using the ScanAPI SDK, I hope your issues have been resolved. If not, post further here on StackOverflow, or contact us directly.

Please note that our SDK is only obtainable for registered developers, so it would be best if you did not post the libraries files from the SDK in a public forum. You are more than welcome to post your code even when it uses our APIs (as we do publically publish our API document), but please remove the library files that were posted in your download file.

Again, thanks for being a SocketMobile developer. And if there is anything we can do to make the experience better, please let us know (developers@socketmobile.com) and we will strive to implement it!

Regards, Len Ott CTO & VP Engineering Socket Mobile