Exploring all of the great APIs that Google Play services has to offer and will deep dive into Google Search and App Indexing to help you connect to your users like never before. You will see how to easily integrate the App Indexing SDK into your Xamarin.Android and Xamarin.Forms apps to create deep links between your content and web content. Keep your users in your app and coming back for more.
3. Let’s go back to 1997!
• TV:
• South Park, Buffy the Vampire Slayer, & King of the Hill
• Movies:
• Star Wars Episode IV - VI theatrical re-releases!
• Titanic grossed over $1 billion
• Starship Troopers releases!
• Games:
• Final Fantasy VII releases! Sells 2M in 3 days!
• GoldenEye 007 destroys my childhood
• Me:
• I turned 11!
• I got hooked on Tamagotchi
• I found the Internet!
20. iOS Search APIs
NSUserActivity
• Handoff Enabled
• Pieces of Content
& Pages
• When user views
• Ability to save
state of screen
• Less Data
• More Functionality
Core Spotlight
• Pre-Indexing Entire
App’s Content
• Full set or Part of
set
• More Data
• Less Functionality
Web Markup
• Deep linking
from web
23. NSUserActivity CreateActivity()
{
var activity = new NSUserActivity("com.xamarin.monkeys.monkey" );
activity.EligibleForSearch = true;
activity.EligibleForPublicIndexing = true;
activity.EligibleForHandoff = false;
activity.Title = monkey.Name;
activity.Keywords = new NSSet<NSString>(new NSString(monkey.Name),
new NSString("Monkey"));
var attributeSet = new CoreSpotlight.CSSearchableItemAttributeSet ();
attributeSet.ContentDescription = monkey.Details;
activity.ContentAttributeSet = attributeSet;
var info = NSDictionary.FromObjectAndKey(new NSString(monkey.Name),
new NSString("Name"));
activity.AddUserInfoEntries(info);
return activity;
Create Activity
24. public override void ViewWillAppear()
{
base.ViewWillAppear();
UserActivity = CreateActivity();
UserActivity.BecomeCurrent();
}
public override void ViewWillDisappear(bool animated)
{
base.ViewWillDisappear(animated);
UserActivity.ResignCurrent();
}
Set Activity
25. public override void UpdateUserActivityState (NSUserActivity activity)
{
// update activity
var info = NSDictionary.FromObjectAndKey(new NSString(monkey.Name),
new NSString("Name"));
activity.AddUserInfoEntries(info);
base.UpdateUserActivityState (activity);
}
Update State
26. Respond
public override bool ContinueUserActivity (UIApplication application,
NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler)
{
// Take action based on the activity type
switch (userActivity.ActivityType) {
case "com.xamarin.monkeys.monkey":
var uid = userActivity.UserInfo.ObjectForKey((NSString)"Name").ToString();
break;
}
return true;
}
29. •iOS
• Promote Search Results
• Deep Link Content
• Enhance Display Elements
App Indexing Features
•Android
• Promote Search Results
• Deep Link Content
• Enhance Display Elements
• Drive Installs: better ranking
signal for all Urls
• Query Auto completions
• Now on Tap
30. • In Google Search
Search Better
• Connect your Site to App
31. Add support for links (http) and App
Indexing API in app
How to index your app
1
2
3
Verify you app against your site on
Google Play Developer Console
Publish links (over API)
32.
33. Add IntentFilter
[IntentFilter(new []{ Intent.ActionView },
Categories = new []
{
Android.Content.Intent.CategoryDefault,
Android.Content.Intent.CategoryBrowsable
},
DataScheme = "http",
DataHost = "monkeysapp.com",
DataPathPrefix ="/Home/Detail/")]
public class MainActivity : BaseActivity
{
}
34. Handle Intent
protected override void OnNewIntent(Intent intent)
{
base.OnNewIntent(intent);
var action = intent.Action;
var data = intent.DataString;
if (Intent.ActionView != action || string.IsNullOrWhiteSpace(data))
return;
//only if deep linking
if (!data.Contains("/Home/Detail/"))
return;
var monkeyId = data.Substring(
data.LastIndexOf("/", StringComparison.Ordinal) + 1).Replace("%20", " ");
if (!string.IsNullOrWhiteSpace(monkeyId))
{
var i = new Intent(this, typeof(DetailsActivity));
i.PutExtra("Name", monkeyId);
StartActivity(i);
}
56. Don’t let your app get lost!
• Leverage Search and have your users coming back for more
• Connect your website and mobile app for a rich experience
• Add unique features to bring more users