Home   →   Blog   →   Technical Introduction to Apple’s HandOff

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.

Next Posts
Bccf51b0691ed4412b8d8f74f89622be511c72e6 Interesting Facts About Mobile Technologies
I think each reader has a mobile phone (90% of you – smartphones) on the table, in a bag, in your pocket, under your pillow. Such term of military and government officials as "mobilization" has become a favorite catchword of marketers and developers.
1ab000fbd6a1796435389b4321ab227e090cc832 Android Widgets
Android widgets are small applications that can be embedded in other applications such as the home screen or the lock screen view.
7956a459e1952ff85668d5e7d06f8171dbbb2583 Introduction to Apple’s App Extensions
Apple’s App Extensions (Actions vs Share Extensions): new IOS version (iOS 8) provides the flexible way for the developer to include several additional components into the application context. Read the article more to find the details.
Notice Our website uses cookies, which are necessary for its functioning and required to achieve the purposes illustrated in the privacy policy. By closing this banner you agree to the use of cookies.