PhoneGap iOS getCurrentPosition while app is in background - ios

I'm developing an app which tracks the geoLocation of a user using PhoneGap/Cordova. Knowing the users location even while the app is in background is crucial. I find a lot of conflicting information on google groups and forums. Some claimed it can work and others claim it doesn't work at all because Apple denies JavaScript to be executed in the background. Lot's of information is already dated and the hacks and workarounds I tried failed.
I added the "Required background modes" / "App registers for location updates" property to my projectname.info.plist.
My simple question is; is collecting geo information with a PhoneGap iOS app running is the background even possible?
Regards!

The answer is no. Apple does not allow Javascript to be executed when the app is in the background. A possible solution is to create a phonegap plugin which does this without using Javascript.

Related

cordova-plugin-background-mode rejected by iOS: ' remove the "audio" setting'

We are using the 'cordova-plugin-background-mode' by katzer and have been approved once by the iOS revision team after I demo a video of the app using the plugin. But when we attempted to update our app last week Apple rejected us and will not accept an other "demo video".
Our Ionic App needs to run in the background and this cordova backgroud plugin seems to our only solution for this.
Apparently this plugin comes with an audio file at 0 volume that 'plays in the background in other words it's 'tricking' or mimic native functionality to keep the app running in the background. Android seems to be ok with it but Apple sends us this.
The audio key is intended for use by apps that provide audible content
to the user while in the background, such as music player or streaming
audio apps. Please revise your app to provide audible content to the
user while the app is in the background or remove the "audio" setting
from the UIBackgroundModes key.
Obviously we can't do that because then the core functionality of the app running in the background will not work. I guess this is what Hybrid Mobile App developers have to deal with to achieve certain native features.
Any Ionic devs out there who have figured out a work around for this?

Detect which app is in foreground on iOS9 without jailbreak

I'm trying to log users individual app usage on iOS9.
I'd rather prefer that it wouldn't use jailbreak limited solutions, self explanatory. Doing the variation of this app on a jailbroken phone shouldn't be hard.
This will certainly not be released on the App Store as Apple wouldn't allow it.
I'm looking for any private API that can do this, any hidden iOS API's that can be used to do this. ANYTHING.
What I've already looked through:
how to determine which apps are background and which app is foreground on iOS by application id
How to know about app launched and details jailbreak iOS 7
Is there a private API to be able to detect what is current foreground app on iOS?
How to monitoring App running in the foreground in iOS8?use the PrivateFrameworks SpringBoardServices
which proved to be relatively helpful - we now can assume that there is some sort of additional access requirement, probably an entitlement, but we don't really know how it should look like
Can you find individual app usage duration using SpringBoard services framework or other private framework?
Find out active application or if on Springboard
Programmatically detect which iOS application is visible to user
However all of these proved to be unhelpful because Apple fixed this security flaw with iOS8 and the method to copy/access the currently front most app bundle identifier no longer works.
Question is: Is there someone who knows a workaround using different tools/exploits that do not require jailbreak?
Ideas:
inspecting the processes running on the device and devising an algorithm that would be able to recognize spikes that mean an app has been launched, which potentially could work, but it probably would be a major pain in the ass. Questions mentioning this solution:
Detect which app is currently running on iOS using sysctl,
Return a list of running background apps/processes in iOS
How to get Names of Background Running Apps
Find Background running apps in iphone
inspecting the phones traffic somehow?
not sure if there is some kernel stuff that I could do
Here is my Reddit version of this question if anyone wants to check it out. Also if it's of any value, here are the runtime headers for iOS9 and list of Apple's private API's.
Unfortunately, I was looking for a similar solution and have come to the conclusion that, at least at this point in time, there are no known methods that will allow you to determine app usage on iOS. Even the MDM providers such as Good, Airwatch, MobileIron, etc. don't seem to be able to do this. If anyone is able to come up with a solution, I'd love to see it.
For now, however, I think we would have seen a solution if someone had one that worked on the latest iOS.
sysctl is still open but they block certain combinations of selectors. I did this on iOS 7 and gave Apple Product Security the code. They won't patch iOS 7 but rely on App Review. iPhone 4 is wide open.

How can I have an iBeacon advertise my app in the App Store? [duplicate]

