How to enable “Transition Animation Scale” in “Developer Options” programmatically ?

百般思念 提交于 2019-12-05 13:49:22
Milad Faridnia

After a few days searching I have found the code which can enable (or disable) "Transition Animation Scale".

        Settings.Global.putInt(getContentResolver(), Global.TRANSITION_ANIMATION_SCALE, 1);

But there is a big problem with this code And if you ask whats the problem? I would tell this line of code needs this permission:

<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>

which is only granted to the system Apps. So your app must be a system app.

This question is about making a system application : How to make my application system

UPDATE

and as @TripeHound said, we can

Display a dialog telling the user that the app will look much nicer if they turn this option on (with an option to not display the message again if they really want it off)

How to open developer options settings?

This way:

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