Ios.location-based Service

Source: Internet
Author: User

Service based on location area 1. Background

REF[1]

With the iOS Device lock screen, the app icon appears in the lower left corner of the screen.

IOS 8 feature:location-based lockscreen App shortcuts appearing on IPhone

http://www.igeeksblog.com/ios-8-feature-location-based-lockscreen-app-shortcuts-appearing-on-iphone/

Can I get my IOS app to appear on the lower left corner of the "the lock screen?"

Http://stackoverflow.com/questions/25897219/can-i-get-my-ios-app-to-appear-on-the-lower-left-corner-of-the-lock-screen

2. Regional monitoring and ibeacon

REF[1]

The 2.1 Core location Framework provides two ways to detect (detect) a user entering and exiting a zone:

A) Geographical region monitoring (IOS 4.0+ OS X v10.8+)

B) Beacon Region Monitoring (IOS 7+)

Geographical region was an area defined by a circle of a specified radius around a known point on the Earth ' s surface.

Beacon Region is a area defined by the device's proximity to Bluetooth low-energy beacons.

Apps can use region monitoring to is notified when a user crosses geographic boundaries or when

A user enters or exits the vicinity of a beacon.

In IOS, regions associated with your app is tracked at all times and including when the app isn ' t running.

If a region boundary are crossed while an app isn ' t running, that app is relaunched into the background to handle The event.

Similarly, if the app is suspended when the event occurs, it's woken up and given a short amount of time (around Ten seconds)

To handle the event.

2.2 Determine if region monitoring (area monitoring) is available

A) The device does not have the necessary hardware to support RM.

B) The user rejects the app's authorization to use RM.

C) The user has turned off location services in the Settings app.

D) The user has turned off the "Background app refresh" feature in the "Settings" app.

E) The device cannot start the required hardware in airplane mode.

All of the above causes RM to be unavailable.

In iOS 7.0+, call and before monitoring the area isMonitoringAvailableForClass:authorizationStatus(CLLocationManager)。

In the previous iOS, call regionmonitoringavailable.

Method Ismonitoringavailableforclass: Use the return value to tell the app hardware whether a class of RM is supported. If you return yes, then call

Authorizationstatus to determine if the app has been authorized to use location services. If the status is kclauthorizationstatusauthorized,

The app can receive notifications for "crossing boundaries" (Boundary crossing). If status is a different value, the app will not receive these notifications.

"Finally, if your app needs to process location updates in the background, is sure to check the

backgroundRefreshStatusproperty of the UIApplication class. You can use the value of the

To determine if doing are possible and to warn the user if it isn't. Note that the system doesn ' t wake

Your app. Notifications when the Background app Refresh setting is disabled globally

or specifically for your app. " REF[1]

2.3 Monitoring geographic area (monitoring geographical regions)

Geographical region monitoring uses location services to detect entry and exit into known geographical locations.

2.3.1 define a monitored geographic area

Before you monitor a geographic region, you must define a region and register it with the system.

IOS 7.0+, defined using the Clcircularregion class. In previous versions of iOS, use the Clregion class.

Each region includes data that defines the geographic area and a unique ID. This ID is used to identify an area in the app.

Use Cllocationmanager method startmonitoringforregion: To register a zone.

Demo-1: Creating and registering a geographical region based on a Map Kit overlay

Monitoring of a geographical region begins immediately after registration for authorized apps.

However, don ' t expect to receive a event right away, because only boundarycrossings generate an event.

To check whether the user was already inside the boundary of aregion, use the method of the requestStateForRegion: CLLocationManager class.

"Regions is a GKFX system resource, and the total number of regions available systemwide is limited.

For this reason, Core location limits to the number of regions, which may be simultaneously monitored

By a single app. To work around this limit, consider registering only those regions in the user ' s immediate vicinity.

As the user ' s location changes, you can remove regions that is now farther and add regions coming

Up on the user s path. If you attempt to register a region and space are unavailable, the location manager calls the locationManager:monitoringDidFailForRegion:withError: method of its delegate W ith

kCLErrorRegionMonitoringFailurethe error code.

2.3.2 Handling events that traverse the boundaries of a geographic region
    • locationManager:didEnterRegion:

    • locationManager:didExitRegion:

3. Monitor Beacon Area

Beacons are identified by the following information:

Proximity uuid:a 128-bit value that uniquely identifies one or more beacons as a certain type or from a certain Organization.

Major Value:is a 16-bit unsigned integer that can is used to group related beacons that has the same proximity Uuid.

Minor value:is a 16-bit unsigned integer that differentiates beacons with the same proximity UUID and major value.

A beacon area can represent multiple beacons.

(Note that although every beacon must advertise a proximity UUID, major and minor values is optional.)

3.1 Defining the beacon area being monitored

Define the Beacon area using the Clbeaconregion class.

"Note that a region's identifier is unrelated to the identifying information that a beacon advertises."

Demo-2: Creating and registering a beacon region

"When a user's device detects a beacon that's advertising the identifying information defined by

The registered Beacon region (proximity UUID, major value, and minor value), the system generates

An appropriate region event for your app. "

3.2 Handling cross-border events in the Beacon area 3.3 Determining the Proximity of a beacon Using ranging

Startrangingbeaconsinregion:

Demo-3: Determining the relative distance between a beacon and a device

4. Convert your iOS device to ibeacon

REF[1]

"Any IOS device that supports sharing data using a Bluetooth low energy can is used as an iBeacon.

In the Core Bluetooth, a peripheral is a device that advertises and shares data using the Bluetooth low energy. Advertising your beacons ' s data is the only-to-devices can detect and range your beacon. [Ref[1]

Reference

1. <<location and Maps programming guide>> region monitoring and IBeacon

https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/LocationAwarenessPG/ Regionmonitoring/regionmonitoring.html

2. IOS 8 pushes location context to a new level:lock screens notifications triggered by IBeacon

Http://blog.estimote.com/post/97824495825/ios-8-pushes-location-context-to-a-new-level-lock

3. Core Bluetooth Programming Guide

Item

Region monitoring: regional monitoring, RM

Ios.location-based Service

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.