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

Crash on Android 10 (InflateException in layout/abc_screen_simple line #17)

Update Calligraphy to newest version to solve this problem: Link: https://github.com/InflationX/Calligraphy/issues/35 More specifically, both Calligraphy and ViewPump need to be updated: implementation ‘io.github.inflationx:calligraphy3:3.1.1’ implementation ‘io.github.inflationx:viewpump:2.0.3’ Migrating from Calligraphy 2 to 3 requires some code changes; see examples in Calligraphy 3 README.

How to show daily offline notifications in Android 10?

I can see one possible issue, and it’s possible to do this without the workmanager (assuming the device has a healthy connection at the time the notification runs). Instead of doing your network in the receiver itself, I suggest starting a service (foreground service if above Android 8.0), and doing your work there. This is … Read more

Turning on wifi using WifiManager stops to work on Android 10

public boolean setWifiEnabled (boolean enabled) This method was deprecated in API level 29. Starting with Build.VERSION_CODES#Q, applications are not allowed to enable/disable Wi-Fi. Compatibility Note: For applications targeting Build.VERSION_CODES.Q or above, this API will always return false and will have no effect. If apps are targeting an older SDK ( Build.VERSION_CODES.P or below), they can … Read more

boot_completed not working on Android 10 Q API level 29

I know that this may be old but I have faced the same problem and according to this: https://developer.android.com/guide/components/activities/background-starts The easiest solution I came up with was simply adding <uses-permission android:name=”android.permission.SYSTEM_ALERT_WINDOW”/> And setting up the receiver: <receiver android:name=”.BootReceiver”> <intent-filter> <action android:name=”android.intent.action.BOOT_COMPLETED” /> </intent-filter> </receiver> To the manifest. Receiver code: @Override public void onReceive(Context context, Intent … Read more

“Unknown bits set in runtime_flags: 0x8000” warning in Logcat on Android Q emulator

I bring a stone to the building. I retrace the code for the error message. It is at line 345 in the C ++ file dalvik_system_ZygoteHooks.cc At a minimum, if (runtime_flags! = 0) then the error message will be printed. 0x8000 also corresponds to the USE_APP_IMAGE_STARTUP_CACHE flag (see line 157). The test on the USE_APP_IMAGE_STARTUP_CACHE … Read more

Rename file of the Mediastore which is created by app in android 10. Working on Android API 30 but shows error in API 29

java.lang.IllegalArgumentException: Movement of content://media/external/file/116 which isn’t part of well-defined collection not allowed So it is for Android Q not allowed if you use the collection; Uri extUri = MediaStore.Files.getContentUri(MediaStore.VOLUME_EXTERNAL); But is is allowed for a ‘well-defined collection’ like: Uri extUri = MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL); // Use “Pictures/MyFolder” for RELATIVE_PATH I leave it to you to find other … Read more

Accessing external storage in Android API 29

On Android 10 Environment.getExternalStorageDirectory() and Environment.getExternalStoragePublicDirectory() will return storage paths but paths are not readable or writable. For Android 10 you can continue to use paths provided by Environment.getExternalStorageDirectory() and Environment.getExternalStoragePublicDirectory() if you add android:requestLegacyExternalStorage=”true” to application tag in manifest file. At runtime your app can call Environment.isExternalStorageLegacy() to check if the request has been … Read more