Bluetooth Printing on Android

前端 未结 4 923
孤独总比滥情好
孤独总比滥情好 2021-02-06 19:52

I am trying to print to an HP DeskJet 450wbt printer from my T-Mobile Pulse Mini phone, using the Android Bluetooth API. The code is as shown below. The connection fails with \"

相关标签:
4条回答
  • 2021-02-06 20:10

    If your phone model (here Android) has built-in support for the Bluetooth Printing Profile, then the phone supports printing to a Bluetooth printer. If you do not see any settings/options on your phone to print (from, for example, the built-in photo gallery applications) to a Bluetooth printer, then in all likelihood the phone does not support Bluetooth printing.

    If the support is not built-in, there is little or no chance for you to add the support; it has to come from the device manufacturer(here Android).

    (Ref: http://discussion.forum.nokia.com/forum/showthread.php?76295-Bluetooth-printing-option-in-application)


    For Bluetooth profile support to be implemented on Android, there is a project called “Sybase-iAnywhere-Blue-SDK-for-Android”, which replaces Android's version, and provides all interfaces into the underlying Bluetooth profiles and protocols. Using this, printing over bluetooth using your Android phone will be possible using the BPP profile provided by this SDK.

    See links below for more details: link 1: http://www.sybase.com/detail?id=1064424 Link 2: http://www.sybase.com/products/allproductsa-z/mobiledevicesdks/bluetoothsdks

    0 讨论(0)
  • 2021-02-06 20:17

    There are various bluetooth profiles that maybe used for printing namely, HCRP, BPP, SPP, OPP, DirectPrinting etc. (Ref: http://www.alanjmcf.me.uk/comms/bluetooth/Bluetooth%20Profiles%20and%2032feet.NET.html#_Toc266869878)

    Try these other profiles (UUIDs) to try a 'socket.connect'with the printer... Perhaps your Palm OS device would be using another profile than BPP?

    By the way Philip, for your printer - HP DeskJet 450wbt, are you using a generic Bluetooth dongle or something you purchased specifically for your printer from HP?

    Or does your printer support Bluetooth out of the box, without need to plugin a Bluetooth adapter?

    Perhaps you can answer my question here: can generic Bluetooth dongle be used for printers that support printing over Bluetooth?

    Let me know how it works out for you.

    0 讨论(0)
  • 2021-02-06 20:24

    Try this:

    Method m = device.getClass().getMethod("createRfcommSocket", new Class[] {int.class});
    tmp = (BluetoothSocket) m.invoke(device, 1);
    
    0 讨论(0)
  • 2021-02-06 20:33

    I think the reason might be that the Bluetooth stack on android you are using might not support the BPP profile , if you are using the standard android versions it does not support BPP.

    The mechanism of socket creation is failing because the printer does not implement the SPP profile. The android examples depend on the server side SPP to be listening to be able to connect from the client. The printer for sure will not have generic SPP server listening.

    0 讨论(0)
提交回复
热议问题