Android Usage Access for Android 5 Samsung devices

不问归期 提交于 2019-11-28 08:11:41
Erik Minarini

Sorry for the late reply, I hope you have found a good solution, but if not or for other people who have this problem,

this bug seems to exist in some Samsung models, to avoid the crash of your app, maybe you can check if your intent can be handled

PackageManager packageManager = getActivity().getPackageManager();

if (intent.resolveActivity(packageManager) != null) {
    startActivity(intent);
} else {
    Toast.makeText(getBaseContext(), "Please open settings, your model can't be forced 
                          to open it", Toast.LENGTH_LONG).show();
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!