2. How to configuration StarPRNT Application

The Library (StarIOPort3.1.jar / starioextension.jar / smcloudservices.aar) is already included when the StarPRNT SDK is loaded; there’s no need to include it again when testing our SDK.

When you are building your own application, it is necessary to add the library into it.

2.1. Add library

StarPRNT SDK library supports Maven Repository and JAR file.Please link library that suits your application configuration.

Important

smcloudservices Library

You need to add when using Star Micronics Cloud (AllReceipts, etc.) in the application.

2.1.1. Use Maven Repository

1. Insert following code in app/build.gradle.

dependencies {
    implementation 'com.starmicronics:stario:starioVersion'
    implementation 'com.starmicronics:starioextension:starioextensionVersion'
    implementation 'com.starmicronics:smcloudservices:smcloudservicesversion'
    ...
}

Note

Please refer to app/build.gradle in SDK for the latest library version.

2.1.2. Use JAR File

  1. Select the library in the libs folder of StarPRNT SDK.

    ../_images/Configuration_Android_Library_Folder.png
  2. Copy the library to the libs folder of project.

    ../_images/Configuration_Android_Library_Android_Studio.png

  1. Insert following code in app/build.gradle.

    dependencies {
        implementation files('libs/StarIOPort3.1.jar')
        implementation files('libs/starioextension.jar')
        implementation(name: 'smcloudservices', ext: 'aar')
        ...
    }
    

(Option) When printing of QR code / PDF417 on TSP100 series, add about use of the library.

dependencies {
    implementation 'com.google.zxing:core:3.2.1'
    ...
}
  1. Insert following code in build.gradle.

    allprojects {
        repositories {
            flatDir {
                dirs 'libs'
            }
            ...
        }
        ...
    }
    

2.2. Edit AndroidManifest.xml

  1. Double Click on the AndroidManifest.xml file.

    ../_images/Configuration_Android_Android_Manifest.png

  1. In case of TCP/IP connection, add about use of TCP/IP connection.In case of Bluetooth connection, add about use of Bluetooth connection.

    ../_images/Configuration_Android_Android_Manifest_Permission.png

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    
  2. In case of USB connection, add about use of USB connection.

    ../_images/Configuration_Android_Android_Manifest_USB.png

    <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/device_filter" />
    
    <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
    

2.3. Edit device_filter.xml

  1. Double Click on the device_filter.xml file.

    ../_images/Configuration_Android_Device_Filter.png

  1. In case of USB connection, add about use of USB connection.

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <usb-device class="255" subclass="66" protocol="1" />
        <usb-device vendor-id="1305" product-id="0001" />   <!--IFBD-HU05/06, IFBD-HU07/08 - printerClass-->
        <usb-device vendor-id="1305" product-id="0002" />   <!--IFBD-HU05/06, IFBD-HU07/08 - vendorClass-->
        <usb-device vendor-id="1305" product-id="0003" />   <!--TSP100U/ECO/IIIU  - printerClass-->
        <usb-device vendor-id="1305" product-id="0004" />   <!--TSP100U/ECO       - vendorClass-->
        <usb-device vendor-id="1305" product-id="0005" />   <!--TSP100GT/IIIU     - printerClass-->
        <usb-device vendor-id="1305" product-id="0006" />   <!--TSP100GT          - vendorClass-->
        <usb-device vendor-id="1305" product-id="0009" />   <!--FVP10             - printerClass-->
        <usb-device vendor-id="1305" product-id="0010" />   <!--FVP10             - vendorClass-->
        <usb-device vendor-id="1305" product-id="0011" />   <!--BSC10             - printerClass-->
        <usb-device vendor-id="1305" product-id="0012" />   <!--BSC10             - vendorClass-->
        <usb-device vendor-id="1305" product-id="0017" />   <!--BSC10BR           - printerClass-->
        <usb-device vendor-id="1305" product-id="0067" />   <!--SM-S210i/230i     - mobile printer-->
        <usb-device vendor-id="1305" product-id="0023" />   <!--mPOP              - printerClass-->
        <usb-device vendor-id="1305" product-id="0071" />   <!--mC-Print3         - printerClass-->
        <usb-device vendor-id="1305" product-id="0073" />   <!--mC-Print2         - printerClass-->
        <usb-device vendor-id="1305" product-id="0075" />   <!--SK1-211/221/V211  - printerClass-->
        <usb-device vendor-id="1305" product-id="0077" />   <!--SK1-311/321/V311  - printerClass-->
    </resources>
    
    <usb-device class="255" subclass="66" protocol="1" />
    <usb-device vendor-id="1305" product-id="****" />               <!—Target Printer -->
    

    About Star USB printers listed in device_filter.xml.If a user checks on the checkbox of connection permission dialog, then the dialog will not be displayed even if the cable is inserted or removed unless the application is reinstalled.In addition, the sample application will automatically launch when you insert the cable.

    TSP100IIIU can change product-id same as TSP100U/ECO or TSP100GT by memory switch setting.Memory switch setting can be done from Printer Configuration Software.Please refer to Utility/Driver.