0

In my app, I am trying to use Android's Settings.ACTION_DATA_USAGE_SETTINGS intent to open the device's Data usage screen.

The documentation for Settings.ACTION_DATA_USAGE_SETTINGS says:

Activity Action: Show settings to allow configuration of data and view data usage.

In some cases, a matching Activity may not exist, so ensure you safeguard against this.

I can obviously catch the exception but, when in that situation, is there another intent I can use to open the device's Data usage screen?

(NB - I have seen this similar question, but none of the suggestions work for me.)

ban-geoengineering
  • 18,324
  • 27
  • 171
  • 253
  • Not in general. There is no requirement for a device to have such a screen, let alone provide an `Intent` for apps to get to it. – CommonsWare May 01 '19 at 14:26
  • Some OEMs just don't follow AOSP thoroughly, you must implement per-brand workarounds in that case. – Pawel May 01 '19 at 14:27
  • I forget to add, my device (Samsung Galaxy Core Prime) does have the *Data usage* screen. Is it possible to detect which devices don't provide this intent when my activity starts - so, if there's no workaround, I can then hide the button on such devices? – ban-geoengineering May 01 '19 at 14:30
  • 1
    You can use `PackageManager` and `queryIntentActivities()`, or `Intent` and `resolveActivity()`. – CommonsWare May 01 '19 at 15:50

0 Answers0