开发者

create a permissions to restrict third party apps calling an activity android

I am having two android apps signed with same certificate. Also i am using the activity of one app in other android app by specifying a name in "intent-filter" tag. But because of "intent-filter" tag any third party app can call my activity.

Since both the apps are having the same certificates signed开发者_开发百科, can i restrict other apps calling my activity by providing some permisions? Any suggestions on this would be helpful to me.

-Ron...


First you could maybe remove the intent-filters if your activity is not meant to be used by other applications than yours ; why not use an explicit intent instead? Thus your activity couldn't be created "by mistake" but only intentionally, ex :

Intent explicitIntent = new Intent(InvokingActivity.this, InvokedActivity.class);
startActivity(explicitIntent);

Then, to even prevent that from the outside, you could define your own custom permission and add it to your activity ; have a look at the android:protectionLevel attribute of a permission, whose value can be "signature".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