blob: b6def2a0d7753079bcf4434bbfdb44be97c06db6 [file] [log] [blame]
package com.example.creation;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import com.google.android.gms.appindexing.Action;
import com.google.android.gms.appindexing.AppIndex;
import com.google.android.gms.common.api.GoogleApiClient;
public class MainActivity extends Activity {
/**
* ATTENTION: This "addApi(AppIndex.API)" was auto-generated to implement the App Indexing API.
* See https://g.co/AppIndexing/AndroidStudio for more information.
*/
private GoogleApiClient client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
@Override
public 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();
Action viewAction = Action.newAction(
Action.TYPE_VIEW,// TODO: choose an action type.
"Main Page",// TODO: Define a title for the content shown.
// TODO: If you have web page content that matches this app activity's content,
// make sure this auto-generated web page URL is correct.
// Otherwise, set the URL to null.
Uri.parse("http://www.example.com/main"),
// TODO: Make sure this auto-generated app deep link URI is correct.
Uri.parse("android-app://com.example.creation/http/www.example.com/main")
);
AppIndex.AppIndexApi.start(client, viewAction);
}
@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.
Action viewAction = Action.newAction(
Action.TYPE_VIEW,// TODO: choose an action type.
"Main Page",// TODO: Define a title for the content shown.
// TODO: If you have web page content that matches this app activity's content,
// make sure this auto-generated web page URL is correct.
// Otherwise, set the URL to null.
Uri.parse("http://www.example.com/main"),
// TODO: Make sure this auto-generated app deep link URI is correct.
Uri.parse("android-app://com.example.creation/http/www.example.com/main")
);
AppIndex.AppIndexApi.end(client, viewAction);
client.disconnect();
}
}