Tracking object's location in Objective C (How to prevent program from quitting) - objective-c

Let's say I wanted to track the location of my car as I drive around the city, just for kicks.
I have an old iphone 5, so I write up a little program using Parse.com framework, and using geopoints easily construct a little collection of data which I save to my cloud server. Piece of cake, right?
Well, my question is this: I put the phone on the seat after I begin to run the program. How do I ensure that the phone does not go to sleep? And what happens to my program if the app goes to sleep/quits? And how would I prevent this, if such a thing might occur?

Read about Apple's "Background Execution" abilities. A great example of this is Spotify: users can select a song, change apps, and put their phone to sleep. All the while Spotify continues to play that song.
In your case it sounds like you want location tracking, most likely using the "Significant-change location service". Using the location framework with background execution enabled will allow your application to save those geo-points to Parse at specific, distance-triggered points, even if the application is in the background or the phone's asleep.

Related

Memory leak in windows web browser using VB

I have built a basic web browser using vb, say like IE6, where I don't have tabbed windows.
I have option of creating new window.
When I open one window and navigate to the Google page, the task manager shows 33,546 K memory usage.
On opening second and navigate to gmail, it shows 54,786K.
On opening third and go to facebook, it shows 70,191K.
But when I close any one of them, say like facebook, it is only releasing around 4 MB memory and task manager shows 66,672K. on closing second, it shows 62,890K.
What I actually want to happen is when I close facebook, memory usage should go back to around 54,000K.
I am very new to programming VB, and don't even know if what is actually happening is memory leak or not. But anyway, is there anyway to make what i want happen, that windows release their maximum memory?
Do help.
I am using dispose method to close the windows. There were solutions which asked to create two separate applications and called the browser windows in parent and there take care of events and memory based on some method i wasn't able to understand.
If that's the way then can someone point me to a tutorial where I can learn how to do that?

Streaming movies from my server

I'm playing around to make an app that lets people stream cartoons that I make. It's a very simple app, one ImageView is just loading in a html-homepage in a UIWebView. Witch contain links to .mov files. So if you tap them a movie will start playing. This is because I just want to update the html-file with new cartoons every week.
Is this an "ok" way to do things code:ing-wise? Or am i obligated to us some Objective-c streaming functions?
Is there a specific file-type that i have to use in the movie-files on the server?
Is the HTML static in your app, or does it point to a server? If it's the former, you may be able to get the app approved doing it the way you suggested, depending on the reviewer. If it's the latter, you're unlikely to get it approved by apple.
They tend to frown upon web sites bundled into apps, and will tell you to simply make your website usable with the phone. See section 2.12.
My suggestion is to spend a bit more time and offer iOS users a better - and more immersive - experience than is available via the web. As I'm sure you've found, there are many built-in ways to stream movies and to present them in a manner that surpasses a web-page-like experience.

WinRT live tile on system startup

I have a live tile working which updates how many users are online and how many lobbies are open within the app. This begins updating when my app loses its visibility (no point it updating the live tile whilst the app is running), but I want it to update when I first turn the computer on.
I have had a look around and mentions of making the app a lock screen app have popped up but that is all, no explanation how to do it.
Does anyone know how to do this and provide a nice little explanation or link of how to do so?
Many thanks,
Kevin
You should use push notifications for this kind of behaviour. This msdn link has more info:-
Using tile notifications
Choosing the right notification method to update your tile
There are several mechanisms which can be used to update a live tile:
Local API calls
One-time scheduled notifications, using local content
Push notifications, sent from a cloud server
Periodic notifications, which pull information from a cloud server at a fixed time interval
The choice of which mechanism to use largely depends on the content you want to show and how frequently that content should be updated. The majority of apps will probably use a local API call to update the tile when the app is launched or the state changes within the app. This makes sure that the tile is up-to-date when it launches and exits. The choice of using local, push, scheduled, or polling notifications, alone or in some combination, completely depends upon the app. For example, a game can use local API calls to update the tile when a new high score is reached by the player. At the same time, that same game app could use push notifications to send that same user new high scores achieved by their friends.
You're right with the assumption that you require a lock screen capability to be able to run background tasks without your app being started once. The main process would be to extract the part of your application that gets the data into a background task that is probably triggered by a timer and write some code to be on the lock screen.
When I first encountered that restriction I was kind of surprised, but in terms of battery performance this design decision makes sense: Only consume battery power if the data is absolutely worth it. If it's worth, it is also of interest having it on the lock screen.
On MSDN is a good overview about lock screen along with further reading links. It's much better than what I could type in here. Come back with problems related the implementation (which actually even better fits the purpose of SO). This blog might be useful, too.

Perform a task every day even if running only in background

I need my application to perform a background task every day, but it does not comply with Apple's specification for running in background.
It's none of these: audio, location, VOIP, news stand, external-accessory—, Bluetooth-central.
I'm planning to use local notifications, but the point is, that if the user doesn't open the app (and just leaves it in the background), I cannot plan new local notifications.
What should I do in this situation?
Make something else.
Seriously, if your app doesn’t at least technically fit one of those categories, you’re not going to be able to get it to do background work in a way that’ll get you approved for the App Store.
I’ve seen apps that added specific functionality in one of those categories, orthogonal to their actual purpose, to be allowed to run in the background; for instance, there’s a couple of weather apps out there that play a continuous audio file—one of the available sounds being a silent one—in order to be able to update the lock screen’s “now playing” image with live data. If you don’t mind your users being unable to listen to any other music, and have your app continuously active (which might cause additional battery drain), that could work. But if you’re trying to have your app invisibly do things in the background, without interfering with anything else, in a way that’ll get you into the App Store, you’re probably out of luck.
Four options:
Go for jailbreak
Try to get in the app store as one of those types of apps, making up a feature that uses one of those types.
(my favorite) Really rethink your system, is it really necessary to schedule background tasks? Can't the user wait a bit when he opens the app? That loading can be performed in background. And can't you offload some of the work to a webserver? Are you collecting data? You shoudln't without the user consent.
Let your user know that it's important for him (he's the one using it right?) that he opens the app once a day.
I think I covered all yohr options except the one already covered by Noah.

What is the best way to start a movie the first time your app starts

I want to have a movie start the first time my app is launched to train users on its use, say a 50 second clip.
How would I go about doing this in an iPad app?
(I am building a very complex platform that has hooks into the web and need users to be aware of that. The video will explain that users can go to the website for different features. When the app starts for the FIRST TIME only I want the video to play.)
Don't force users to sit thru a 50 second movie when the app starts. Your user interface should be obvious enough that they can figure out the basics without watching a training video. If you want to offer it, provide a help button, where they can watch it when they choose to.
See the iPhone HIG section Minimal User Help, which says:
A hallmark of the design of iPhone
OS–based devices is ease of use, so
it’s crucial that you meet users’
expectations and make the use of your
application immediately obvious.
EDIT -- The simplest way to keep track would be to store a flag indicating whether or not you have shown the video by using NSUserDefaults. Check if it's set at startup, set it after showing the video the first time.