package com.jens.automation2; import android.net.Uri; import com.google.android.gms.appindexing.AppIndex; import com.google.android.gms.appindexing.Thing; import com.google.android.gms.common.api.GoogleApiClient; public class MyGoogleApiClient { private static GoogleApiClient client; public static void start() { client = new GoogleApiClient.Builder(Miscellaneous.getAnyContext()).addApi(AppIndex.API).build(); } public com.google.android.gms.appindexing.Action getIndexApiAction() { Thing object = new Thing.Builder() .setName("ActivityMainScreen Page") // TODO: Define a title for the content shown. // TODO: Make sure this auto-generated URL is correct. .setUrl(Uri.parse("http://[ENTER-YOUR-URL-HERE]")) .build(); return new com.google.android.gms.appindexing.Action.Builder(com.google.android.gms.appindexing.Action.TYPE_VIEW) .setObject(object) .setActionStatus(com.google.android.gms.appindexing.Action.STATUS_TYPE_COMPLETED) .build(); } /*@Override protected void onStart() { super.onStart();// ATTENTION: This was auto-generated to implement the App Indexing API. // See https://g.co/AppIndexing/AndroidStudio for more information. client.connect(); toggleService.setChecked(AutomationService.isMyServiceRunning(this)); ActivityMainScreen.updateMainScreen(); // ATTENTION: This was auto-generated to implement the App Indexing API. // See https://g.co/AppIndexing/AndroidStudio for more information. AppIndex.AppIndexApi.start(client, getIndexApiAction()); } @Override public void onStop() { super.onStop(); // ATTENTION: This was auto-generated to implement the App Indexing API. // See https://g.co/AppIndexing/AndroidStudio for more information. AppIndex.AppIndexApi.end(client, getIndexApiAction()); client.disconnect(); }*/ }