Android: Is it a good practice to define custom permission for an activity which has intent filters?

做~自己de王妃 提交于 2019-12-24 10:24:20

问题


I have an app in which an activity is supposed to be started by deep links in messages. Should I define custom permission for that activity so that malicious service/apps cannot call it? I am not sure if this is a good practice. Any help would be appreciated.

Thanks in advance.


回答1:


Should I define custom permission for that activity so that malicious service/apps cannot call it?

Probably not. If the activity will only ever be started by your code, get rid of the <intent-filter>. If, on the other hand, the activity is supposed to be started by something else, that "something else" will not request your custom permission, and so it is guaranteed to fail to start the activity.



来源:https://stackoverflow.com/questions/44334915/android-is-it-a-good-practice-to-define-custom-permission-for-an-activity-which

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