Android PIE SecurityException - android

When i changed target version to 28 i started to get SecurityException crashes when i'm trying to display notification by NotificationManager.notify() from FirebaseService.
I read behavior changes for Android 9, but adding of FOREGROUND_SERVICE permission doesn't help me. The problem occurs on devices with Android 9 only, but i can't reproduce it on Samsung S10.
here is logs:
java.lang.SecurityException:
at android.os.Parcel.createException (Parcel.java:1966)
at android.os.Parcel.readException (Parcel.java:1934)
at android.os.Parcel.readException (Parcel.java:1884)
at android.app.INotificationManager$Stub$Proxy.enqueueNotificationWithTag (INotificationManager.java:1653)
at android.app.NotificationManager.notifyAsUser (NotificationManager.java:429)
at android.app.NotificationManager.notify (NotificationManager.java:379)
at android.app.NotificationManager.notify (NotificationManager.java:355)
at com.example.Utils.onNotificationReceived (Utils.java:201)
at com.example.FirebaseService.onMessageReceived (FirebaseService.java:51)
at com.google.firebase.messaging.FirebaseMessagingService.zzd (FirebaseMessagingService.java:60)
at com.google.firebase.iid.zzg.run (zzg.java:4)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
at com.google.android.gms.common.util.concurrent.zza.run (zza.java:6)
at java.lang.Thread.run (Thread.java:764)
Caused by: android.os.RemoteException:
at com.android.server.am.ActivityManagerService.checkGrantUriPermissionLocked (ActivityManagerService.java:12755)
at com.android.server.am.ActivityManagerService.checkGrantUriPermission (ActivityManagerService.java:12772)
at com.android.server.notification.NotificationRecord.visitGrantableUri (NotificationRecord.java:1147)
at com.android.server.notification.NotificationRecord.calculateGrantableUris (NotificationRecord.java:1123)
at com.android.server.notification.NotificationRecord.<init> (NotificationRecord.java:208)
Manifest permissions:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
Could there be an issue in setting sound for channel from raw directory?

Related

Android Pushwoosh IllegalStateException: Application does not define permission com.google.android.c2dm.permission.RECEIVE

I have a problem today. When I try to register to receive a push from Pushwoosh
Pushwoosh.getInstance().registerForPushNotifications()
It throws an exception like that
E/Pushwoosh: Exception occurred
java.lang.IllegalStateException: Application does not define permission com.google.android.c2dm.permission.RECEIVE
at com.pushwoosh.firebase.internal.registrar.a$b.a(Unknown Source:17)
at com.pushwoosh.firebase.internal.registrar.a$b.a(Unknown Source:30)
at com.pushwoosh.firebase.internal.registrar.a.checkDevice(Unknown Source:2)
at com.pushwoosh.notification.PushwooshNotificationManager.a(Unknown Source:45)
at com.pushwoosh.Pushwoosh.a(Unknown Source:23)
at com.pushwoosh.Pushwoosh.lambda$HgkxfkcfE_k-Lm_xVXJ-mTVOJ3g(Unknown Source:0)
at com.pushwoosh.-$$Lambda$Pushwoosh$HgkxfkcfE_k-Lm_xVXJ-mTVOJ3g.a(Unknown Source:6)
at com.pushwoosh.inapp.f.a.a(Unknown Source:11)
at com.pushwoosh.inapp.f.a.lambda$qCb0Pyb8Qrzu-2CtVmkrEeLg1C0(Unknown Source:0)
at com.pushwoosh.inapp.f.-$$Lambda$a$qCb0Pyb8Qrzu-2CtVmkrEeLg1C0.run(Unknown Source:6)
at android.os.Handler.handleCallback(Handler.java:900)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:219)
at android.os.HandlerThread.run(HandlerThread.java:67)
This is my Manifest
<manifest ..>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<application ..> </application></manifest>
I have tried adding this line to my manifest but still not working
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
My device is a Huawei nova 7i, I have tried to settings in my battery follow this link, and still not working. So any solution?
Edit : Huawei Nova i7 no longer supportted by google service, so firebase messaging doesn't work

Neither user 10034 nor current process has android.permission.WAKE_LOCK

