Making your application’s data usage preferences available from system settings

Android 4.0+ gives users the ability to monitor the amount of mobile data being used on their device, and in some cases, automatically turn off mobile data.
You can access the Data Usage settings screen by opening the Settings app, and then selecting Data Usage.

In Android 4.0+ if you create a Preference Activity to allow users to modify your application’s data usage, you can make it available from within the system settings when a user inspects your application’s data usage.

It is very simple: just add a MANAGE_NETWORK_USAGE Intent Filter to the Preference Activity’s manifest node:
<activity android:name=".PreferencesActivitySummary" android:theme="@style/AppThemeABS">
         <action android:name="android.intent.action.MANAGE_NETWORK_USAGE"/>
         <category android:name="android.intent.category.DEFAULT" />
Once set, the View Application Settings button in the system settings will launch your Preference Activity, allowing users to refine your application’s data usage rather than restricting or disabling it.

Popular posts from this blog

Expand and collapse animation

Android-5: Card and images with rounded corners in Android 4

NotificationListenerService and kitkat