This API is based on the official zxing library
public class QRCode {
public static void main(String[] args) throws IOException, WriterException {
QRCodeHelper qrCodeHelper = new QRCodeHelper();
// This will create a file at "yourPath/file.itsSuffix" with a squared QRCode and return its stream
// You need to add the "com.google.zxing:javase" dependencies to your project to work correctly
qrCodeHelper.getQRCodeStream("YOUR DATA", "yourPath/file.itsSuffix", 250);
// This will create a file at "yourPath/file.itsSuffix" with a custom dimensions QRCode and return its stream
// You need to add the "com.google.zxing:javase" dependencies to your project to work correctly
qrCodeHelper.getQRCodeStream("YOUR DATA", "yourPath/file.itsSuffix", 250, 200);
// This will create a file at "yourPath/file.itsSuffix" with a squared QRCode
// You need to add the "com.google.zxing:javase" dependencies to your project to work correctly
qrCodeHelper.createQRCode("YOUR DATA", "yourPath/file.itsSuffix", 250);
// This will create a file at "yourPath/file.itsSuffix" with a custom dimensions QRCode
// You need to add the "com.google.zxing:javase" dependencies to your project to work correctly
qrCodeHelper.createQRCode("YOUR DATA", "yourPath/file.itsSuffix", 250, 200);
// This will read a QRCode and shows its content
qrCodeHelper.readQRCode("yourPath/file.itsSuffix");
// This will read a QRCode and shows its content
qrCodeHelper.readQRCode(new File("yourPath/file.itsSuffix"));
// DEFAULT HTML PAGE
// This will create and host a temporary file at "yourPath/file.itsSuffix" with a squared QRCode
qrCodeHelper.hostQRCode(/*your_port*/,"YOUR DATA", "yourPath/file.itsSuffix", 250, false);
// This will create and host a temporary file at "yourPath/file.itsSuffix" with a custom dimensions QRCode
qrCodeHelper.hostQRCode(/*your_port*/,"YOUR DATA", "yourPath/file.itsSuffix", 250, 200, false);
// CUSTOM HTMl PAGE
/*
* <html>
* <body>
* <h1>Hey a custom page for my QRCode</h1>
* <qrcode> <!-- YOU MUST INSERT THIS TAG TO INSERT THE QRCODE CREATED -->
* </body>
* </html>
* */
// This will create and host a temporary file at "yourPath/file.itsSuffix" with a squared QRCode
qrCodeHelper.hostQRCode(/*your_port*/,"YOUR DATA", "yourPath/file.itsSuffix", 250, false,
new File("yourPath/customPage.html"));
// This will create and host a temporary file at "yourPath/file.itsSuffix" with a custom dimensions QRCode
qrCodeHelper.hostQRCode(/*your_port*/,"YOUR DATA", "yourPath/file.itsSuffix", 250, 200, false,
new File("yourPath/customPage.html"));
// This will stop the single running host
qrCodeHelper.stopHosting();
// This will stop the running host on "your_port"
qrCodeHelper.stopHostingOn(/*your_port*/);
// This will stop all the running hosts
qrCodeHelper.stopAllHosting();
}
}
To use this library on Android you must follow two simple steps:
- Add permission to AndroidManifest file
<uses-permission android:name="android.permission.INTERNET" />
- Create a single one strict detector
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
If you need help using the library or encounter any problems or bugs, please contact us via the following links:
Thank you for your help!
If you want support project and developer
Crypto | Address | Network |
---|---|---|
3H3jyCzcRmnxroHthuXh22GXXSmizin2yp | Bitcoin | |
0x1b45bc41efeb3ed655b078f95086f25fc83345c4 | Ethereum |
If you want support project and developer with PayPal
Copyright © 2024 Tecknobit