Technical Introduction to Apple’s HandOff

During the last Apple presentation there were a lot of talks about a new Handoff feature. Its main purpose is to share information between different Apple devices using the same Apple ID. For example, starting to work on the iPad user might switch it to the Mac and continue doing the same task on another device.

This release of Handoff works with the most important Apple’s applications.
- Safari opens the page you’ve just read;
- Apple Maps could display the same address and you don’t need to take care of the map scale. The application will do this itself;
- Calendar could open the agenda by the date you looked for;
- Pages, Numbers, Keynote allow editing from the same place on the document;
- Mail allows to continue writing your emails;
- Messages do the trick for lazy typing. It opens the draft message on another device;
- Reminders open the same list and Contacts application displays the same contact.
 

There are a few technical requirements to use Handoff on your devices. Your computer must be running by OS X Yosemite, iPad, iPhone or iPod Touch should use iOS 8. Your devices should be listed in the same iCloud account and support Bluetooth 4.0 LE.

iOS developers might be interested to use Handoff features on their own applications. Handoff is based on the concept of User Activity. User Activity is independent piece of information and it can be freely transferred. Apple’s NSUserActivity class is the implementation of this concept, it represents the state of the application.

There are a few main components of NSUserActivity:

- ActivityType is an unique string identifier represented by Reverse DNS notation. For Example, «com.agilie.exampleapp.addFriends» All activity types should be included in Info.plist configuration file.

- UserInfo is the dictionary to store application data. By this information the application will restore the state on another device. For example, we might store information about user friends. @ {" exampleapp.participants.key": @ [ «John Smith”, «Bill Jones", «Andy Robson"]} UserInfo allows us to store native data types like NSArray, NSData, NSDate, NSDictionary, NSNull, NSNumber, NSSet, NSString, NSUUID, and NSURL.

Mobile application developers could implement a few methods to start use these components. Current UIViewController should start the activity by invocation of becomeCurrent() method. To get periodically updates this UIViewController should overwrite the method updateUserActivityState (activity :)

The target device needs to handle the start by AppDelegate’s methods application: willContinueUserActivityWithType: and application: continueUserActivity: restorationHandler: The first method tells the application about user activity by some type and starts to load the data. The second method is called when the data from UserInfo is loaded and we can restore the state of the application.

As you can see Handoff implementation is quite simple and transparent. Our future experience in mobile apps developing will show if Handoff provides to the users the benefits or will remain as another cool but unpopular innovation from Apple.

Rate this article
15 ratings, average 4.80 of out 5
Table of contents
Get in touch
Related articles
How to Reduce App Development Cost
How to Reduce App Development Cost

Mobile

4 min read

Interesting Facts About Mobile Technologies
Interesting Facts About Mobile Technologies

Mobile

4 min read

8 Latest Crypto Fundraising Trends That Shape 2024
8 Latest Crypto Fundraising Trends That Shape 2024

Blockchain

8 min read

How to Reduce App Development Cost
How to Reduce App Development Cost

Mobile

4 min read

Interesting Facts About Mobile Technologies
Interesting Facts About Mobile Technologies

Mobile

4 min read