Which Intent for Settings - Data usage

匿名 (未验证) 提交于 2019-12-03 01:54:01

问题:

I spent several hours by searching correct Intent for launching Data usage Activity in Android Settings. Unfortunetly i found nothing (on web and also here).

I also tried reflection (in a case of private field) but also without result. I will be glad for any help.

Thanks in advance.

回答1:

Try...

Intent intent = new Intent(); intent.setComponent(new ComponentName(             "com.android.settings",             "com.android.settings.Settings$DataUsageSummaryActivity")); startActivity(intent);

This worked for me. I found it from the link to data usage in the KitKat QuickSettings source code.



回答2:

If you take a look at Android Settings manifest file and find activity section named "Settings$DataUsageSummaryActivity", it doesn't seem like it has an intent for being launched. Its intent filter has only one action tag(MAIN).

In Settings/AndroidManifest.xml,

 ...

As you can see in this code, there is no custom action intent defined here.



回答3:

Take a look at Android Intents. They are talking about a ACTION_MANAGE_NETWORK_USAGE Intent.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!