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 about 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.

comments powered by Disqus
Cf68cdaaf75f9cd1417267c6b1cafb3813c488a1 Virtual Reality Applications
Augmented reality apps are widely used – from geolocalization to using it in gaming industry. Augmented reality app is a new way to access data determined by environment conditions.
754d17aa02f8c56a0e0b671d45bf2455f6177062 Agile Methodology (Scrum)
Scrum is the very popular agile methodology for managing product development and project delivery. Scrum is the framework that could be applied for the development of product use cases, different projects or entire products.
1a1b621bfd24aba09a56bb25cf18719ad46ef190 News App Development
Smartphones are regularly used everywhere & anytime: in cars, on the way to the office, during the rest on holidays or weekends. That’s very convenient way for users to access important or just fun information with the help of news mobile app.
D63ac21dfd17c4acc93d52d9bdc72fea10e84edd Geolocation Services in Mobile Tracking Software
Geolocation services are used by many mobile apps, websites, mobile operators etc.