aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "Advice needed for android phonegap custom plugin" Watch "Advice needed for android phonegap custom plugin" New topic
Author

Advice needed for android phonegap custom plugin

kos bou
Greenhorn

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.

JS



JAVA




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: http://aspose.com/file-tools
 
subject: Advice needed for android phonegap custom plugin