For Adding this to project you can find official doc easily but in this example I'm going to highlight some of the key areas to be taken care of.
Step 1 :- Add google service
dependencies {
...
compile 'com.google.android.gms:play-services-appindexing:9.4.0'
...
}
Step...