Some Android phones don't do anything when the the code below is ran. It's supposed to open the "About device" page in Settings.
For example, I know for a fact that it has no effect on the Huawei Y9 Prime 2019 running Android 10.
startActivity(new Intent(Settings.ACTION_DEVICE_INFO_SETTINGS));
What's the best way to safeguard against this issue when it occurs? (In my app, I open this page to ask the user to perform a specific action there)
Clear Settings' Cache Step 2: Select App info to open a list of all apps installed on your device. Step 3: Scroll to the bottom of the screen and select Settings. Step 4: Next, select 'Storage & cache'. Step 5: Tap Clear cache.
Method 1: Restart your Android phone Most of the time, a simple restart will solve the problem for you. You can either switch off your phone and then turn it back on again, or you can simply tap on the restart option and wait for your phone to reboot.
Use PackageManager.resolveActivity()
to check whether such an Activity
exists. If that returns null
, there is no activity that matches the Intent
and you have to guide your customers to the settings in another way:
Intent intent = new Intent(Settings.ACTION_DEVICE_INFO_SETTINGS);
ResolveInfo resolveInfo = getPackageManager().resolveActivity(intent, 0);
if (resolveInfo == null) {
// help customers by describing how to get to the device info settings
} else {
startActivity(intent);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With