SecurityException after Permission has been used

I am having a serious issue with my app. I use the permission android.permission.ACCESS_COARSE_LOCATION in a broadcast receiver and it runs perfectly.

However after a certain amount of time (this seems to be random) the app crashes with the following output:

SecurityException neither user 10086 nor current process has permission android.permission.ACCESS_COARSE_LOCATION

I have included the permission in the Manifest using <uses-permission etc /> and as a attempt to make it more specific when I sendOrderedBroadcast I broadcast the permission as well and have given the permission to the broadcast receiver so that it can receive the broadcast which is does.

But like I say after a while the SecurityException is thrown at the second line of code:

TelephonyManager Tel = (TelephonyManager) vb.getPsrC()
GsmCellLocation cellLocation = (GsmCellLocation) Tel.getCellLocation();

This crash seems to only occur on a test device running Froyo.

On a device running Gingerbread, the app just restarts the service using less memory and does nothing. are these problems related or is the Security Exception mutually exclusive to the app crashing.


Ok, so turns out the culprit is a memory leak. When GREF reached 2001 it crashed and basically emptied it (for lack of a better phrase) causing the app to think that the permission was not given. I fixed it moving the phonelistener into the service.

Need Your Help

Stepping through all permutations one swap at a time

iterator permutation swap

Given a list of n distinct items, how can I step through each permutation of the items swapping just one pair of values at a time? (I assume it is possible, it certainly feels like it should be.)

Relative URLs within sub application on IIS site iis iis-7.5

I have "test" website on IIS and "sub1" sub-application within it.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.