So i have this app that i’m working on for a few months now, and i used to test it on my Samsung Galaxy S8. The problem i have presents itselft since i received the update to Android Pie (version 9, sdk 28). The app is written in Angular 7.
Basically whenever a pop-up that is not part of the ionic app needs to come on screen, the app crashes, without any log errors. The pop-ups can be for example the runtime request permission confirmation, or the login form autocomplete feature (native of android).
Opening the generated android project in android studio and debugging it turns out that the cause of the crash is the FOREGROUND_SERVICE permission not granted to the app. As stated from google release note beheaviouor changes page any app that targets Android 9 or higher and use foreground services must request the
Android studio debug logcat:
Adding the following rule to the config.xml:
<preference name="android-targetSdkVersion" value="27" />, and running the app on the same device (android 9) results in the following error:
Even using the cordova-plugin-android-permissions to request at runtime the aformentioned permission ends having the same problem, the app crashes. (tough to test it i actually had to edit the permissions array in the ionic-native npm module, since it’s not even there, i guess beacuse it’s a normal level permission that shouldn’t need user action to be granted).
I also tested the app on a Xiaomi MI A2 Lite with android 9 on it, and the behaviour is the same. Testing it on another samsung phone, with android 8 still on it, it works as expected, no problems whatsoever.
I searched the web a lot for a solution to this, but i wasn’t able to find any valid resource.
I’m not sure what i should do now, i can’t get the app to work properly on Android 9 devices.
Thank you in advance for any help in this matter