com.google.android.gms.appindexing.AppIndex Java Examples

The following examples show how to use com.google.android.gms.appindexing.AppIndex. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OcrCaptureActivity.java    From Document-Scanner with GNU General Public License v3.0 6 votes vote down vote up
@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.
            "OcrCapture 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://host/path"),
            // TODO: Make sure this auto-generated app URL is correct.
            Uri.parse("android-app://com.myapps.documentscanner/http/host/path")
    );
    AppIndex.AppIndexApi.end(client, viewAction);
    client.disconnect();
}
 
Example #2
Source File: ArtistActivity.java    From io2014-codelabs with Apache License 2.0 6 votes vote down vote up
private void recordAppIndexingViewEnd() {
    PendingResult<Status> result = AppIndex.AppIndexApi.viewEnd(
            mGoogleApiClient,
            ArtistActivity.this,
            getIntent());

    result.setResultCallback(new ResultCallback<Status>() {
        @Override
        public void onResult(Status status) {
            if (status.isSuccess()) {
                Log.d(TAG, "App Indexing API: Recorded artist "
                        + mArtist.getName() + " view end successfully.");
            } else {
                Log.e(TAG, "App Indexing API: There was an error recording the artist view."
                        + status.toString());
            }
        }
    });
}
 
Example #3
Source File: ArtistActivity.java    From io2014-codelabs with Apache License 2.0 6 votes vote down vote up
private void recordAppIndexingView() {
    PendingResult<Status> result = AppIndex.AppIndexApi.view(
            mGoogleApiClient,
            ArtistActivity.this,
            getIntent(),
            mArtist.getName(),
            Uri.parse(mArtist.getUrl()),
            null);

    result.setResultCallback(new ResultCallback<Status>() {
        @Override
        public void onResult(Status status) {
            if (status.isSuccess()) {
                Log.d(TAG, "App Indexing API: Recorded artist "
                        + mArtist.getName() + " view successfully.");
            } else {
                Log.e(TAG, "App Indexing API: There was an error recording the artist view."
                        + status.toString());
            }
        }
    });

}
 
Example #4
Source File: MainActivity.java    From PolarHeartRateApplication with MIT License 6 votes vote down vote up
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://host/path"),
            // TODO: Make sure this auto-generated app URL is correct.
            Uri.parse("android-app://org.marco45.polarheartmonitor/http/host/path")
    );
    AppIndex.AppIndexApi.end(client, viewAction);
    client.disconnect();
}
 
Example #5
Source File: MainActivity.java    From PolarHeartRateApplication with MIT License 6 votes vote down vote up
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();
    // 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://host/path"),
            // TODO: Make sure this auto-generated app URL is correct.
            Uri.parse("android-app://org.marco45.polarheartmonitor/http/host/path")
    );
    AppIndex.AppIndexApi.start(client, viewAction);
}
 
Example #6
Source File: RecipeActivity.java    From search-samples with Apache License 2.0 6 votes vote down vote up
@Override
public void onStop(){
    super.onStop();

    if (recipe != null) {
        final Uri APP_URI = BASE_APP_URI.buildUpon().appendPath(recipe.getId()).build();
        PendingResult<Status> result = AppIndex.AppIndexApi.viewEnd(mClient, this, APP_URI);

        result.setResultCallback(new ResultCallback<Status>() {
            @Override
            public void onResult(Status status) {
                if (status.isSuccess()) {
                    Log.d(TAG, "App Indexing API: Recorded recipe "
                            + recipe.getTitle() + " view end successfully.");
                } else {
                    Log.e(TAG, "App Indexing API: There was an error recording the recipe view."
                            + status.toString());
                }
            }
        });

        mClient.disconnect();
    }
}
 
Example #7
Source File: SettingActivity.java    From dttv-android with GNU General Public License v3.0 6 votes vote down vote up
@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.
            "Setting 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://host/path"),
            // TODO: Make sure this auto-generated app URL is correct.
            Uri.parse("android-app://dttv.app/http/host/path")
    );
    AppIndex.AppIndexApi.end(client, viewAction);
    client.disconnect();
}
 
Example #8
Source File: SettingActivity.java    From dttv-android with GNU General Public License v3.0 6 votes vote down vote up
@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.
            "Setting 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://host/path"),
            // TODO: Make sure this auto-generated app URL is correct.
            Uri.parse("android-app://dttv.app/http/host/path")
    );
    AppIndex.AppIndexApi.start(client, viewAction);
}
 
