Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8513887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:42:30+00:00 2026-06-11T04:42:30+00:00

I have developed an app in phonegap (html5, JQuery, JS) and I want to

  • 0

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 a plugin, following an internet tutorial, in order to call from JS the JAVA methods from printer manufacturers SDK.

When i run my testing app always i receive “Failed to connect to printer”.

my java code is as follow

public PluginResult execute(String action, JSONArray data, String callbackId) {


    if (NATIVE_ACTION_STRING.equals(action)) {


        this.ctx.runOnUiThread(new Runnable()
        {
            public void run()
            {
                String resultType = null;
                StarIOPort port = null;
                String message = null;
                String portName = "bt:";
                String portSettings = "mini";
                byte[] texttoprint = new byte[]{0x1b,0x74,0x0D,(byte) 0x91,(byte) 0x92,(byte) 0x93,(byte) 0x94,(byte) 0x95,(byte) 0x96,(byte) 0x97,(byte) 0x98,(byte) 0x99,0x0A,0x0A,0x0A,0x0A,0x0A};


                try 
                {
                    port = StarIOPort.getPort(portName, portSettings, 10000, (Context)ctx);

                    try
                    {
                        Thread.sleep(500);
                    }
                    catch(InterruptedException e) {}


                    port.writePort(texttoprint, 0, texttoprint.length);

                    try
                    {
                        Thread.sleep(3000);
                    }
                    catch(InterruptedException e) {}    

                }
                catch (StarIOPortException e)
                {

                    Builder dialog = new AlertDialog.Builder((Context)ctx);
                    dialog.setNegativeButton("Ok", null);
                    AlertDialog alert = dialog.create();
                    alert.setTitle("Failure");
                    alert.setMessage("Failed to connect to printer");
                    alert.show();
                }
                finally
                {
                    if(port != null)
                    {
                        try 
                        {
                            StarIOPort.releasePort(port);
                        } catch (StarIOPortException e) {}
                    }
                }
            }
        });

    }
     return null;
}}

If someone has any knowledge on StarMicronics SDK please advice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T04:42:32+00:00Added an answer on June 11, 2026 at 4:42 am

    add

        <uses-permission android:name="android.permission.INTERNET"></uses-permission>
        <uses-permission android:name="android.permission.BLUETOOTH"></uses-permission>
    

    in your manifest

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed an app in phonegap (html5, JQuery, JS) and I want to
I have a simple app developed with jQuery Mobile and implemented in PhoneGap. It
I have developed android phonegap app using html and jquery.I need to show tooltip
I have develop an app in HTML5 and JS (phonegap) and now I have
I have developed an app using Phonegap for Android and IPhone. Is there how
I am using jQuery Mobile and Phonegap to develop a small Android app. I
I have developed android phonegap app.I have a appended the dynamic form contains 'input'
I have a mobile app that I developed using PhoneGap (and html/css/javascript) and there
I have developed App which creates multiple tables , but I want to check
I have developed some app and want to add some manual for it. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.