When requesting permission for fingerprint sensor manually for oreo dialog box does not show up.
I have listed the USE_FINGERPRINT permission in Manifest but still, I get an exception as
W/System.err: java.lang.SecurityException: Must have android.permission.USE_FINGERPRINT permission.: Neither user 10190 nor current process has android.permission.USE_FINGERPRINT.
at android.os.Parcel.readException(Parcel.java:2004)
at android.os.Parcel.readException(Parcel.java:1950)
at android.hardware.fingerprint.IFingerprintService$Stub$Proxy.isHardwareDetected(IFingerprintService.java:465)
at android.hardware.fingerprint.FingerprintManager.isHardwareDetected(FingerprintManager.java:835)
at ""ui.biometricAuth.BiometricAuth.getFingerPrintAuthError(BiometricAuth.java:174)
at ""ui.biometricAuth.BiometricAuth.isTouchIDEnabled(BiometricAuth.java:225)
at ""ui.usermanagement.LoginActivity.onCreate(LoginActivity.java:403)
at android.app.Activity.performCreate(Activity.java:7036)
at android.app.Activity.performCreate(Activity.java:7027)
W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1231)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2864)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2989)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1688)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6753)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:482)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
I added the permission as follows before
<uses-permission
android:name="android.permission.USE_FINGERPRINT"
android:requiredFeature="false" />
now after removing android:requiredFeature="false" and adding only
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
worked fine for all the OS versions.
A clean build (or just rebuild) works too.
add android.permission.USE_BIOMETRIC
Related
I am running an App that targets Android 13 on a Samsung device with Android 13.
I need to check at runtime if the notifications permission is granted or not and if it is not granted I need to request it,
here is how to request the new permission
pushNotificationPermissionLauncher.launch(android.Manifest.permission.POST_NOTIFICATIONS)
private val pushNotificationPermissionLauncher = registerForActivityResult(
ActivityResultContracts.RequestPermission()
) { granted ->
}
My Mainfest have the required permission delaration
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
But when i request the permisison i am getting this crash,
Failed looking up ApplicationInfo for com.testapp
android.content.pm.PackageManager$NameNotFoundException: com.testapp at android.app.ApplicationPackageManager.getApplicationInfoAsUser(ApplicationPackageManager.java:504)
at android.app.ApplicationPackageManager.getApplicationInfo(ApplicationPackageManager.java:487)
at android.app.ApplicationPackageManager.getApplicationInfo(ApplicationPackageManager.java:481)
at com.android.systemui.statusbar.notification.collection.TargetSdkResolver.resolveNotificationSdk(TargetSdkResolver.kt:46)
at com.android.systemui.statusbar.notification.collection.TargetSdkResolver.access$resolveNotificationSdk(TargetSdkResolver.kt:29)
at com.android.systemui.statusbar.notification.collection.TargetSdkResolver$initialize$1.onEntryBind(TargetSdkResolver.kt:36)
at com.android.systemui.statusbar.notification.collection.notifcollection.BindEntryEvent.dispatchToListener(NotifEvent.kt:48)
at com.android.systemui.statusbar.notification.collection.notifcollection.NotifEvent.dispatchTo(NotifEvent.kt:36)
at com.android.systemui.statusbar.notification.collection.NotifCollection.dispatchEventsAndRebuildList(NotifCollection.java:593)
at com.android.systemui.statusbar.notification.collection.NotifCollection.onNotificationPosted(NotifCollection.java:398)
at com.android.systemui.statusbar.notification.collection.NotifCollection.-$$Nest$monNotificationPosted(Unknown Source:0)
at com.android.systemui.statusbar.notification.collection.NotifCollection$1.onNotificationPosted(NotifCollection.java:838)
at com.android.systemui.statusbar.notification.collection.coalescer.GroupCoalescer$1.onNotificationPosted(GroupCoalescer.java:131)
at com.android.systemui.statusbar.NotificationListener.lambda$onNotificationPosted$1(NotificationListener.java:145)
at com.android.systemui.statusbar.NotificationListener.$r8$lambda$fICxp1QDMnCbsW19erR3r8vu9YQ(Unknown Source:0)
at com.android.systemui.statusbar.NotificationListener$$ExternalSyntheticLambda2.run(Unknown Source:6)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7898)
at java.lang.reflect.Method.invoke(Native Method)
at
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
any help, please?
I'm using Foreground Services for notification and it's working on other mobile phones as well it's working on an emulator also but in MI phone it's not working it shows error like this.
2020-07-01 17:47:25.783 4338-4338/com.example.notification_app E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.notification_app, PID: 4338
java.lang.RuntimeException: Unable to create service com.example.notification_app.my_service: java.lang.SecurityException: Permission Denial: startForeground from pid=4338, uid=10175 requires android.permission.FOREGROUND_SERVICE
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3577)
at android.app.ActivityThread.access$1400(ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1689)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6810)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: java.lang.SecurityException: Permission Denial: startForeground from pid=4338, uid=10175 requires android.permission.FOREGROUND_SERVICE
at android.os.Parcel.createException(Parcel.java:1953)
at android.os.Parcel.readException(Parcel.java:1921)
at android.os.Parcel.readException(Parcel.java:1871)
at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:5104)
at android.app.Service.startForeground(Service.java:695)
at com.example.notification_app.my_service.startMyOwnForeground(my_service.java:57)
at com.example.notification_app.my_service.onCreate(my_service.java:44)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3565)
at android.app.ActivityThread.access$1400(ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1689)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6810)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
2020-07-01 17:47:25.826 4338-4338/? I/Process: Sending signal. PID: 4338 SIG: 9
and in line number 48, I called a function startForeground(1, new Notification());
If you read carefully in the end of second line
requires android.permission.FOREGROUND_SERVICE
I was also facing the same error in one of my project I resolve it by adding permission in the manifest file. So just simply add foreground permission in the manifest file.
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"></uses-permission>
Hope it's work for you.
Firebase Messaging Service is Causing Crash in My App. When i Implement FirebaseMessagingService and try to add it on Manifest its showing me "MyFirebaseMessagingServiceservice is not assignable to android.app.service" . When I didn't use the MyFirebaseMessagingServiceservice , then also im getting the error. This question is asked before, I have tried all the answer given in that question but noting workout. Please help.
Im using firebase-messaging:17.1.0
This is the error-
java.lang.IllegalAccessError: com.example.genesishospital.MyFirebaseMessagingService
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:226)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
at dalvik.system.DexPathList.findClass(DexPathList.java:338)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3838)
at android.app.ActivityThread.-wrap8(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1909)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
After adding this permission my app works fine.
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
I am facing two inter related issue,
I am facing following issue in Android Oreo device,
java.lang.RuntimeException: Error receiving broadcast Intent { act=com.example.bluetooth.le.ACTION_REMOTE_RSSI_UPDATED flg=0x10 (has extras) } in com.linka.linkaapikit.module.widget.LockGattUpdateReceiver$1#762cfd9
at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$-android_app_LoadedApk$ReceiverDispatcher$Args_52197(LoadedApk.java:1315)
at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.$m$7(Unknown Source:4)
at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.run(Unknown Source:39)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:172)
at android.app.ActivityThread.main(ActivityThread.java:6590)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.SecurityException: Failed to find provider null for user 0; expected to find a valid ContentProvider for this authority
at android.os.Parcel.readException(Parcel.java:2005)
at android.os.Parcel.readException(Parcel.java:1951)
at android.content.IContentService$Stub$Proxy.notifyChange(IContentService.java:801)
at android.content.ContentResolver.notifyChange(ContentResolver.java:2049)
at android.content.ContentResolver.notifyChange(ContentResolver.java:2000)
at android.content.ContentResolver.notifyChange(ContentResolver.java:1970)
at com.activeandroid.Model.save(Model.java:162)
After that i find following solutions,
add in Android Manifest
<provider
android:name="com.activeandroid.content.ContentProvider"
android:authorities="com.myapp"
android:enabled="true"
android:exported="false"
/>
But after adding this line i got another issue that are following,
java.lang.IncompatibleClassChangeError: Superclass org.apache.http.params.BasicHttpParams of org.apache.http.params.SyncBasicHttpParams is declared final (declaration of 'org.apache.http.params.SyncBasicHttpParams' appears in /data/app/com.kolonishare-6KsxqUHOK_Q45cGI0D0bHg==/base.apk:classes16.dex)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at com.activeandroid.ModelInfo.scanForModelClasses(ModelInfo.java:187)
at com.activeandroid.ModelInfo.scanForModel(ModelInfo.java:152)
at com.activeandroid.ModelInfo.<init>(ModelInfo.java:63)
at com.activeandroid.Cache.initialize(Cache.java:66)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:44)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:34)
at com.activeandroid.content.ContentProvider.onCreate(ContentProvider.java:39)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1919)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1894)
at android.app.ActivityThread.installProvider(ActivityThread.java:6285)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5851)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5772)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
I clean and also rebuild project, invalidate restart but getting same error.
you need put your xml in this
<provider android:name="com.activeandroid.content.ContentProvider"
android:authorities="${applicationId}.fileprovider"
android:enabled="true"
android:exported="false" />
When attempting to run the BLE Indoor Positioning Demo App on Android Things (using the NXP i.MX7D Developer Kit), I get Bluetooth scanning error: Location Services disabled (code 4).
E/BluetoothClient: Bluetooth scanning error: Location Services disabled (code 4)
W/System.err: com.polidea.rxandroidble.exceptions.BleScanException: Location Services disabled (code 4)
W/System.err: at com.polidea.rxandroidble.internal.scan.ScanPreconditionsVerifierApi18.verify(ScanPreconditionsVerifierApi18.java:31)
W/System.err: at com.polidea.rxandroidble.internal.scan.ScanPreconditionsVerifierApi24.verify(ScanPreconditionsVerifierApi24.java:38)
W/System.err: at com.polidea.rxandroidble.RxBleClientImpl$1.call(RxBleClientImpl.java:114)
W/System.err: at com.polidea.rxandroidble.RxBleClientImpl$1.call(RxBleClientImpl.java:111)
W/System.err: at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46)
W/System.err: at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)
W/System.err: at rx.Observable.subscribe(Observable.java:10352)
W/System.err: at rx.Observable.subscribe(Observable.java:10319)
W/System.err: at rx.Observable.subscribe(Observable.java:10227)
W/System.err: at com.nexenio.bleindoorpositioningdemo.bluetooth.BluetoothClient.startScanning(BluetoothClient.java:79)
W/System.err: at com.nexenio.bleindoorpositioningdemo.HomeActivity.onResume(HomeActivity.java:108)
W/System.err: at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1355)
W/System.err: at android.app.Activity.performResume(Activity.java:7118)
W/System.err: at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3556)
W/System.err: at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3621)
W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2862)
W/System.err: at android.app.ActivityThread.-wrap11(Unknown Source:0)
W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:106)
W/System.err: at android.os.Looper.loop(Looper.java:164)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6494)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
The app uses RxAndroidBle for dealing with Android's Bluetooth stack. It also declares these permission in the manifest:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
As of my understanding, Android Things should automatically grant these permissions at install time or after a reboot.
I don't know how I should enable the location services manually or programatically.
The issue is not with permissions. The RxAndroidBle library makes some assumptions about location services that aren't necessarily appropriate for Android Things (since those settings aren't actually controlled by users). The reason the library check is failing is because NETWORK_PROVIDER is not enabled and GPS_PROVIDER is only enabled if you have a GPS driver registered. You don't actually need either of those to do a BLE scan, however.
Fortunately for you, it looks like the author of RxAndroidBle recently changed the code to also verify if the location mode settings were enabled. This check will pass on Android Things, so in your case you probably only need to update your library dependency to 1.5:
dependencies {
...
implementation "com.polidea.rxandroidble:rxandroidble:1.5.0"
}