Delegating something to the OS [duplicate] - iphone

This question already has answers here:
If background applications can't launch automatically how does Cardcase launch on a location change?
(2 answers)
Closed 9 years ago.
I was wondering if it is possible to tell the iphone operating system to lauch my application when I enter a particular region...If it is how can I do it?
Thank you

This will happen automatically for region monitoring - Once your application has registered for region monitoring (while it was running) and then gets suspended or stopped, and then if the region is crossed even when you app is not running the app is re-launched in the background to handle that event, from there you can post local notifications etc to alert the user and bring the app to foreground if the user is interested.
See reference to the Apple documentation here

No, your application can't launch itself for any reason.
You can, however, use background location and background local notifications to alert the user and allow them to opt to open your app.

Related

Event While deleting the app from iPhone [duplicate]

This question already has answers here:
How to catch application uninstalling on device and let server know about this (iOS/Android)
(2 answers)
Closed 9 years ago.
I wish to hit a web service, whenever a user deletes the app from his/her device. Its just to delete that user from Db. Can anybody here help me?? Thanks In Advance..
Generally speaking, what you are attempting is probably not advisable. Even if it were possible to know when a user has deleted the app, how would you handle the situation where the user then re-installed the application and launched it? You also do not know why the user has deleted the app (perhaps they only wish to do so temporarily to free up space on their device? Perhaps their device was stolen and they are re-installing into a new, or upgraded device?)
If you separate your concerns (client has/does not have mobile app, vs client has/does not have active account) you can manage all these scenarios in a much more robust way.
Using an in-app analytics package (like Google Analytics, Parse or Flurry to name just a few) will give you insight as to your user behavior, and perhaps based on this usage data you can trigger handlers. For example, if you see a user has not used your app in a certain period you can email them or send a push notification to remind them? Perhaps you could email them to notify them "You have not logged in in 60 days, if you do not use your account within the next 30 days it will be deleted. Click here to re-activate your account."
No, can't do. There is no defined notification when an application is deleted. If you must talk to a server, suspend inactive accounts after a predefined time limit.
One other thing you can try is check for the UIApplicationWillTerminateNotification notification. Save the state of your app on your servers when it's transitioning to the background and cross your fingers your user will not delete your app when it's not running. Because once your app closed, you don't have any control anymore. Thats the iOS behavior till iOS 6.
There is no way you could know whether the app is deleted from device or not because no delegate method fires when the app is deleted.
Hope it helps you.

can i get location with GPS while my application is closed?

I've seen application on iphone called "moves"
the gps is running on background while the application is totaly closed and not working in the background.
how can i get the location of the user and send it to the application while it is closed and not working on background? how could this possible?
what is the function to do that?
thanks
It is possible to get the location while the phone is running in the background (The Google Maps app does this), however running a background thread is a privilege that you must justify to Apple in their review process.
Here is some documentation by Apple for guidelines for running in the background
You register for the significant-change location service.
According to the Apple docs:
If the app starts this service and is then terminated, the system relaunches the app automatically when a new location becomes available.
This is not possible for an App on a non jailbraked iphone. Check again what you really have seen.
Apps can run in the background and get locations. But an app which is closed, can not do anything, since it is not running.
Maybe you have sawn the GPS Arrow in the status bar, staying active. But this disappears after some seconds, as long as no other application uses GPS.

How to lock Iphone device with my app? [duplicate]

This question already has answers here:
Can we lock the app while app goes to sleep mode in IPhone?
(4 answers)
Closed 9 years ago.
I am working on an app with passcode locking option(pic1). When I enter correct password it enters into the app.When I enter wrong password it will perform some other action(pic2).
After some time the app goes into the sleep state,when the app comes to active state we have to enter the password again.
Here my requirement is I want to open the "passcode locking screen" (pic1.,which was created by me) after unlocking the device,(pic3.,which is default locking option in Iphone). Unless I enter the correct passcode the "passcode screen" should stick to the window. It should not move to any other screen (pic4., screen with group of app icons) though I click the button of theiphone.
This requirement is killing my time, I don't mind to post sample code or tutorials if you have gone through.
you can't do this using a non-jailbreak iPhone. an app cannot prohibit the user from switching to another app (and it cannot modify another app)
that applies to the springboard (pic4) too of course

How iPhone application WeatherTunes realized running in the background [duplicate]

This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
How To Switch music from my app to the ipod
There is an iPhone application named WeatherTunes (天气旋律闹钟 in Chinese) in iPhone AppStor, search with key words "WeatherTunes " e, it appears at the first.
You can add alarm in WeatherTunes, even if you switch this application to background, it still runs. I look into its info.plist file, I noticed it set the "required background modes" with value "App plays audio". But I still can't figure out how it can be run in background? Thanks for any help.
Apps can run in the background if they have any of the 5 requirements:
Apps that play audio while in the Background state. A good example is Instacast while it’s playing a podcast.
Apps that track your location in the background. For example, you still want voice prompts from your turn-by-turn GPS navigation app, even if another app is Active.
Apps that listen for incoming voice-over-IP (VOIP) calls. If you use Skype on iOS, you can receive incoming Skype calls while the app is in the background.
Newsstand apps that are downloading new content.
Apps that receive continuous updates from an external accessory in the background.
It may be possible that this app is playing a silent audio file in the background, a tactic that I have seen before, but generally that will be rejected from the apple store.

How to get phone call ended notification after application is closed for iPhone?

In an iPhone app every time I end the phone call I want to ask user for yes/no type question & if 'Yes' is clicked the launch my application. I know I can get notifications for call end using CTTelephone but my question here is that is it possible to get the notifications even after my application is closed. If I run my application in background then there are chances that system closes it on low memory. Moreover apple doesn't support for continuos background application.
No, you will not get notification if your app is close. Since you app does not fall in one of the background modes you will not be able to run the app in the background.
In short, the functionality you want is not possible with the official Apple SDK and guidelines.