New Search APIs
Adding Search capabilities to Xamarin.iOS apps
- PDF for offline use
- Related Samples:
- Related SDKs:
Let us know how you feel about this
This article covers using the new App Search APIs provided by iOS 9 to allow users to search for information and features inside your Xamarin.iOS apps.
Search has been expanded in iOS 9 to provide great new ways to access information and features inside a Xamarin.iOS app. Using the new App Search APIs, app content is made searchable through Spotlight and Safari search results, Handoff and Siri Reminders and Suggestions. This allows users to quickly access activities and information deep within your app.
Additionally, the new Search APIs make it easier to integrate search in your app without prior search implementation experience. Because of this, Apple claims that it typically takes a few hours to make an iOS 9 app's content universally searchable using App Search.
App Search is composed of three separate APIs:
NSUserActivity - This is an extension of the Handoff API that Apple released in iOS 8. It is used to make app interaction history searchable both publicly and privately) by the user.
Core Spotlight - Allows an app to index its content to be presented in search results. It works like a database API where items can be added and removed and it is the best way to index private content within an app.
WebMarkup - For apps that provide access to their content via a web interface (not only from within the app). Web content can be marked up with special links that will be crawled by Apple and provide deep linking to your app on the user's iOS 9 device.
Selecting an App Search Approach
Deciding which of these methods to implement depends on the types of interaction provided by your app and the type of content it presents.
Use the following guidelines:
NSUserActivity – Use this framework to provide searchability for both public and private content and also searchability of navigation points within your app.
Core Spotlight – Use this framework to provide searchability for private data stored on the device.
Web Markup – Use this framework to provide searchability for apps that present their content not only from within the app, but from the app's website as well.
Each of the App Search approaches are distinct and can be used individually, however Apple designed them to work together. When using more than one approach to index a specific item, ensure that you use the same Item ID on each approach, so that individual links work together.
Using more than one approach not only ensures that your content will be found by the end user but also helps to improve your item's ranking from within search.
While the ranking process in mostly transparent to the developer, user interaction with a given item weighs heavily upon this rank (for example the user taping a link). By providing rich, informative items, you can ensure that a user will be enticed to interact with your content, thus raising its ranking.
What Content to Index
Apple provides the following suggestions as to what content and actions to provide search indexes for in your app:
- Any content viewed, created or curated by the user from within your app.
- Navigation points and features within the app.
- Things like new messages, content or other types of items displayed by your app that have recently been downloaded to the device.
This article has covered the new Search API features that iOS 9 provides for Xamarin.iOS apps. It covered NSUserActivity, Core Spotlight and Web Markup methods for indexing content. It finished with a short discussion of when a given search approach should be used and what types of content should be indexed.