well, I guess the question says it all
I’m open to using Private API’s, I’m trying to create an app which, if it detects a certain GPS: location the camera functions should self disable. . . .
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Note: this solution doesn’t use
UIImagePicker. I’m assuming you’re referring to the built-in Camera.app, and just want some way to disable it.If you are willing to jailbreak your device (which I read in your comments), then you should be able to do this.
First, you’ll need to write an iOS Launch Daemon. This is a background process (no UI) that simply runs all the time, and monitors location. See the blog for an example of how to write a launch daemon. This example even shows a daemon that monitors location, which is what you’ll need.
Then, when your daemon detects that you’re in the special location, you could just change the executable permissions on
/Applications/Camera.app/Camera. Make it not executable (chmod 664instead of775).Invoke the
chmodcommand from your app by making a system call:Or, you could probably also use the
NSFileManagerAPIs to modify the permissions attributes on the file.Of course, you’ll need to change permissions back when you leave the area (you might want to make the app conservative, so that if no location data is available, after a timer delay, you re-enable the Camera).
I believe the daemon tutorial I linked to above will setup your daemon to run as the root user (userid = 0), which is probably necessary to have permission to change the Camera executable permissions. If not, post a reply, and I’ll dig up more information. I have multiple daemons running on my phone (that I wrote a while ago), and they do have root privileges, so I must have figured out how to do it 🙂
Also, as Owen said, Location Services might be turned off, or a location fix might be unavailable. I’m not sure if this app is just for you, to remind you not to take pictures in a certain location, or if it needs to be secured against other users, who will try to defeat the protection. If this is an issue for you, post some more information and we’ll go from there …
Note: I’m not sure if this also needs to disable the Camera if it’s already running before you enter the no-pictures-zone. If so, you could have your daemon also issue a
killcommand on the Camera process.