How to determine a 90 degree turn on Apple Watch? - swift

I have the following case to determine the user's turn 90 degrees or more with only using Apple Watch.
I wanted to do this with CLLocationManager and startUpdatingHeading, but Heading does not support watchOS. At the moment I'm at a dead end, and I do not know the solutions to this problem. Are there any disputes to solve this problem?

Review the CLLocation portion that supplies Course. This is available on Watch. The Heading information is derived from the internal phone compass and I’m not sure that is currently supported on the Watch. (Docs don’t show it is.)

There is no compass in the Apple Watch if you check the spec. Let's why you don't see a compass app.
You have to use CoreMotion and get the gyroscope data. You probably also have to do some math to calculate the degree.
http://www.hobbytronics.co.uk/accelerometer-gyro

Related

iphone gps accuracy, can it trigger an event based on location?

I have an issue that i am having trouble to solve. We are about to develop an iphone locative application that would take you around the city with audio that would be played based on the location. I was wondering, do you know how accurate the iphone GPS will be? In terms of actual distance. I am reading 250 m on line but it looks a lot. Plus the gps in the iphone finds my location more precisley than 250 m. I know it is a generic question, but mabe you guys can give me a feedback about it, i am quite desperate and exausted. what we would live to do is, every 70-80 m, put a pin on a map with an audio file, when the user crossed the pin it would trigger an event that is the audio file. I just would love to know how accurate the gps could be so that i can start designing the experience.
Thanks a lot
I've seen iPhone's GPS as accurate as 3m (at least that's what it said on my device when testing).
There is also a new API since iOS 4.0 that you might be interested in that will enable you to set a region for the device to monitor and it will automatically generate a callback when the user crosses the virtual fenceline depending on how accurate you need that to be. This is particularly useful when the app is sent to the background since you can simply monitor the user's location using CLLocation when the app is in the foreground:
- (void)startMonitoringForRegion:(CLRegion *)region desiredAccuracy:(CLLocationAccuracy)accuracy
You can get up to 5 meters accuracy. Within the core location framework there is a property - horizontalAccurracy - that you can read at runtime to get the accuracy for a given moment
The accuracy is anywhere from 5-25m.

current location without using gps

hai
Can we know current location without using gps? Is it possible?
The iPhone SDK has a framework that automatically utilizes the proper mechanism for determining location based on how accurate the result needs to be. Apple has a good article discussing these different methods of locating a device.
Also, here is a good starting point for learning about programming with Location Services.
Furthermore, you can dive right into the CoreLocation framework documentation and learn about everything you can do using Location Services on iOS.
Yes, CoreLocation can triangulate your position via nearby cell phone towers, but the position won't be as accurate as with GPS. Also, it can get your location via nearby WLANs, but this is even less reliable.
Core Location does what you want (by using Wi-Fi triangulation). Check out the documentation of CLLocationManager
Try this
map.showsUserLocation = YES;
map is my MKMapView Object.
Well thats kind of a very broad and very general question. If you are talking cell phones you can use three tower triangulation which is good when you are hitting three towers all at once, but if you are only hitting one the error can be up to a few kilometers.
Now if you are talking internet accessing devices (ie something with an IP address) again things get dicey. If you are using a stationary access point you will get a close approximation using nearest known Hubs with the IP range the device is in. Mobile devices with IPs are really hard to pinpoint.
More links
http://mithin.in/2009/06/22/using-iphone-sdk-mapkit-framework-a-tutorial
http://www.icodeblog.com/2009/12/22/introduction-to-mapkit-in-iphone-os-3-0-part-2/
and step by step guide.
http://gigaom.com/apple/iphone-dev-sessions-finding-your-way-with-mapkit/
To add to #Jenifer's answer
showsUserLocation
Discussion
This property does not indicate
whether the user’s position is
actually visible on the map, only
whether the map view is allowed to
display it. To determine whether the
user’s position is visible, use the
userLocationVisible property. The
default value of this property is NO.
Setting this property to YES causes
the map view to use the Core Location
framework to find the current
location. As long as this property is
YES, the map view continues to track
the user’s location and update it
periodically.
Core Location Framework
The Core Location framework lets you
determine the current location or
heading associated with a device. The
framework uses the available hardware
to determine the user’s position and
heading. You use the classes and
protocols in this framework to
configure and schedule the delivery of
location and heading events. You can
also use it to define geographic
regions and monitor when the user
crosses the boundaries of those
regions.
If you want to know How does the Core Location do this
It actually uses several mechanisms.
GPS
Cell Tower Triangulation
Wifi Hotspot cataloging
Randomly assuming you are in Cupertino
There are tradeoffs based on speed, precision, and available hardware. A first Gen iPad will only have the 3 option available while the iPhone simulator makes use of the last mechanism.
You can observe the difference in these systems in the map application where it initially guesses based on the cell tower, then refines the guess via GPS.
Only options #3 requires a data connection.
And for the humor impaired including #4 was not totally serious although it is functionally correct. (I think they simulate the GPS reporting that location rather than just hard coding it, but I haven't checked.)
From How does CoreLocation locate the device?
The iPod Touch does something like this. It doesn't have a GPS chip, but instead uses the available WiFi networks in the area to get a rough idea of where you're located.

Accessing hardware infos on iOS devices

Is it possible to write an app that displays hardware infos such as the number of kernels in the processor, the available RAM, GPS, motion sensors?
Using CoreLocation and CoreMotion it's not possible to know for sure if a GPS or an accelerometer is present on the device because of the Location Services switch.
Is it possible to check deeper for hardware?
Pretty much no. You can get some general, implied information, for example by allocating RAM until you get a warning, and then assuming that's your available RAM. You can also check for availability of certain services, for example by asking CLLocationManager if locationServicesEnabled. But you can't get detailed information about it to know for sure if, for example, the GPS is there, but it's just turned off.
So the answer is no.
Check the iPhone Developers Coockbook ( Erica Sadun, http://ericasadun.com ) for the UIDevice Class - UIDevice-Hardware (direct link here: https://github.com/erica/uidevice-extension/blob/master/UIDevice-Hardware.h ) - but I'd also recommend getting the Book. Pretty good stuff, and the UIDevice Extensions are pretty good.
Please note that some of that stuff is private API! - you won't be able to submit it!

how to determine current location from GPS in iphone

I needed to implement the positioning functionality in my next app. I got a few questions regarding the development.
1) I found the tutorial and implemented the positioning thing.. but is it possible to simulate my code with iphone simulator or is it necessary to use the device for this purpose. while googling i read on some forum that 4.2 SIM supports GPS apps simulation though it will give Apple's headquarter's location every time but in my case the CLLocationManager's didFailWithError delegate gets called. any help with that!!
2) After determining the position, longitude and latitude, how to determine the exact area name and other information from it?
Thanks in advance for your invaluable time and feedbacks.
CLLocationManager will in fact return the location of the network the simulator is using. It's MapKit that will think the current location is in Cupertino at Apple's headquarters. That you get two different locations from the calls often causes confusion.
You can get information about a given latitude and longitude by using the MKReverseGeocoder. It will attempt to give you a full address, but you can use whatever portion of it you'd like (just the country, or city and state/province, whatever).

