fewlaps / bixolon-printer-example Goto Github PK
View Code? Open in Web Editor NEWPrint things with Bixolon printers on Android
License: GNU General Public License v2.0
Print things with Bixolon printers on Android
License: GNU General Public License v2.0
My device has a MAC address starting with 00: 06: 6E. And the library in your kit sifts out my device, because there is a filter in BluetoothService
:
static final String[] MAC_ADDRESS_PREFIXES = new String[]{"00:19:01", "74:F0:7D"};
Is there any solution to this problem?
Hello
i check your code my zebra device but Bluetooth not connected in zebra device but when we connected with mobile it will work.
can you help me how to connected with zebra device with bixolon printer
thank you
Dear Fewlaps Team,
I am trying to develop an app for myself and I am stock on Android Bluetooth connection between Bixolon Spp-R300.
I have try your code from git hub but it was for 2'' model, I am not able to compile it anyway. I have faced with some gradle script problem.
After File-> Import Project I have "Message Gradle Sync" says that Failed to sync Gradle project
The project using an unsopported version of the Android Gradle Plugin 0.12.2 the recommend version is 1.1.0 || Fix plugin version and re-import project.
After clicking Fix plugin button I have another message The project may be using a version of Gradle that does not contain the method "runProguard()"
What ever I try I couldnt solve problems.
Could you please support me in this issue?
Best Regards.
I have been trying to print to a Bixolon SPP-R400 printer from my android application on a Samsung Galaxy Tab 4. I was wondering if you could give me some insight on this problem that I have run into. I seem to be able to get to the "Connecting" phase of my code, the status signal is blinking green. The problem is that I can't seem to get to the "Connected" phase which is where I start printing.
Here is my logcat log:
'''''
02-23 15:31:01.512: I/Handler(12140): BixolonPrinter.MESSAGE_BLUETOOTH_DEVICE_SET
02-23 15:31:01.532: I/Handler(12140): BixolonPrinter.MESSAGE_STATE_CHANGE
02-23 15:31:01.532: I/Handler(12140): BixolonPrinter.STATE_CONNECTING
02-23 15:31:01.542: D/BluetoothSocket(12140): GlobalConfig.GLOBALCONFIG_BT_IT_POLICY_FEATURE = true
02-23 15:31:01.542: W/BluetoothAdapter(12140): getBluetoothService() called with no BluetoothManagerCallback
02-23 15:31:01.552: D/BluetoothSocket(12140): connect(), SocketState: INIT, mPfd: {ParcelFileDescriptor: FileDescriptor[52]}
02-23 15:31:03.504: I/Handler(12140): BixolonPrinter.MESSAGE_DEVICE_NAME - SPP-R400
'''''
and relevant code:
'''
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
instance = this;
Intent i = getIntent();
Bundle b = i.getExtras();
// final String dropTicketString = b.getString("DropTicketString");
final String dropTicketString[] = b.getStringArray("DropTicketString");
setContentView(R.layout.drop_ticket_print_view);
mBixolonPrinter = new BixolonPrinter(this,handler,null);
try {
// we are goin to have three buttons for specific functions
printConfirmButton = (Button) findViewById(R.id.print);
noPrintButton = (Button) findViewById(R.id.noprint);
printConfirmButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
generatePdf(dropTicketString);
String dropTicketPdfPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/droidText/" + dropTicketString[0] + "-Drop Ticket.pdf";
try {
//FIXME this example hardcodes the text values to increase a little the readability of the code. Don't do it in production! :)
mBixolonPrinter.findBluetoothPrinters();
} catch (Exception e) {
Log.e("ERROR", "Printing", e);
}
}
});
noPrintButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
finish();
}
});
} catch (NullPointerException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
private final Handler handler = new Handler() {
@SuppressWarnings("unchecked")
@OverRide
public void handleMessage(Message msg) {
// Log.i("Handler", msg.what + " " + msg.arg1 + " " + msg.arg2);
switch (msg.what) {
case BixolonPrinter.MESSAGE_BLUETOOTH_DEVICE_SET:
Log.i("Handler", "BixolonPrinter.MESSAGE_BLUETOOTH_DEVICE_SET");
Set<BluetoothDevice> bluetoothDeviceSet =
(Set<BluetoothDevice>) msg.obj;
for (BluetoothDevice device : bluetoothDeviceSet)
{
if (device.getName().equals("SPP-R400"))
{
mBixolonPrinter.connect(device.getAddress());
break;
}
}
break;
case BixolonPrinter.MESSAGE_STATE_CHANGE:
Log.i("Handler", "BixolonPrinter.MESSAGE_STATE_CHANGE");
switch (msg.arg1) {
case BixolonPrinter.STATE_CONNECTED:
Log.i("Handler", "BixolonPrinter.STATE_CONNECTED");
mBixolonPrinter.lineFeed(5, true);
connectedPrinter = true;
break;
case BixolonPrinter.STATE_CONNECTING:
Log.i("Handler", "BixolonPrinter.STATE_CONNECTING");
connectedPrinter = false;
break;
case BixolonPrinter.STATE_NONE:
Log.i("Handler", "BixolonPrinter.STATE_NONE");
connectedPrinter = false;
break;
}
break;
case BixolonPrinter.MESSAGE_READ:
Log.i("Handler", "BixolonPrinter.MESSAGE_READ");
break;
case BixolonPrinter.MESSAGE_DEVICE_NAME:
Log.i("Handler", "BixolonPrinter.MESSAGE_DEVICE_NAME - " + msg.getData().getString(BixolonPrinter.KEY_STRING_DEVICE_NAME));
break;
case BixolonPrinter.MESSAGE_TOAST:
Log.i("Handler", "BixolonPrinter.MESSAGE_TOAST - " + msg.getData().getString("toast"));
// Toast.makeText(getApplicationContext(), msg.getData().getString("toast"), Toast.LENGTH_SHORT).show();
break;
// The list of paired printers
case BixolonPrinter.MESSAGE_PRINT_COMPLETE:
Log.i("Handler", "BixolonPrinter.MESSAGE_PRINT_COMPLETE");
mBixolonPrinter.disconnect();
finish();
break;
case BixolonPrinter.MESSAGE_COMPLETE_PROCESS_BITMAP:
Log.i("Handler", "BixolonPrinter.MESSAGE_COMPLETE_PROCESS_BITMAP");
break;
case BixolonPrinter.MESSAGE_USB_DEVICE_SET:
Log.i("Handler", "BixolonPrinter.MESSAGE_USB_DEVICE_SET");
if (msg.obj == null) {
Toast.makeText(getApplicationContext(), "No connected device", Toast.LENGTH_SHORT).show();
} else {
// DialogManager.showUsbDialog(MainActivity.this,
// (Set<UsbDevice>) msg.obj, mUsbReceiver);
}
break;
case BixolonPrinter.MESSAGE_NETWORK_DEVICE_SET:
Log.i("Handler", "BixolonPrinter.MESSAGE_NETWORK_DEVICE_SET");
if (msg.obj == null) {
Toast.makeText(getApplicationContext(), "No connectable device", Toast.LENGTH_SHORT).show();
}
// DialogManager.showNetworkDialog(PrintingActivity.this, (Set<String>) msg.obj);
break;
}
}
};
'''
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.