Autostart of an iphone app - iphone

I am building GPS Tracking app. I want the tracking functionality to be started
after a reboot of device. Now I did with background compatibility, It works fine on background, but I need to start tracking when the device is rebooted (switch on) without having to open the app to start the functionality.
How can I implement that. Please give me procedure for how to enable the autostart for
that app and how to invoke a method to start tracking.
If you watch the app like skype and webEx that are autostarted on iphone starts..
How these apps are working. I have no idea for enabling this autostart.
Please suggest me how to do?
Thanks in advance...

Add the UIBackgroundModes key to your app’s Info.plist file. Set the value of this key to an array that includes the voip string.
You can do that in xcode: Select your project root -> Capabilities -> Background Modes -> check 'Voice over IP'.
From the documentation:
"An app with this key is also relaunched in the background immediately after system boot".

No third party app can be launched on startup. Skype (and others) simple respond to push notifiactions
The only way to actually open an app from the user not explicitly opening it, is to call a [[UIApplication sharedApplication] openURL]; - or somehow otherwise open a URL, and you have to set your app up to have a custom URL scheme... see this page.
E.g: Doodle jump has URLs such as doodlejump://highscores - which you can open from an email from them or their website.

Related

Switching from View 1 to Bluetooth settings..can't possible?

I am facing problem in switching from view 1 to Bluetooth settings i.e in view 1 i have given 1 Button..on clicking on that button i want to switch to view 2(Bluetooth settings)..but it can't be possible in iPhone..since we can't access the default settings of iPhone..for that we have to create the application preferences..
Q.1 Is there any way to access the default settings of Bluetooth in iPhone?
Q.2 Is there any official link where it can be mention that we can't access the default settings?
I want suggestion..please help..
Thanks in advance
Apps cannot open the settings application to a specific screen. The reason that apps like MapMyFitness open preferences is because they ask for permission to use Bluetooth Low Energy. Asking for permission is managed by CBCentralManager on first usage.
These popups are shown automatically by the system framework. The message can be customized using the purpose property for location services, that is not possible in case of Bluetooth.
No private API was used for this, so there's no reason for the app to be rejected.
Credit goes to this bellow SO question
how some apps can open setting app programmatically within their app
que 2.
At previous we are opening Setting Page from app Using Bellow line of Code:-
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs://"]];
But now upto ios5.0 it was working after that this one depreciated. and Till now Apple not providing the URL Schema for achieving this one in newer versions.
Links of similar question and it's Answer:-
Call the official *Settings* app from my app on iPhone
iPhone- Open Settings from my application iOS 6
is it possible to open Settings App using openURL?
Programmatically opening the settings app (iPhone)
How can I open the Settings app when the user presses a button?
iPhone: Opening Application Preferences Panel From App
Open UIPickerView by clicking on an entry in the app's preferences - How to?
Open the Settings app?

Access the Apps available in iphone

Hi i would like to access the apps which are available in iphone means downloaded apps and inbuild apps.But here issue is if i access any app which is available in iphone using [[UIapplication sharedapplication]openurl:[NSURl url urlwithstring:#"http://www.skype.com"]] like this i can able to access that iphone app succesfully but if i want to come back to my app i did not find any way only i have to hit homebutton. So is there anyway to come back to my app at any point of time. if anyone know please let me know. Thanking you.
So is there anyway to come back to my app at any point of time.
Not unless the other app supports returning back to the calling app (by responding to a special specifier in the URL, for example).
Note that there is also -[UIApplication canOpenURL:] which will tell you if a particular URL scheme is supported. This is useful to check whether a particular app is installed without attempting to launch it.
That is default behavior of the iOS application. Once your application is in background there is no way to come back to your application programatically.
User has to manually open your application.
You can navigate to some other apps on the phone using the URL method, however you cannot return to your app.
Once you navigate to the other app, it takes over and your app is no longer running. Therefore, the other app would need to navigate back to you. That obviously is not possible, unless you had access to the code of the other app.

How to reboot or reload iPhone app programmatically in iOS

I have dowloaded an xml file that contains some update parameters and then I need to reload these parameters and init some views. Easiest way is to apply this configuration on next app boot. Is there any way to reboot iOS application programmatically?
Thank you.
Rebooting the app is a bad idea, I'm pretty sure Apple would reject it. However, You could display a popup telling the user to open a close the app to apply your updated information. But the best way would be just to manually call the methods needed to rebuild your app (I.e. the ones that need to use the updated data).
If you have to do some extensive rebuilding (i.e. things that the user would immediately notice) it might be a good idea to add in a "loading" progress bar of sorts.
You can't reboot your app, and I don't see why you would a) have to b) EVER WANT TO.
You can quit and restart an iOS app with a bit of user assistance. Set the app's plist key for application exits on suspend. Create a local notification for your app to trigger a few seconds into the future. Then send Safari a URL. The OS will terminate your app when launching Safari to handle the URL. The URL might be to a web landing page telling the user that a relaunch is in progress. Then the local notification will go off and ask the user to relaunch your app.
However an app should be (re)designed so that there is never a reason to do this.
You can do it only if your device is jailbroken
Put a reboot button in your app and call abort();. This will crash the app.
Hook the -(void)exitedAbnormally; from SBApplication and write code to launch your app.
If its not jailbroken, you have no choice
if you develop for jailbroken devices you can use uicache command to clean the springboard cache and reload new apps/icons (available from UIKit package).
for example,
1) if you're under root:
su mobile -c uicache 1>/dev/null 2>&1
2) if you're under mobile:
uicache
for reboot you can use rebootcommand under root and killall SpringBoard for respring

