예제 #1
0
        async Task IndexItemAsync(IAppLinkEntry appLink)
        {
            IndexingAction indexAction = BuildIndexAction(appLink);

            if (_client.IsConnected && appLink.IsLinkActive)
            {
                Statuses resultStart = await AppIndex.AppIndexApi.StartAsync(_client, indexAction);

                if (resultStart.IsSuccess)
                {
                    var aL = appLink as AppLinkEntry;
                    if (aL != null)
                    {
                        aL.PropertyChanged += async(sender, e) =>
                        {
                            if (e.PropertyName == AppLinkEntry.IsLinkActiveProperty.PropertyName)
                            {
                                if (appLink.IsLinkActive)
                                {
                                    Statuses resultStartAgain = await AppIndex.AppIndexApi.StartAsync(_client, indexAction);
                                }
                                else
                                {
                                    Statuses resultEnd = await AppIndex.AppIndexApi.EndAsync(_client, indexAction);
                                }
                            }
                        };
                    }
                }
            }
        }
예제 #2
0
        protected override async void OnStop()
        {
            // Call End() and disconnect the client
            var title      = "View Recipes";
            var viewAction = AppIndexingAction.NewAction(Android.Gms.AppIndexing.Action.TypeView, title, WEB_URL, APP_URI);

            await AppIndex.AppIndexApi.EndAsync(googleApiClient, viewAction);

            googleApiClient.Disconnect();

            base.OnStop();
        }
예제 #3
0
        protected override async void OnStart()
        {
            base.OnStart();

            googleApiClient.Connect();

            // Define a title for your current page, shown in autocompletion UI
            var title = "View Recipes";

            // Construct the Action performed by the user
            var viewAction = AppIndexingAction.NewAction(Android.Gms.AppIndexing.Action.TypeView, title, WEB_URL, APP_URI);

            // Call the App Indexing API start method after the view has completely rendered
            await AppIndex.AppIndexApi.StartAsync(googleApiClient, viewAction);
        }