Actually i'm having some problems with my App on devices with Android 4.2.2
Actually the App works well on all devices instead of a range of devices that uses radio frequency instead of Wi-Fi (Those devices are using Android 4.2.2).
Build gradle is set to compileSdkVersion 27 and minSdkVersion to 17.
What is happening is that the app just suddenly crash by sending the following logs to firebase:
android.os.Parcel.readException (Parcel.java:1425)
android.os.Parcel.readException (Parcel.java:1379)
android.os.IPowerManager$Stub$Proxy.acquireWakeLock (IPowerManager.java:299)
android.os.PowerManager$WakeLock.acquireLocked (PowerManager.java:770)
android.os.PowerManager$WakeLock.acquire (PowerManager.java:755)
android.support.v4.content.WakefulBroadcastReceiver.startWakefulService (WakefulBroadcastReceiver.java:108)
com.google.android.gms.measurement.AppMeasurementReceiver.doStartService (Origine sconosciuta:8)
com.google.android.gms.measurement.internal.zzbm.onReceive (Origine sconosciuta:38)
com.google.android.gms.measurement.AppMeasurementReceiver.onReceive (Origine sconosciuta:6)
android.app.ActivityThread.handleReceiver (ActivityThread.java:2376)
android.app.ActivityThread.access$1500 (ActivityThread.java:141)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1310)
android.os.Handler.dispatchMessage (Handler.java:99)
android.os.Looper.loop (Looper.java:137)
android.app.ActivityThread.main (ActivityThread.java:5041)
java.lang.reflect.Method.invokeNative (Method.java)
java.lang.reflect.Method.invoke (Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:795)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:562)
dalvik.system.NativeStart.main (NativeStart.java)
Actually today arrived one of those devices so i could debug it, but i just can't reply that crash while on the clients devices it happens often...
Here is my manifest permissions if they can be useful (WAKE_LOCK is in)
<uses-permission android:name="android.permission.REORDER_TASKS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission
android:name="android.permission.CAMERA"
android:required="false" />
<uses-feature android:name="android.permission.camera" />
<uses-feature android:name="android.permission.camera.focus" />

How to fix "Game Crush because of java.lang.Error: FATAL EXCEPTION "?

After I uploaded my game to the Play Store my game crashed on a device showing java.lang.Error: FATAL EXCEPTION The game is developed on Unity Version: 2018.3.0f2.
java.lang.Error: FATAL EXCEPTION [Thread-296]
Unity version : 2018.3.0f2
Device model : samsung SM-J600FN
Device fingerprint: samsung/j6ltexx/j6lte:9/PPR1.180610.011/J600FNXXU3BSD2:user/release-keys
Caused by
at ly.b (com.google.android.gms.policy_ads_fdr_dynamite#20290003#20290003.249178941.249178941:2)
at lx.a (com.google.android.gms.policy_ads_fdr_dynamite#20290003#20290003.249178941.249178941:1)
at lz.a (com.google.android.gms.policy_ads_fdr_dynamite#20290003#20290003.249178941.249178941:29)
at com.google.android.gms.ads.internal.util.aq.a (com.google.android.gms.policy_ads_fdr_dynamite#20290003#20290003.249178941.249178941:10)
at lc.a (com.google.android.gms.policy_ads_fdr_dynamite#20290003#20290003.249178941.249178941:8)
at lc.run (com.google.android.gms.policy_ads_fdr_dynamite#20290003#20290003.249178941.249178941:2)
Caused by: java.lang.ClassNotFoundException:
at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass (ClassLoader.java:379)
at ab.loadClass (com.google.android.gms.dynamite_dynamiteloader#17455079#17.4.55 (100306-248795830):4)
at java.lang.ClassLoader.loadClass (ClassLoader.java:312)
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.unity.ads"
android:versionName="1.0"
android:versionCode="1">
<uses-sdk android:minSdkVersion="14"
android:targetSdkVersion="19" />
<application>
<meta-data
android:name="com.something.something"
android:value="something"/>
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
</manifest>

First time audio recoding permission get issue

java.lang.RuntimeException: setAudioSource failed.
11-07 20:30:16.294 12438-12438/com.main.sample W/System.err: at android.media.MediaRecorder.setAudioSource(Native Method)
11-07 20:30:16.294 12438-12438/com.main.sample W/System.err: at com.main.sample.Activity.EventsaddActivity.initializeMediaRecord
In the first step you need to add these permissions:
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
set target sdk to 22 or use request permission and set target to 23 or above.
and check your path again
MediaRecorder.setAudioSource(new File("YOUR_PATH"));

SQLiteCantOpenDatabaseException after upgrading to Android 6 (Marshmallow)

I have an application in the PlayStore, and some users reported that it no longer worked after they updated their phones to android 6. The stack trace associated to the reports is the following
java.lang.RuntimeException: Unable to create application ar.com.package.android.MyApp: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4731)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Caused by: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:207)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:191)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:806)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:791)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)
at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:571)
at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:269)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:223)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163)
at com.activeandroid.Cache.openDatabase(Cache.java:106)
at com.activeandroid.Cache.initialize(Cache.java:75)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:44)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:34)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:30)
at com.activeandroid.app.Application.onCreate(Application.java:25)
at ar.com.package.android.MyApp.onCreate(MyApp.java:33)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1036)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4728)
Obviously the problem is related to ActiveAndroid (which I use in this app) not being able to open the database, but I wasn't able to reproduce the error as the conditions for it are very specific (Installing the app in a lolipop phone > updating the phone to marshmallow). A clean install on marshmallow works perfectly.
My first tought was the new permissions system in marshmallow, but as far as I tested I didn't find any problem with that. Just in case, here is the list of permissions:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
If anyone has an idea of what could the problem be, that would help me a lot.

Categories

Resources