Example #9
Source File: RecipeActivity.java    From io2015-codelabs with Apache License 2.0 6 votes vote down vote up
@Override
public void onStop(){
    super.onStop();

    if (recipe != null) {
        final Uri APP_URI = BASE_APP_URI.buildUpon().appendPath(recipe.getId()).build();
        PendingResult<Status> result = AppIndex.AppIndexApi.viewEnd(mClient, this, APP_URI);

        result.setResultCallback(new ResultCallback<Status>() {
            @Override
            public void onResult(Status status) {
                if (status.isSuccess()) {
                    Log.d(TAG, "App Indexing API: Recorded recipe "
                            + recipe.getTitle() + " view end successfully.");
                } else {
                    Log.e(TAG, "App Indexing API: There was an error recording the recipe view."
                            + status.toString());
                }
            }
        });

        mClient.disconnect();
    }
}
 
Example #10
Source File: RecipeActivity.java    From io2015-codelabs with Apache License 2.0 6 votes vote down vote up
@Override
public void onStop(){
    if (recipe != null) {
        final String TITLE = recipe.getTitle();
        final Uri APP_URI = BASE_APP_URI.buildUpon().appendPath(recipe.getId()).build();

        Action viewAction = Action.newAction(Action.TYPE_VIEW, TITLE, APP_URI);
        PendingResult<Status> result = AppIndex.AppIndexApi.end(mClient, viewAction);

        result.setResultCallback(new ResultCallback<Status>() {
            @Override
            public void onResult(Status status) {
                if (status.isSuccess()) {
                    Log.d(TAG, "App Indexing API: Recorded recipe "
                            + recipe.getTitle() + " view end successfully.");
                } else {
                    Log.e(TAG, "App Indexing API: There was an error recording the recipe view."
                            + status.toString());
                }
            }
        });

        mClient.disconnect();
        super.onStop();
    }
}
 
Example #11
Source File: MyActivity.java    From AndroidLEDcontrol with MIT License 6 votes vote down vote up
@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.
            "My Page", // TODO: Define a title for the content shown.
            // TODO: If you have web page content that matches this app activity's content,

            Uri.parse("http://host/path"),
            // TODO: Make sure this auto-generated app deep link URI is correct.
            Uri.parse("android-app://com.hishri.fnarduino/http/host/path")
    );
    AppIndex.AppIndexApi.end(client, viewAction);
    client.disconnect();
}
 
Example #12
Source File: OcrCaptureActivity.java    From Document-Scanner with GNU General Public License v3.0 6 votes vote down vote up
@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.
            "OcrCapture 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://host/path"),
            // TODO: Make sure this auto-generated app URL is correct.
            Uri.parse("android-app://com.myapps.documentscanner/http/host/path")
    );
    AppIndex.AppIndexApi.start(client, viewAction);
}
 
Example #13
Source File: MainActivity.java    From chaoli-forum-for-android-2 with GNU General Public License v3.0 6 votes vote down vote up
@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 mTitle 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://host/path"),
			// TODO: Make sure this auto-generated app URL is correct.
			Uri.parse("android-app://com.daquexian.chaoli.forum/http/host/path")
	);
	AppIndex.AppIndexApi.end(client, viewAction);
	client.disconnect();
}
 
Example #14
Source File: MainActivity.java    From chaoli-forum-for-android-2 with GNU General Public License v3.0 6 votes vote down vote up
@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 mTitle 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://host/path"),
			// TODO: Make sure this auto-generated app URL is correct.
			Uri.parse("android-app://com.daquexian.chaoli.forum/http/host/path")
	);
	AppIndex.AppIndexApi.start(client, viewAction);
}
 
Example #15
Source File: MainActivity.java    From chaoli-forum-for-android-2 with GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	if (NightModeHelper.getViewModel() == null) {
		viewModel = new MainActivityVM();
		setViewModel(viewModel);
		addCallbacks();
		viewModel.setChannel("all");
		viewModel.startUp();
	} else {
		viewModel = (MainActivityVM) NightModeHelper.getViewModel();	// remove the reference to ViewModel in NightModeHelper later in initUI
		setViewModel(viewModel);
		addCallbacks();
	}

	initUI(savedInstanceState);

	// ATTENTION: This was auto-generated to implement the App Indexing API.
	// See https://g.co/AppIndexing/AndroidStudio for more information.
	client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
}
 
Example #16
Source File: MainActivity.java    From Android-Audio-Recorder with Apache License 2.0 6 votes vote down vote up
@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://host/path"),
            // TODO: Make sure this auto-generated app deep link URI is correct.
            Uri.parse("android-app://com.github.axet.audiorecorder/http/host/path")
    );
    AppIndex.AppIndexApi.end(client, viewAction);
    client.disconnect();
}
 
Example #17
Source File: MainActivity.java    From ibm-wearables-android-sdk with Apache License 2.0 6 votes vote down vote up
@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://host/path"),
            // TODO: Make sure this auto-generated app URL is correct.
            Uri.parse("android-app://com.ibm.mobilefirst.mobileedge.demoapp/http/host/path")
    );
    AppIndex.AppIndexApi.end(client, viewAction);
    client.disconnect();
}
 
