Android Question B4A BT_Printer - How to print from code module?

mmanso

Active Member
Licensed User
Longtime User
Hi all,

I'm using Star-Dust's BT_printer library to print to a bluetooth printer.

I've declared:

B4X:
Dim Printer As BT_Printer

in Main's Globals section.

Everything is working, I connect to the printer I want, all this in Main Activity.

In the same project I've a service that calls a code module that starts an HttpServer that has an Api to accept print commands from remote machines...

My question is, being that server implemented on a code module, how can I use the Printer defined on the Main activity?

Thanks.
 

Star-Dust

Expert
Licensed User
Longtime User
You tried passing the Printer variable as a parameter to the service.

You can also try to declare the Printer variable in the Starter service module and get it from the activity or other services
 
Upvote 0

mmanso

Active Member
Licensed User
Longtime User
I tried, but I get this warning from the IDE

screenshot_2020-12-19 18_26_00.png
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
You tried passing the Printer variable as a parameter to the service.

You can also use the Call command in the service to invoke methods of the activity where you enter printer commands.
 
Upvote 0

mmanso

Active Member
Licensed User
Longtime User
Thanks... didn't remember about the CallSub (I'm new to B4x).

Will follow that route.

Thanks.
 
Upvote 0

jitendra ankale

New Member
Licensed User
Hi all,

I'm using Star-Dust's BT_printer library to print to a bluetooth printer.

I've declared:

B4X:
Dim Printer As BT_Printer

in Main's Globals section.

Everything is working, I connect to the printer I want, all this in Main Activity.

In the same project I've a service that calls a code module that starts an HttpServer that has an Api to accept print commands from remote machines...

My question is, being that server implemented on a code module, how can I use the Printer defined on the Main activity?

Thanks.
Hello
Where to get from BT_Printer library
thank you
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
It is no longer available. Now you can get the limited free version of this library. And to get the full version follow the instructions on the thread

 
Upvote 0
Top