How do I get my app icon to show in the bottom left corner of the lock screen and have it link to the app store? Can I control that using iBeacons? Is it easy to test without having the app in the app store?
You must have your app already installed on an iOS device before you can trigger any functionality using iBeacons. There is no way to have the presence of a beacon automatically prompt a user to download your app from the AppStore, no matter what the user interface.
The only exception to this is that if the iOS device already has another app installed that prompts a user to download your app. You could even do this with a pre-installed app that responds to beacons like Passbook. But even in this case, you somehow have to get the third party app developer to put in custom code to link to your AppStore page on iBeacon detection, or somehow get a user to put in a new passbook entry for prompting to install your app.
The bottom line is that all of these exceptions are generally harder than getting people to install your app via other mechanisms.
Sorry.
EDIT: It seems that lots of reports of this are really referring to the new Suggested Apps feature of iOS8. This is an AppStore feature that uses geofences (not beacons) to find apps relevant to your location. The description of this feature in settings says:
Leaving this option turned on will allow iOS to offer suggestions for App Store apps that you do not already have installed. These can be based on what you already have installed or what people near you find interesting.
Again, this is based on geolocation not beacons, and it is unclear whether the suggestions are based on an algorithm (other folks regularly using an app in the vicinity), a database (known locations of major retailers), or paid marketing (e.g. Starbucks pays Apple to suggest their app when near one of their shops.) It could be a combination of all three.
How do I know that this technology is not based on beacons? Because I received an app suggestion for Starbucks (without having the app installed) and then I immediately used a non-iOS-based beacon scanner that verified no beacons were in the vicinity.
Apps appear in the lower corner of the lock screen on iOS 8 when there are geofencing events. This can include location or beacon events.
The app I'm working on shows up in the corner when I enter a beacon region.
You need to register the UUID in your app that the beacon is
broadcasting. You use a CLLocationManager to register for a
CLBeaconRegion with the associated UUID, which will then cause the
delegate of CLLocationManager method -locationManager:didEnterRegion:
to fire.
2Mike Welsh
Pls can you show any code how to "register the UUID in your app that the beacon is broadcasting".
Also if you finding beacons with UUID+major+minor - do you need to to register them all? Because I have about 100 ibeacones and all of them have different major, minor.
If iPhone owner don't download my app never, how he will see it in the corner? How Apple will know, that exactly this uuid, major, minor are by this app? Where they take information?
Can you show on you example? Because now I have a lot of questions, but still no answers, just completely different information.
Other can also to read article by estimote about "icon in the left corner": http://blog.estimote.com/post/97824495825/ios-8-pushes-location-context-to-a-new-level-lock
This use case is depicted by Apple Documentation Region Monitoring via iBeacon and the good example by Estimote as told by #ElmRid
The only way to trigger an app using ibeacons is to have the app already installed on the device.
If the app is not installed, Apple might be able to send apps suggestions based on Geo-Location (as for Starbucks or Apple Store), but that is something that needs to be requested to Apple and they will eventually approve it (it has nothing do to with the submission of an App).

How can I get the information which app is foreground in iOS?

Can I get the information about which apps are on foreground, so that controlling the screen and get interaction from user.
I can do it on Android and I want to do it also in iOS.
This is for making an app that monitoring the usages of apps, not for the CPU usage.
Please tell me how could I manage this ?
On jailbroken devices, a quite straighforward solution is to use Ryan Petrich's AppList library.
I'm not sure if this is easy on a stock device, but you might get somewhere using the Mach/XNU API for retrieving process info and searching for a suspected app executable path/name.

Running an app function from background- iPhone

I need to create an app which can handle movement events while running on the background.
i.e each time an accelerometer event is happening it should be tracked in the application memory-when the application is running in the background.
My questions are :
1. Is it possible on IOS?
2. How can it be done?
(I came up with some relevant questions but i'm not sure that the answers are up to date due to IOS changes.)
Thanks,
Asaf
You should have a look to this thread (and the links inside) and the apple documentation.
To summarize no third party apps can run in the background (even though some of apple apps do this) excepting for:
Tracking the User’s Location
Playing Background Audio
Implementing a VoIP App
Downloading Newsstand Content in the Background
Communicating With an External Accessory

Resources