-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin not working on Android 13 with cordova [email protected] #256
Comments
This is fixed but not released yet, see #238 |
@jcesarmobile I think the main issue reported here is slightly differnet from PR #238. I did some investigation a few weeks ago and never figured it out, until I read the in-code comment:
There is actually quit a few issues: Issue 1: Both methods calls Issue 2: Issue 3: It seems to be related to the fall back to the Android 12 Splash Screen. new Thread(() -> {
try {Thread.sleep(3000);} catch (InterruptedException e) {e.printStackTrace();}
activity.runOnUiThread(() -> {});
} Basically if I wrap the code with a delay, as shown above, then it works as expectetd. The splashscreen is about 3 seconds give or take. But there are cases where people could lock the splashscreen longer during loading, or it ends faster. Obviously a delay is not the solution. It was just apart of the example to identify the timing issue. It seems the settings are not applied while the Spalsh Screen is visible or applied to the wrong Activity. Once the Splash Screen is hidden, the statusbar appears to be default to what was defined in I am not sure how we would go about setting the proper timing to execute the |
The issue is about StatusBar.styleDefault(); not working, that is fixed in master but not released. preferences not working are related to the splash screen animation listener, I sent a PR two weeks ago that would allow to disable the animation listener when FadeSplashScreen is false. |
OK I just reviewed and approved the apache/cordova-android#1506 PR. What happens if they configure the SplashScreen fade? Wont it just cause the StatusBar preferences not working again? |
yeah, it's more like a workaround than a real fix, but I don't think it can be fixed, looks like just another Android bug with the new Splash Screen that only Google can fix. |
I was wonder if we could dummy down the plugin to build the xml theme overrides instead of doing things logicially? <resources>
<style name="Theme.Cdv" parent="Theme.AppCompat.NoActionBar">
<item name="colorPrimary">@color/color_primary</item>
<item name="colorPrimaryDark">@color/color_secondary</item>
<item name="colorAccent">@color/color_accent</item>
<item name="android:statusBarColor">@color/color_primary</item>
</style>
</resources> Not sure if this would work, but I had a feeling that when the Splash Screen complete, it changes the Activity theme back to the defined Obviously, if the end-user decides to change the |
That might fix the statusbar background/text color, but the Also, I wouldn't make the statusbar plugin edit the themes, I think that should be part of cordova-android (if it isn't already) and we could document it on the splash screen preferences as Android 12+ quirks. (it also affects Android 12 when launched from the app icon) |
Yeah, I dont think the theme is ever configured by us. Also I think we might be eventually integrating the StatusBar plugin into core of each platform... This type of change could come at that moment maybe.. |
I found a solution! ..or rather a workaround. 1. Add this to
2. Create
|
Okay damn, this way I cannot change the color of the status bar text via JavaScript. I use something like this:
...because my app has a dark and a light mode. If the user changes the mode, the app needs to change the status bar text color via JavaScript. |
Bug Report
First of all, a big thank you to everybody contributing to Cordova <3
Problem
If I add the android platform via
cordova platform add [email protected]
, the plugin does not work on Android Studio's Simulator with Android 13.What is expected to happen?
I am using the following code in
index.js
to get a transparent status bar that randomly changes text color every 1s (just to test the plugin):This works in the simulator for the following Android versions:
API 32 - Android 12
API 30 - Android 11
API 29 - Android 10
API 28 - Android 9
API 27 - Android 8.1
API 25 - Android 7.1.1
What does actually happen?
..but it doesn't work for "API 33 - Android 13". Instead the status bar just stays the default white text on black background.
Information
I'm in a 100% clean project from
cordova create hello com.example.hello HelloWorld
as per the Docs.If I add
[email protected]
instead of[email protected]
, the plugin works on Android 13 just like on the other virtual device.Environment, Platform, Device, Version information
cordova-plugin-statusbar 3.0.0
Cordova Android 11.0.0
Cordova CLI 11.0.0
Android Studio Dolphin | 2021.3.1
macOS Monterrey 12.6
Some more info from
cdv-gradle-config.json
:The text was updated successfully, but these errors were encountered: