Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USB + Bluetooth + upgrade to Android 14 SDK #1

Draft
wants to merge 1 commit into
base: usb_bluetooth_permissions
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 32 additions & 14 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,49 @@
<author>Jose Angarita / Ruben Casas</author>
<keywords>print,starmicronics,star printer</keywords>
<license>MIT</license>

<engines>
<engine name="cordova" version=">=3.4.0"/>
<engine name="cordova-android" version=">=12.0.0" />
</engines>

<js-module name="StarPRNT" src="www/StarPRNT.js">
<clobbers target="starprnt" />
</js-module>

<platform name="android">
<!-- Using StarPRNT_Android_SDK_V5_18_0 -->
<!-- <lib-file src="src/android/lib/stario.aar" />-->
<!-- <lib-file src="src/android/lib/starioextension.aar" />-->
<!-- <lib-file src="src/android/lib/StarIODeviceSetting.aar" />-->

<resource-file src="src/android/lib/stario.aar" target="lib/stario.aar" />
<resource-file src="src/android/lib/starioextension.aar" target="lib/starioextension.aar" />
<resource-file src="src/android/lib/StarIODeviceSetting.aar" target="lib/StarIODeviceSetting.aar" />
<dependency id="cordova-plugin-compat" version="^1.0.0"/>

<!-- app/src/main/ get prepended to target -->
<resource-file src="src/android/xml/device_filter.xml" target="res/xml/device_filter.xml" />
<resource-file src="src/android/xml/accessory_filter.xml" target="res/xml/accessory_filter.xml" />

<framework src="src/android/*.gradle" custom="true" type="gradleReference" />

<source-file src="src/android/StarPRNT.java" target-dir="src/starprnt/cordova" />
<!-- Using StarPRNT_Android_SDK_V5_17_0 -->
<source-file src="src/android/lib/StarIOPort3.1.jar" target-dir="libs" />
<source-file src="src/android/lib/starioextension.jar" target-dir="libs" />

<config-file target="res/xml/config.xml" parent="/*">
<feature name="StarPRNT">
<param name="android-package" value="starprnt.cordova.StarPRNT" />
</feature>
<feature name="StarPRNT">
<param name="android-package" value="starprnt.cordova.StarPRNT" />
</feature>
</config-file>

<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation" />
</config-file>

<config-file target="AndroidManifest.xml" parent="/manifest/application/activity">
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
Expand All @@ -35,24 +56,21 @@
<meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/device_filter" />
<meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" android:resource="@xml/accessory_filter" />
</config-file>

<!-- app/src/main/ get prepended to target -->
<resource-file src="src/android/xml/device_filter.xml" target="res/xml/device_filter.xml" />
<resource-file src="src/android/xml/accessory_filter.xml" target="res/xml/accessory_filter.xml" />
</platform>

<platform name="ios">
<config-file target="config.xml" parent="/*">
<feature name="StarPRNT">
<param name="ios-package" value="StarPRNT" />
</feature>
</config-file>
<config-file target="*-Info.plist" parent="UISupportedExternalAccessoryProtocols">
<array>
<string>jp.star-m.starpro</string>
</array>
<array>
<string>jp.star-m.starpro</string>
</array>
</config-file>
<config-file target="*-Info.plist" parent="NSBluetoothPeripheralUsageDescription">
<string>To connect to Star Micronic's Devices</string>
<string>To connect to Star Micronics Devices</string>
</config-file>
<header-file src="src/ios/Communication.h" />
<source-file src="src/ios/Communication.m" />
Expand Down
Binary file added src/android/lib/StarIODeviceSetting.aar
Binary file not shown.
Binary file removed src/android/lib/StarIOPort3.1.jar
Binary file not shown.
Binary file added src/android/lib/stario.aar
Binary file not shown.
Binary file added src/android/lib/starioextension.aar
Binary file not shown.
Binary file removed src/android/lib/starioextension.jar
Binary file not shown.
27 changes: 27 additions & 0 deletions src/android/starPRNT.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
def minSdkVersion = 19

if(cdvMinSdkVersion == null) {
ext.cdvMinSdkVersion = minSdkVersion;
} else if (cdvMinSdkVersion.toInteger() < minSdkVersion) {
ext.cdvMinSdkVersion = minSdkVersion;
}

repositories{
jcenter()
flatDir{
dirs 'src/main/libs'
}
}

dependencies {
compile(name:'stario', ext:'aar')
compile(name:'starioextension', ext:'aar')
compile(name:'StarIODeviceSetting', ext:'aar')
}

android {
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
5 changes: 5 additions & 0 deletions src/android/xml/accessory_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@
<!-- https://www.star-m.jp/products/s_print/sdk/starprnt_sdk/manual/android_java/en/configure_application.html#device-filter-xmlaccessory-filter-xml -->
<resources>
<usb-accessory model="Star TSP143IV-UE" manufacturer="STAR"/>
<usb-accessory model="Star TSP143IV-UE SK" manufacturer="STAR"/>
<usb-accessory model="mC-Label3" manufacturer="Star Micronics"/>
<usb-accessory model="mC-Print3" manufacturer="Star Micronics"/>
<usb-accessory model="mPOP" manufacturer="Star Micronics"/>
<usb-accessory model="BSC10II" manufacturer="Star Micronics"/>
</resources>
4 changes: 3 additions & 1 deletion src/android/xml/device_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<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="0025" /> <!--mC-Label3 - printerClass-->
<usb-device vendor-id="1305" product-id="0027" /> <!--BSC10II StarPRNT - 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>
</resources>
12 changes: 12 additions & 0 deletions starprnt.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/android" isTestSource="false" packagePrefix="starprnt.cordova" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="lib" level="project" />
</component>
</module>