Skip to content Skip to sidebar Skip to footer

How To Handle Securityexception Thrown Back From Startactivity With Chooser?

I'm using final Intent notice = new Intent(); notice.setType('text/plain'); notice.putExtra(Intent.EXTRA_SUBJECT, 'My Subject'); notice.putExtra(Intent.EXTRA_TEXT, 'My Text'); tr

Solution 1:

But, there are some applications, if chosen by the user, that will crash the application with a SecurityException, as the current application does not have enough privileges to send the intend

That's a bug in the other app. No app should support a generic Intent action like ACTION_SENDand require a custom permission. I really recommend you write this up and post it to http://b.android.com, with whatever other information you can supply to reproduce this error. I'm not sure what app it is you ran into (the package suggests perhaps Gmail), but it's clearly a Google-produced app.

I don't want to add the missing permission to the manifest (I don't know which other applications will show up in the chooser)

Not to mention that the permission in question is not in the SDK.

but simply handle the SecurityException and notify the user. Where would I do so?

The key question is: is this exception actually occurring in your process?

If the answer is yes, then Thread and setDefaultUncaughtExceptionHandler() will be where you find out about the problem. You may already using this to tie in a crash reporter (e.g., ACRA).

If the answer is no, then you are out of luck.

Post a Comment for "How To Handle Securityexception Thrown Back From Startactivity With Chooser?"