Getting cell tower information in an iOS application?

My question is simple but I haven't found a good answer anywhere. My question is this: Is there a way through either the iOS SDK or third-party frameworks to get cell tower location data? Meaning cell tower location, distance from you, etc.
The signal application for iOS does this, so I know it's possible, but I can't seem to find any documentation or resources on the matter.
Thanks!
There is no official way to do this as far as I know.
iOS SDKs abstract that info to a single and easy to use location API.
The application you link is probably using private APIs from iOS.
That means that developer is using undocumented functions from iOS.
If you really want to find more about it, you can try contacting him.
Also check this:
iOS Private API Documentation
The signal app used some private API which will lead to immediate rejection by Apple, which is why it says jailbreak device only.
Plus, you may find this post helpful: iPhone signal strength
The CellStumbler application (CellStumbler at code.google.com) uses undocumented methods in the CoreTelephony framework. There is a CellInfo struct defined which can be queried via the _CTServerConnectionCellMonitorGetCellInfo method.
However, on iPhone-4S - iOS5 the CTServerConnectionCellMonitorGetCellCount always return zero - so no cell info can be queried. Things may look different on a iPhone4/3S since Apple changed the baseband modem from Infineon Gold to Qualcomm mdm6610.
You mal also try to evaluate the built-in FieldTest app (just dial *3001#12345#* to start) which gives you a couple of info related to your cellular network status.