开发者

Android: security exception with launchMode="singleTask"

I have declared the launch mode of my activity to be singleTask. If I launch my application, press the home button, go to an email client (gmail in this case) & preview an attachment using my application, I am experiencing a security exception on Android versions 2.3 & later, which says that I do not have the permissions to access gmail attachments. The exception does not occur on prior versions & if I do not use singleTask as the launchMode.

The exception occurs on this line-

mContext.getContentResolver().openInputStream(intent.getData());
开发者_高级运维

where mContext is the activity context.

Is this a known issue?

Any help will be really appreciated.

Thanks,

Akshay


I had posted this on Android-developers and got this response from Dianne Hackborn-

"Sorry, this is probably a bug in 2.3 with trying to grant a URI permission to an activity instance that is already running. I'll look in to this. In the mean-time, the only solution may be to not use singleTask for the activity being launched to a preview an attachment. This is actually the preferred thing to do, since your preview activity should be running as its own instance as part of the gmail task."


The problem might happen because the called intent's activity in the 2.3 implementation does not fit the launchMode:"standard" or launchMode:"singleTop" requirement stated in the android:launchMode description.

But it would be also useful to take a look at this issue: Behaviour of launchMode=“singleTask” not as described. It is scary, hopefully your problem isn't rooted there, and can be solved within the current versions.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