Is there an API to detect which theme the OS is using – dark or light (or other)?

Google has just published the documentation on the dark theme at the end of I/O 2019, here. In order to manage the dark theme, you must first use the latest version of the Material Components library: “com.google.android.material:material:1.1.0-alpha06”. Change the application theme according to the system theme For the application to switch to the dark theme … Read more

Download Manger not working in Android Pie 9.0 NetworkSecurityConfig: No Network Security Config specified, using platform default

This worked for me After Xiaomi mi A2 received software update notification today. what worked for me Add android:networkSecurityConfig=”@xml/network_security_config” in application tag <application android:name=”.ApplicationClass” android:allowBackup=”true” android:hardwareAccelerated=”false” android:icon=”@mipmap/ic_launcher” android:label=”@string/app_name” android:largeHeap=”true” android:networkSecurityConfig=”@xml/network_security_config” android:supportsRtl=”true” android:theme=”@style/AppTheme”> where network_security_config.xml <?xml version=”1.0″ encoding=”utf-8″?> <network-security-config> <base-config cleartextTrafficPermitted=”true” /> </network-security-config> Create xml under res directory and then network_security_config.xml in xml folder like in … Read more

Android design support library for API 28 (P) not working

You can either use the previous API packages version of artifacts or the new Androidx, never both. If you wanna use the previous version, replace your dependencies with dependencies { implementation fileTree(include: [‘*.jar’], dir: ‘libs’) implementation “org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version” implementation ‘com.android.support:appcompat-v7:28.0.0-alpha3’ implementation ‘com.android.support.constraint:constraint-layout:1.1.1’ testImplementation ‘junit:junit:4.12’ androidTestImplementation ‘com.android.support.test:runner:1.0.2’ androidTestImplementation ‘com.android.support.test.espresso:espresso-core:3.0.2’ implementation ‘com.android.support:design:28.0.0-alpha3’ implementation ‘com.android.support:cardview-v7:28.0.0-alpha3’ } if you want … Read more

How to allow all Network connection types HTTP and HTTPS in Android (9) Pie?

The easy way to implement this is to use this attribute to your AndroidManifest.xml where you allow all http for all requests: <application android:usesCleartextTraffic=”true”> </application> But in case you want some more configurations for different links for instance, allowing http for some domains but not other domains you must provide res/xml/networkSecurityConfig.xml file. To do this … Read more