fix(android): center spinner position on Android 9
Platforms affected
Android
Motivation and Context
Fixes #184
Description
Android 9 changed the position of the ProgressDialog. This restores the same behavior of previous Android versions where the ProgressBar (and Dialog) is centered on the screen.
Testing
cordova create app cordova platform add android cordova plugin add https://github.com/bozzaj/cordova-plugin-splashscreen cordova run android --device
Verified that the spinner was centered on the screen.
Checklist
- [x] Commit is prefixed with
(platform)if this change only applies to one platform (e.g.(android)) - [x] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
Can you confirm my understanding?
So the spinner is positioned fine (centered on screen) on android 8 or below, and as of android 9, this has changed and this is what this PR addresses?
That's correct. Existing behavior on Android 9 and above has the spinner showing at the bottom of the screen. This simply restores consistency with Android 8 and below, without any new functionality or change to past behavior.
Installing older simulators. Might be awhile since I'm not at home, and my gf's internet sucks...
I am unable to reproduce this with android 9 or 10 emulators.
Android 8.1, 9, and 10 all produce the loading spinner in the center of the screen for me. Is it possible this has already been addressed? Or maybe it's specific to a device?
Ok, I startup up the x86 emulators and was not able to duplicate either with the a test app:
- using [email protected]
cordova create test-app
cd test-app
cordova plugin add cordova-plugin-splashscreen
cordova platform add android
cordova run android
The only addition I made to the test app was to insert the line:
navigator.splashscreen.show();
to the js/index.js file, just so the splash screen would stay up.
However, running the same app on a Samsung Galaxy Tab Active 2 (Android 9) and a Samsung Note 10+ (Android 10), I get the issue. I also tested a Galaxy Tab A (2018) with Android 9. I don't have any non-Samsung hardware with Android 9+ available to me today, but I'm pretty sure I can run the test with a couple of different non-Samsung devices tomorrow and provide screenshots if need be.

I've been able to test a OnePlus 7 Pro device with Android 10 and it functions like the emulators with no issues. Applying my fix, I tested on the emulators as well as all the above devices and it fixes the issue for the Samsung devices and does not change anything for the other devices.
Okay, i have an actual Samsung device running android 9 that i will use to test. I just want to confirm the problem, then I'll confirm the fix.
I unfortunately can't do that right now, but I'll try to do it sometime this week.
Can this please be reviewed and/or merged? I'm observing the same behavior and would love to see it fixed in the master branch.
Why is this not merged yet?
Because we didn't have time yet to test this change and ensure it does not break older devices and works as intended.
Is there any ETA? Would love for this to be fixed.
On my OnePlus devices with Android 11 the spinner is in the center as well. I think Samsung might have some vendor specific things on their Android.
Is this really a bug?