Skip to content
Discussion options

You must be logged in to vote

Here's the complete MainActivity.java I came up with:

It combines the FORCE strategy (where supported) and a CSS class based fallback for pre Android 10.
Also, the additional onResume takes care of applying system settings changes after resuming the app.

package io.github.eyecatchup.example;

import android.os.Bundle;
import android.content.res.Configuration;
import android.webkit.WebSettings;

import com.getcapacitor.BridgeActivity;
import com.getcapacitor.Plugin;

import java.util.ArrayList;

public class MainActivity extends BridgeActivity {
  void setDarkMode() {
    // Android "fix" for enabling dark mode
    // @see: https://github.com/ionic-team/capacitor/discussions/1978
    int n…

Replies: 19 comments 37 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
9 replies
@msimkunas
Comment options

@ericgopak
Comment options

@stefanhk31
Comment options

@JuanDeLeon
Comment options

@stefanhk31
Comment options

Comment options

You must be logged in to vote
4 replies
@craneo2099
Comment options

@jcesarmobile
Comment options

@gnarrrl
Comment options

@vt-vaio
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@hinddeep
Comment options

@cmaas
Comment options

@hinddeep
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
10 replies
@jlorenzoC
Comment options

@tolutronics
Comment options

@chrisspiegl
Comment options

@eyecatchup
Comment options

@chrisspiegl
Comment options

Answer selected by danielsogl
Comment options

You must be logged in to vote
1 reply
@avalanche1
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@riderx
Comment options

Comment options

You must be logged in to vote
3 replies
@riderx
Comment options

@robingenz
Comment options

@riderx
Comment options

Comment options

You must be logged in to vote
6 replies
@nunoarruda
Comment options

@robingenz
Comment options

@Frtrillo
Comment options

@robingenz
Comment options

@Frtrillo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
Converted from issue

This discussion was converted from issue #1978 on June 09, 2020 21:07.