Location services control from iphone app - iphone

I installed an application from app store that uses gps. I have only put the app on install and it itself was added to the location services with button turned on. Whereas my r&d regarding turning location services on from my iphone app results that i cannot do it directly from my code. Can anybody explain this situation and answer me that whether the app can set location services at install time or is it something else

you cannot change the location services settings from your code.
when you first install/launch the app, it is the OS who ask for the usage of location services from User - not your application when your app just start code to find location.
User is given privilege to enable/disable location services usage for the app - as per apple policy.

Related

How do I get notified when user starts messaging or mailing app in iOS

Actually I want to build such a iOS app which will give alert if user start sms application or messaging application when he is driving more than certain speed limit. As I am new in iOS development I don't know whether it is feasible or not?
Basically my id:
Q: How do I get notified when user starts messaging app?
Due to iOS sandboxing restrictions, you cannot get any information from your app regarding launching or usage of any other apps.
The only way to do this would be if you were the developer of both apps. In that case you could use an external server to log when each of the apps is launched and then get this information from the converse app.

Required Background Mode for location not re opening app after reboot

We are trying to develop an application similar to an existing app currently in the app store.
This app is sending location data in the background to a web service, and the app will continue to run following a reboot of the device. I will also note, that following the app being installed and registered, the location services indictor remains constantly on the status bar. I am assuming this is necessary to allow the app to continue to run following a the device being restarted.
We have tried using the "UIBackgroundModes/required background modes for location", and have been unsuccessful in having the app continue to run following a reboot of the device.
Can someone please point us in the right direction as to how to have the app continue to send location data following a device reboot.
Thank you very much!
No app will run following a device reboot. It is not possible to build a file daemon under Apple's SDKs. You'd have to jailbreak the phone and run unauthorized stuff to do so, then you wouldn't be accepted into Apple's app store.
Yes your app will be restarted if your are monitoring significant location changes or monitoring a region and that region is entered/exited.
In iOS 7 Apple made an important change that will disable these mechanisms if a user force quits your app. They will remain disabled until the user starts your app again.

Can i hook into significant location change service so that i can track a Phone latest location?

i would love to build a auto-start with OS app which runs in IOS background(like a daemon) and when the phone changed its location the app send some information(userid,GPS,time......)to a web server immediately, in addition to,i want my app has no icon and users can not easily find it is on running or easily delete it. so i just wondering if these is some location-change notification i can hook into so that i can perform my code? anyone give me a good idea? i dont want put my app on appstore instead of i packaged it in deb,so i can use any private api or other non-official methods....
You can use CoreLocation native framework.we can access the current location of the user/device dynamically. follow the link for instructions coreLocation tutorials
According to Apple's Documents and guidelines, I don't think an app can exist without icon. The SDK doesn't have this feature as well. And no private API will be accepted into App Store. However, you can post your project on unofficial AppStores for jailbroken phones.

how to programmatically enable Location service for my application on iPhone

how to programmatically enable Location service for my application on iPhone.
I don't want the warning window to show up and ask me.
You are not allow to use user location without his agree. And the window is presented by the os. So if you want to do this you have to use private apis and your app will be rejected from the store.
Like Terente says, you can't do this if you want to distribute your app through the app store.
If you aren't trying to do that, take a look at how KIF does it. The relevant code is in the _enableAccessibility method, at https://github.com/kif-framework/KIF/blob/master/Classes/KIFTestActor.m#L47

Is there a way to re-trigger asking the user if the iPhone can use their current location?

For some reason, my iPhone app doesn't ask the user for permission to use their current location when the app is installed from the App Store. Because of this, my app's location-based functionality doesn't work. I'd like to catch the error and re-trigger the functionality that asks the user for permission to use their current location.
Is there a way to re-trigger asking the user if the iPhone can use their current location?
No, this is a bug in iOS 4.1, you'll just have to wait til iOS 4.2 is out and re-release your app.
They most likely have location services completely turned off in Settings or even have it off just for your application.
You can use:
[CLLocationManager locationServicesEnabled]
to check this and alert the user or track it for your own purposes. Core Location should ask the user to enable Location Services in the case of the first scenario. If the second scenario is happening, then there is nothing you can do except tell the user to turn on location services for your app.
There is really nothing you can do programmatically outside of the CLLocationManager handling all of this for you.