WatchOS Detecting if user has taken off watch/locked screen - ios

I’m designing a Watch app that that has uses a PIN in order to create a token session. The goal is to detect when the watch is locked/removed from the users arm in order to know when to invalidate the token and prompting to enter their PIN again when they want to use the app. If the watch stays on while they have a valid token, they won’t be asked to enter their PIN.
I was wondering if there was a way to detect if the user locks/takes off their watch in order to do this? Any help/advice would be great!

Unfortunately Apple's wrist detection API is not available to the public, which means your app can't be notified whether the watch is on the wrist or not. This is is most plausibly for safety and privacy reasons as public info whether the watch is on wrist or not could yield malicious apps.
Nevertheless, depending on how your app works, I'd recommend you to look into tracking arm movement and using that data for locking the app since the accelerometer and gyroscope values are available for use.
I'd refer to the following
Detect physical movement of iPhone/Apple Watch for detecting hand movement

Related

Apple's security measure against using IPhone Camera in Background Mode

I have a client who wants to create an app that checks for a user's neck posture. I have seen some weird implementations online which aren't very sophisticated so I came up with a way of doing it but I required 1 component which involves facial recognition while the App is in background mode, meaning the user doesn't have the app open and its just running n the background. I've read online Apple does not allow this feature for security reasons and I am wondering is there any possible way to convince Apple to allow me to do this? Are there special cases where we can implement it?
for example
The app checks the phone's Pitch position
The app checks wether it can detect user's face
The app uses these two properties to determine how well the user's neck is aligned with the app.
This is not currently possible. If you want to convince Apple to change this at some point,
Go to http://bugreport.apple.com/ and file an enhancement request
Include a highly persuasive argument as to why they should want this in iOS. Be sure to cover the security concerns that prevent it from already being possible.
Wait. Probably a long, long time.

How to prevent or detect "Location Simulation" by Xcode on your application in production ? [Big Issue]

I guess this is a huge flaw in iOS .. like currently it's happening for PokemonGo currently the normal users are able to spoof device location to a desired one in non-jailbroken devices .. any idea or workaround to detect location simulation by Xcode ?
Using GPX location spoofing returns -1 for heading and speed - If your are looking for ways to detect spoofing, if the CLLocationManager is providing Lat,Lngs that are moving, but you're not receiving speed or heading, then the likelihood is the location is being spoofed.
How about using other sets of data to detect GPS spoofing?
Google includes it since 2007.
As an app developer, you could use the phone's internal inertia or orientation tracker data to check your GPS location's plausibility. The built-in compass may also prove useful. Using the phone's internal sensors only won't detect all cases, for example, if they are also spoofed consistently to the GPS signal, but it increases the effort one needs to invest to fool an app successfully. External sources, such as wifi-hotspot locations, would be even better but I think this is pretty much effort on the app developer's side, given that such data needs to be obtained and verified regularly by the application.
An extension on Kento's answer:
If, using accelerometer information, the phone appears to not be moving, request the user shake the device. You can keep a record of how it was shaken, and check if the previous shake was TOO similar. You would have to trial and error what the threshold would be, but I imagine it would be difficult to simulate several different shaking maneuvers.

How do I deal with save game data when changing Apple ID on ios device

This comes close to an opinion question, but I hope that someone can give a definitive answer.
I have written a game app and I save game data locally. But I also will want it to be cloud capable and I am currently writing the code but I keep hitting a mental barrier. In several places in the iCloud and Game Center documentation it says if I change Apple ID, I need to delete the local save game data/file cache. This is contrary to how my app currently works, which is OK if I can figure out the right way to do it. In the ICloud documentation it says to either user the cloud or don't use the cloud and only ask once, but there is a button in the settings to turn the iCloud Drive on and off.
The core of my dilemma seems to be that an IOS device is not tightly linked to one Apple ID. I understand that multiple devices can be associated with one Apple ID, but not why it should be true the other way around.
This can be seen as either added capability or enough rope to hang oneself. As a user I can, using my Apple ID, get on to another device not associated with my Apple ID and:
download an App/Song
log into Game Center and play a game we both own.
etc.
I know Apple deals with this and now I have to do the same.
As App Developer I see a world of questions about what this might mean, like "Well I'll do this or that but what do I do the first time this other thing happens?", etc.
For example, initially I thought I could consider "local" store the same as a very long airplane mode, and when the cloud became available I could sync the delta to the cloud and across devices, but this does not address changing Apple ID. Do I blow away the local data, keep the new user from playing the game, only allow local or cloud but not both?
Now Apple is adding Multitasking, and a login to iPad's used in schools, the problems become even worse.
I keep trying to find some profundity that will steer me to the correct answer but I am at a loss on how to deal with Apple ID changes.

Is it possible to track devices of users on our device

I am working on an App, in which i need to track the device using my App. I have gone through the "Find my friends" App that Apple has offered themselves. But, it asks user's permission if he wants to allow tracking his location.
I studied, an app named "Uber", they clearly track the cabs maneuver around the city. They also show the user, how far is that cab from the user, the possibility that might be here is "Uber" dudes could be using external GPS device and may be interfacing them with the user's device. Since, If I am not wrong.. Apple does not allow tracking devices.
But yet, I am in need to implement that kind of functionality in my App. I was wondering if it is possible ? I am aware of location tracking, my concern here is live GPS tracking.
Please point me in right direction here, Any help with be truly appreciated
I have a full working sample that shows how to track android, iphone, windows phone and java me phones. It also has the server software to put the location data in a database and allows you to view the location in real time and also store the routes to view later. Its MIT licensed:
https://github.com/nickfox/GpsTracker/tree/master/phoneClients/android

Check if iDevice with a specific app is nearby

Is it possible to check within an app, if there are other idevices nearby which have the app running?
For example device A starts the app. Device B also starts the app. When they are nearby, a notification will popup.
I know its possible to check the range between two GPS coordinates. But the only solution that I've found on the internet was, that I have to make a webservice/server which handles the coordinates which were sent by the idevices.
But I'd like to make it run "offline", without saving/sending the data at a webserver.
You can achieve exactly this using the new iBeacons functionality in iOS 7. I'm not sure I can link to the exact documentation due to the NDA currently (although the feature was mentioned publicly at WWDC), but if you search for 'beacons' on the Apple Developer site you should find what you need.
There are also some examples towards the end of this year's WWDC session 307 - "What's new in Core Location?". This is arguably more useful than the documentation.
Essentially, you define a beacon region and tell your devices to start advertising their presence. At the same time, you can listen out for beacons in the local area - CoreLocation will then report you the identifier and approximate distance of each device.

Resources