Don't let your mobile app get lost - iOS Spotlight and App Indexing

57
Don't Let Your Mobile App Get Lost James Montemagno Developer Evangelist, Xamarin

Transcript of Don't let your mobile app get lost - iOS Spotlight and App Indexing

Page 1: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

Don't Let Your Mobile App Get Lost

James MontemagnoDeveloper Evangelist, Xamarin

Page 2: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

Who’s this guy?

JamesMontemagnoDeveloperEvangelist,Xamarin

[email protected] motzcod.es @JamesMontemagno

Page 3: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

Let’s go back to 1997!

• TV: • SouthPark,BuffytheVampireSlayer,&KingoftheHill

• Movies:• StarWarsEpisodeIV- VItheatricalre-releases!• Titanicgrossedover$1billion• StarshipTroopersreleases!

• Games:• FinalFantasyVIIreleases!Sells2Min3days!• GoldenEye 007destroysmychildhood

• Me:• Iturned11!• IgothookedonTamagotchi• IfoundtheInternet!

Page 4: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

The Internet in 1997!

Page 5: Don't let your mobile app get lost  - iOS Spotlight and App Indexing
Page 6: Don't let your mobile app get lost  - iOS Spotlight and App Indexing
Page 7: Don't let your mobile app get lost  - iOS Spotlight and App Indexing
Page 8: Don't let your mobile app get lost  - iOS Spotlight and App Indexing
Page 9: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

App Stores Today

Page 10: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

We Apps!

189Mdownloads

a day

200mins on phone

127mins in

apps

Page 11: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

How many do we actually use?

Page 12: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

The average app user has 36 apps installed on his or her phone.

Page 13: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

Only 1/4 are used daily:

Page 14: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

1/4 of apps are never used!

Page 15: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

My Phone

117 Apps107 “Non-system” Apps!

Page 16: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

Used Today

17

Page 17: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

Mobile search is a key way for users to discover and engage with your app’s content.

Page 18: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

Discover & Engage

Page 19: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

SDKs in our toolkit:

• iOS Spotlight Search• Google App Indexing• More:• FacebookAppLinks• TwitterCards• Schema.org Actions• iOSUniversalLinking

Page 20: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

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

Page 21: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

NSUserActivity: Index Activities

Page 22: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

NSUserActivity

• Set “Activity”• Add metadata• Save “Activity”

Page 23: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

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

Page 24: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

public override void ViewWillAppear(){

base.ViewWillAppear();

UserActivity = CreateActivity();UserActivity.BecomeCurrent();

}

public override void ViewWillDisappear(bool animated){

base.ViewWillDisappear(animated);UserActivity.ResignCurrent();

}

Set Activity

Page 25: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

public override void UpdateUserActivityState (NSUserActivity activity){

// update activityvar info = NSDictionary.FromObjectAndKey(new NSString(monkey.Name),

new NSString("Name"));activity.AddUserInfoEntries(info);

base.UpdateUserActivityState (activity);}

Update State

Page 26: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

Respondpublic override bool ContinueUserActivity (UIApplication application,

NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler){

// Take action based on the activity typeswitch (userActivity.ActivityType) {

case "com.xamarin.monkeys.monkey":var uid = userActivity.UserInfo.ObjectForKey((NSString)"Name").ToString();

break;}

return true;}

Page 27: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

Let’s Search Monkeys!

Page 28: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

Google App Indexing

• Put your app in front of users in Google Search

Page 29: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

• 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

Page 30: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

• In Google SearchSearch Better

• Connect your Site to App

Page 31: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

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)

Page 32: Don't let your mobile app get lost  - iOS Spotlight and App Indexing
Page 33: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

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{}

Page 34: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

Handle Intentprotected 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 linkingif (!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);

}}

Page 35: Don't let your mobile app get lost  - iOS Spotlight and App Indexing
Page 36: Don't let your mobile app get lost  - iOS Spotlight and App Indexing
Page 37: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

google.com/webmasters

Page 38: Don't let your mobile app get lost  - iOS Spotlight and App Indexing
Page 39: Don't let your mobile app get lost  - iOS Spotlight and App Indexing
Page 40: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

Install App Indexing NuGet

Page 41: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

Create “Content Action”GoogleApiClient client;protected override void OnCreate(Android.OS.Bundle savedInstanceState){

base.OnCreate(savedInstanceState);client = new GoogleApiClient.Builder(this).AddApi(AppIndex.API).Build();

}

public IndexingAction AppIndexAction{

get{

var item = new Thing.Builder().SetName(title).SetDescription(description).SetUrl(Android.Net.Uri.Parse(url)).SetType(schemaType).SetId(url).Build();

var thing = new IndexingAction.Builder(IndexingAction.TypeView).SetObject(item).SetActionStatus(IndexingAction.StatusTypeCompleted).Build();

return thing.JavaCast<IndexingAction>();}

Page 42: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

Index the Contentprotected override async void OnStart(){

base.OnStart();client.Connect();await AppIndex.AppIndexApi.StartAsync(client, AppIndexAction);

}

protected override async void OnStop(){

base.OnStop();await AppIndex.AppIndexApi.EndAsync(client, AppIndexAction);client.Disconnect();

}

Page 43: Don't let your mobile app get lost  - iOS Spotlight and App Indexing
Page 44: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

Test Integration in Console

Page 45: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

Let’s Search More Monkeys!

Page 46: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

iOS 9 App Indexing?

• Simply Add Universal Links (Web Markup)• Integrate Deep Links in ApplicationDelegate• Add app-to-site association in Info.plist• Install App Indexing Component for iOS• Call: GSDAppIndexing.SharedInstance.RegisterApp(“ITUNES_ID”);• DONE!

Page 47: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

We can do more!

• Developer Accounts• Google Search• Voice Interactions• App Invites

Page 48: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

Developer Accounts

Turn This:

Page 49: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

Developer Accounts

Into this:

Page 50: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

Google Developer Console

Page 51: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

OK Google,

https://blog.xamarin.com/add-a-conversation-to-your-android-app-with-voice-interactions/

Page 52: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

Voice Interactions

– Build conversational voice experiences into app

– Extend System Voice Actions– Interact with your users

Page 53: Don't let your mobile app get lost  - iOS Spotlight and App Indexing
Page 54: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

App Invites– Allow users to share apps– Email or SMS– Deep Link Content– Provide exclusive content

Page 55: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

App Invites

Page 56: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

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

Page 57: Don't let your mobile app get lost  - iOS Spotlight and App Indexing

Thankyou.

JamesMontemagnoDeveloper Evangelist, Xamarin

[email protected] motzcod.es @JamesMontemagno

slideshare.net/JamesMontemagno