Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24224] Hyperlooop: Android - 3rd Party Android Library not correctly mapped

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionDuplicate
Resolution Date2016-12-16T11:46:50.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid, Hyperloop
Labelsandroid, hyperloop, titanium
ReporterMike Stancliffe
AssigneeGary Mathews
Created2016-12-13T16:56:00.000+0000
Updated2017-03-31T22:48:40.000+0000

Description

Trying to print to a bluetooth printer with the Zebra SDK from Android via Hyperloop, but the mappings seem incomplete. I am able to connect to the printer but when I try to get and instance of ZebraPrinter and then print an image with that instance I am told the method does not exist even though it should be(its inherited, but is clearly documented by Zebra). This also seems to be true of other inherited methods as well, I have tried a few others to see what works and what doesn't. the documentation: http://link-os.github.io/PC/v2.9.2275/documentation/com/zebra/sdk/printer/ZebraPrinter.html
var ZComm = require('com.zebra.sdk.comm.*'),
ZPrinter = require('com.zebra.sdk.printer.*'),
ZDevice = require('com.zebra.sdk.device.*');

var theBtMacAddress = "XX:XX:XX:XX:XX:XX";

function print(e) {
    var thePrinterConn = new ZComm.BluetoothConnection(theBtMacAddress);
    thePrinterConn.open();
    var printer = ZPrinter.ZebraPrinterFactory.getInstance(thePrinterConn);
    printer.printImage('/testPage.png', 0, 0);
    thePrinterConn.close();
}


$.index.open();

Attachments

FileDateSize
hyperloop-android-1.2.9.zip2016-12-16T18:32:27.000+00005255856
ZSDK_ANDROID_API.jar2016-12-13T16:54:57.000+0000481200

Comments

  1. Gary Mathews 2016-12-16

  2. Mike Stancliffe 2016-12-16

    Any chance of a port to 1.x hyperloop? Our app is not 6.0 ready yet.
  3. Gary Mathews 2016-12-16

  4. Mike Stancliffe 2016-12-29

    @gmathews Thank you for the backport, but I am seeing the same thing with it as well. I tried the same code as above with the same result when using the 1.2.9 provided {noformat} ERROR] : TiExceptionHandler: (main) [76155,111463] ----- Titanium Javascript Runtime Error ----- [ERROR] : TiExceptionHandler: (main) [0,111463] - In print.js:21,13 [ERROR] : TiExceptionHandler: (main) [0,111463] - Message: Uncaught TypeError: Object [object com.zebra.sdk.printer.ZebraPrinter] has no method 'printImage' [ERROR] : TiExceptionHandler: (main) [0,111463] - Source: printer.printImage("/testPage.png", 0, 0); [ERROR] : V8Exception: Exception occurred at print.js:21: Uncaught TypeError: Object [object com.zebra.sdk.printer.ZebraPrinter] has no method 'printImage' {noformat}
  5. Mike Stancliffe 2016-12-29

    as I keep looking for ways to get this project done, this seems to continue to happen, here is another example with java.util.Set
       var BluetoothAdapter = require('android.bluetooth.BluetoothAdapter');
       var JSet = require('java.util.Set');
       
       var adapter = BluetoothAdapter.getDefaultAdapter();
       var pairedDevices = new JSet(adaptor.getBondedDevices());
       Ti.API.warn(pairedDevices.toArray());
       
    and here is the documentation https://developer.android.com/reference/java/util/Set.html#toArray()
  6. Lee Morris 2017-03-31

    Closing ticket as duplicate, the relevant ticket is linked above.

JSON Source