File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Android and the fly likes Advice needed for android phonegap custom plugin Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Advice needed for android phonegap custom plugin" Watch "Advice needed for android phonegap custom plugin" New topic

Advice needed for android phonegap custom plugin

kos bou

Joined: Aug 20, 2012
Posts: 1
I have developed an app in phonegap (html5, JQuery, JS) and I want to develop a plugin to print to a BT printer.

I download printer manufacturer's SDK and I imported the appropriate .jar file to my project with all the methods I will need in my project.

I create the below plugin, following an internet tutorial, in order to call from JS the JAVA methods from printer manufacturers SDK.



Printer command manual say:

GetPort is what you will be using to “open” the port to the printer. Using one of the valid
inputs for portName and portSettings as mentioned previously before this, you can pass your
connection string into the StarIO class so that it will correctly set its private variables.

StarIOPort is a part of StarIO and this will allow you to create a “port” handle. The
above example shows the port being created and set to null then being assigned the actual
port hook on the following line that contains getPort.
Always use a try, catch when using getPort. If the port cannot be opened
because of connection problems, your program will crash unless you use a
try, catch like the above example.

Is the above syntax of plugin correct or is there something i missed?

When I run my app always i receive "Failed to connect to printer" even if the printer is on and connected to my device.
I agree. Here's the link:
subject: Advice needed for android phonegap custom plugin
It's not a secret anymore!