iPhone App in suspended state, launched by URL, showing Default.png

The app responds to a custom URL, and correctly launches when in a suspended state. The question is, can I disable showing the Default.png when launched this way?
A use case for clarity:
app is started normally
a home button press puts app in standby
a url of the scheme the app recognizes is tapped in mobile safari
users sees Default.png before launch is complete.
As you probably know, when fast app switching activates usually the app is redisplayed with a screenshot of the last state rather than the Default.png. This is what I'd prefer happens when the URL launch takes place also.
It sounds like what is going on is that Fast App Switching is not actually working. So:
Make sure you are building the application for SDK for OS 4.0. If you don't, you app will not have fast app switching support.
See if fast app switching normally (otherwise) works with your application. I.E. when you just switch to safari, then re-launch your application, do you get the "default.png"?
Run the app under the debugger, but on your actual device. Make the problem happen, go into the Organizer, and look under device logs. This will show you if there was a low-memory issue which caused your application to be terminated, when Safari was launched, thus requiring it to be re-launched when the URL was selected.
I believe there were two mechanisms in place. In my app, I do not support "Launch with URL" - but what I do do is support the Application Delegate's call:
-(BOOL) application:(UIApplication *) application handleOpenURL:(NSURL *) url {
This may be the difference - this is the call which can be made to an application that is running to hand it a URL to process. If you are using the other technique, use this one instead. I use this, and do not see the "default.png" - i.e. do not evoke a "clean relaunch" when I get called.
Here's a possible workaround. This was causing me a headache with trying to seamlessly return from Facebook's single sign on process. I wanted the appearance of going back to my app's login area, instead of the appearance of restarting the app, even though I verified in every way possible that the app was indeed returning from fast app switching and not actually restarting.
While I couldn't find any way to force the app to display the previous state's screenshot, I did discover that the app will display Default-scheme.png (for example, Default-fb12345.png or Default-appname.png) when invoked with a url. So if your post-app switching screenshot is fairly predictable, grab a screenshot from iOS Simulator and copy it into your app. I would consider this an iOS bug. The app should always display the last screenshot when app switching, rather than Default-scheme.png simply because a url is involved.
Another possibility, which I didn't test, would be to symlink the bundle's Default-scheme.png (and Default-scheme#2x.png) to the snapshot file in the app home directory. This would be Library/Caches/Snapshots/[Bundle identifier]/UIApplicationAutomaticSnapshotDefault-Portrait#2x.jpg for most situations (unless it's landscape, or an iPad). If your app's state is unpredictable but the orientation is fixed, this could be a good option to try.
Make sure you've got the "Required Background Modes" key set in the Info.plist to the function that the app needs. If it's not listed, I just use "App Plays Audio" to keep it open.

iPhone: Start or Download App if not exists from Safari

I know its possible to open an app from mobile safari using custom URL Handlers.
Is it possible to open the App Store from Safari on the iPhone and automatically install the app?
Or might it even be possible to open the app if it exists on the users device and to download it if it doesn't?
Best,
heinrich
You can't automatically install the app, but you can go to an App Store URL via UIApplication's openURL: method.
To open another app from within yours, see this question: Launch an app from within another (iPhone). (I don't know how you'd find out if the other app is installed. Maybe just try to open it, and if that fails, open the App Store URL?)