Example #18
Source File: MainActivity.java    From ibm-wearables-android-sdk with Apache License 2.0 6 votes vote down vote up
@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://host/path"),
            // TODO: Make sure this auto-generated app URL is correct.
            Uri.parse("android-app://com.ibm.mobilefirst.mobileedge.demoapp/http/host/path")
    );
    AppIndex.AppIndexApi.start(client, viewAction);

}
 
Example #19
Source File: MainActivity.java    From Android-Audio-Recorder with Apache License 2.0 6 votes vote down vote up
@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://host/path"),
            // TODO: Make sure this auto-generated app deep link URI is correct.
            Uri.parse("android-app://com.github.axet.audiorecorder/http/host/path")
    );
    AppIndex.AppIndexApi.start(client, viewAction);
}
 
Example #20
Source File: RecipeActivity.java    From io2015-codelabs with Apache License 2.0 5 votes vote down vote up
@Override
public void onStart(){
    super.onStart();
    if (recipe != null) {
        // Connect your client
        mClient.connect();

        // Define a title for your current page, shown in autocompletion UI
        final String TITLE = recipe.getTitle();
        final Uri APP_URI = BASE_APP_URI.buildUpon().appendPath(recipe.getId()).build();

        Action viewAction = Action.newAction(Action.TYPE_VIEW, TITLE, APP_URI);

        // Call the App Indexing API view method
        PendingResult<Status> result = AppIndex.AppIndexApi.start(mClient, viewAction);

        result.setResultCallback(new ResultCallback<Status>() {
            @Override
            public void onResult(Status status) {
                if (status.isSuccess()) {
                    Log.d(TAG, "App Indexing API: Recorded recipe "
                            + recipe.getTitle() + " view successfully.");
                } else {
                    Log.e(TAG, "App Indexing API: There was an error recording the recipe view."
                            + status.toString());
                }
            }
        });
    }
}
 
Example #21
Source File: BrowserActivity.java    From EFRConnect-android with Apache License 2.0 5 votes vote down vote up
@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.
    //Log.d("onStop","Called");
    AppIndex.AppIndexApi.end(client, getIndexApiAction());
    client.disconnect();
}
 
Example #22
Source File: DeviceServicesActivity.java    From EFRConnect-android with Apache License 2.0 5 votes vote down vote up
@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();
    AppIndex.AppIndexApi.start(client, getIndexApiAction());
}
 
Example #23
Source File: DeviceServicesActivity.java    From EFRConnect-android with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #24
Source File: LinkMobileActivity.java    From Android with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_set_link);
    ButterKnife.bind(this);
    // ATTENTION: This was auto-generated to implement the App Indexing API.
    // See https://g.co/AppIndexing/AndroidStudio for more information.
    client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
}
 
Example #25
Source File: LinkMobileActivity.java    From Android with MIT License 5 votes vote down vote up
@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();
        initView();
        // 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());
    }
 
Example #26
Source File: RecipeActivity.java    From search-samples with Apache License 2.0 5 votes vote down vote up
@Override
public void onStart(){
    super.onStart();

    if (recipe != null) {
        // Connect your client
        mClient.connect();

        // Define a title for your current page, shown in autocompletion UI
        final String TITLE = recipe.getTitle();
        final Uri APP_URI = BASE_APP_URI.buildUpon().appendPath(recipe.getId()).build();
        final Uri WEB_URL = Uri.parse(recipe.getUrl());

        // Call the App Indexing API view method
        PendingResult<Status> result = AppIndex.AppIndexApi.view(mClient, this,
                APP_URI, TITLE, WEB_URL, null);

        result.setResultCallback(new ResultCallback<Status>() {
            @Override
            public void onResult(Status status) {
                if (status.isSuccess()) {
                    Log.d(TAG, "App Indexing API: Recorded recipe "
                            + recipe.getTitle() + " view successfully.");
                } else {
                    Log.e(TAG, "App Indexing API: There was an error recording the recipe view."
                            + status.toString());
                }
            }
        });
    }
}
 
Example #27
Source File: RecipeActivity.java    From search-samples with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_recipe);

    mClient = new GoogleApiClient.Builder(this).addApi(AppIndex.APP_INDEX_API).build();

    onNewIntent(getIntent());
}
 
Example #28
Source File: LinkMobileActivity.java    From Android with MIT License 5 votes vote down vote up
@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();
}
 
Example #29
Source File: SettingActivity.java    From dttv-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //addPreferencesFromResource(R.xml.setting_preference);
    getFragmentManager().beginTransaction().replace(android.R.id.content,
            new MyPreferenceFragment()).commit();
    // ATTENTION: This was auto-generated to implement the App Indexing API.
    // See https://g.co/AppIndexing/AndroidStudio for more information.
    client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
}
 
Example #30
Source File: ToDayStateActivity.java    From ToDay with MIT License 5 votes vote down vote up
@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();
    AppIndex.AppIndexApi.start(client, getIndexApiAction());
}