Comments (3)
tv_device_selected, Maybe you need use permission on run time.
` private fun hasConnectBluetooth() =
ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED
private fun hasScanBluetooth() =
ActivityCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_GRANTED
private fun requestPermissions() {
var permissionsToReques = mutableListOf<String>()
if(!hasScanBluetooth()) {
permissionsToReques.add(Manifest.permission.BLUETOOTH_SCAN)
}
if(!hasConnectBluetooth()) {
permissionsToReques.add(Manifest.permission.BLUETOOTH_CONNECT)
}
if(permissionsToReques.isNotEmpty()) {
ActivityCompat.requestPermissions(this, permissionsToReques.toTypedArray(), 0)
}
}
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<out String>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if(requestCode == 0 && grantResults.isNotEmpty()) {
for(i in grantResults.indices) {
if(grantResults[i] == PackageManager.PERMISSION_GRANTED) {
Log.e("permission is:", " ${permissions[i]} разрешено")
initView()
}
}
}
}`
and use requestPermissions fun in your activity or fragment
from printooth.
Since android 12 you need to add two extras permissions, depending on your need but in my case I do this using Dexter to request permissions :
final List<String> permissions = new ArrayList<>();
permissions.add(Manifest.permission.ACCESS_FINE_LOCATION);
permissions.add(Manifest.permission.BLUETOOTH);
permissions.add(Manifest.permission.BLUETOOTH_ADMIN);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
permissions.add(Manifest.permission.BLUETOOTH_CONNECT);
permissions.add(Manifest.permission.BLUETOOTH_SCAN);
}
Dexter.withContext(requireActivity())
.withPermissions(permissions)
....
from printooth.
hi guys @hernando-montoya @tspoke @Dumankrg2019 , i get this issue too, so which solution need to implement for this issue?
from printooth.
Related Issues (20)
- Two Printables in same line won't dsiplay correct way HOT 2
- setPrinterInfo() -> JNIWrapper.getPapreList() Causes exception
- How can I print pdf using this library
- not support Thai language HOT 2
- How to check if printer is printed
- Problem in scanning_activity.xml on SwipeRefreshLayout HOT 3
- Receiver Not Registered
- Font Style or Font Family
- TextPrintable is not working HOT 1
- Print multiple text in single row
- Scanning activity freezes on swiping state when i try to scan devices HOT 4
- Problem on Xiaomi Devices
- Problem with TextPrintable Alignment
- charset CP437 for £ sign
- Problem printing
- How to set printer width? HOT 1
- print big image
- Can not implement multiple time printing
- can't use theme material
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from printooth.