Phonegap 2.3 watchposition ios Background data upload to server - ios

i have created an phonegap app for IOS that tracks the position of the user. At this time it is possible to use it in the Background. But if i like to upload theses data to an Server it will only work when the app is in the foreground.
Is it possible to call a js function in the Background or another way to transfer theses data to an REST Server in an continous Intervall, when the app is in the background?
I has searched for many times about this problem and i can't meantion that nobody has it in the past. I read many about plugins for phone gap, but don't understand how to create on that could help me.
Sorry for my bad english

In short no - IOS only has limited background processing for 3rd party apps.
You can get limited background processing with a VOIP app or using push notifications but I guess this isn't suitable for you

Related

Relaying data between iOS devices with app in background

This might be asking for the moon but here goes...
Is it possible to have an iOS app receive data and then forward it all while running in the background?
We're a restaurant currently using an ordering system that uses a main iPad as the till, with a second iPad in the kitchen to receive orders, and another third iPad used by the servers to take orders. Orders are sent to the main till which relays orders to the kitchen.
Works great... Unless someone switches app on the main till iPad to our other (necessary) hosting app, then all hell breaks loose and all orders stop getting sent.
Developer (small team) has told us it's impossible to solve but I have done some digging into recent Apple APIs that allow simple tasks to run in the background and have seen a few promising options, or perhaps it's possible via the External Accessory Framework, or even syncing via iCloud? A question for the more knowledgable than me, but is there currently a workaround to solve this that I could suggest or are they right in that it's currently impossible in iOS?
Yes there are ways to have an app in the background receive data, generally using either:
beginBackgroundTaskWithName:expirationHandler:
or
beginBackgroundTaskWithExpirationHandler:
Take a look at the Background Execution section in the documentation for more info...

Tracking device useage on iOS

I've been using this app called Moment that tracks how much time I spend on my device every day. I think it's very cool, and at the same time am very curious how it works. I don't have tons of mobile development experience, as I've mainly built web apps, but I'm curious how this kind of functionality could be achieved.
I did a few quick Google searches and found that iOS does have some support for background task execution. The functionality lies in four categories:
Play audio
Receive location updates
Perform finite-length tasks
Background fetch
It looks like I can't do anything tricky using audio callbacks, as Apple will reject the app, but I'm wondering if I can do something with (3).
They do it using Custom Profiles.

Run a task when the application is in background Ionic and Native Approach

I am building an Ionic application and one of the features involves taking down the notes in the app. The notes taking can be performed when the app is offline. The data is stored in the local storage.
Now, I want that when the customer comes online the data that is stored in the local storage (PouchDB) is pushed to the server. The problem is that the app might not be in the foreground. The app can be in suspended state. How can I wake the app up when the user comes online and then push the data to the server or perform any task?
I would be interested in hearing the Ionic approach and also native approach. Thanks
Your problem can be solved with Data PushNotifications in IONIC...
http://ngcordova.com/docs/plugins/pushNotifications/

Can I make iOS 7 send pictures in the background when network connection is established?

I am building an app for iOS 7 that allows the user to select pictures and upload these to a server. In a perfect world the user would choose the pictures, press upload and be able to close the app.
I looked in to NSURLSession to establish this but it seems to only take a file. Is there any way i can send my NSData like in a NSURLRequest? Also, when not connected to the internet, is there any way i can make the app poll for an internet connection in the background and make it send the pictures when connection is established? I don't think was possible using earlier versions of iOS but iOS 7 seems to have some new options regarding background tasks.
Thanks in advance for any help!
A couple of thoughts:
You are correct that background uploads must use a file. So just save the NSData to a file (e.g. with writeToFile method), and then use that file path.
Regarding checking for Internet connection, the background NSURLSession takes care of that for you, so, no, you don't have to do that.
Regarding background uploads in earlier iOS versions, you could initiate the upload, but explicitly request a little more time to complete this finite-length task while the app runs in the background with UIBackgroundTaskIdentifier. See Executing a Finite-Length Task in the Background discussion in the App States and Multitasking section of the iOS App Programming Guide.
This isn't quite as robust as the new background NSURLSession functionality (which is more clever about applying discretionary logic so your app doesn't significantly adversely affect foreground apps, controlling whether it's permissible to do the upload over cell connection, allowing longer-length requests, working even if your app was terminated (for example, due to memory pressure), etc.). But UIBackgroundTaskIdentifier is a possible solution for iOS versions prior to 7 where you want to give an upload request a chance to complete even though the user has left your app.
Re: your comment about the "GOOD Dynamics SDK", I looked at it quickly. It does allow SDK-based app-to-app document sharing. I don't know if that means it writes a single encrypted on-disk file in the process, or if it uses an encrypted folder to store everything. If you had iOS access to that file, and a way to decrypt it on the server, then you'd have a chance of using the file-based background upload magic.

Running iOS App In the background for getting data from Twitter

I am in the process of developing a Twitter App on iOS, which will connect Twitter API in every 15 minutes, to Collect some data. I'm really not planing to have any server side script to Collect that data as I want everything inside the app itself.
Any idea on how to keep the app Running in Background?
Thanks.
You can follow the Apple's guideline before proceeding to create such background jobs. If it fits with all such requirements then you can go ahead. Follow this link for further details:
https://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html

Resources