I have working on App Indexing feature in my app and following the Google Developers guide. From the guide I have sticking on the following.
// Create App Indexing Link objects
AppIndexingLink item1 = new AppIndexingLink(appUri1, webUrl1, this.findViewById(R.id.btn1));
AppIndexingLink item2 = new AppIndexingLink(appUri2, webUrl2, this.findViewById(R.id.btn2));
From the above statements we can notice the parameters.
My Query on this:
- In that document they mentioned the web URL is optional. But when I remove that gives compilation error and if I make it empty ("") gives NullPointerException (Not sure the empty causes the NullPointerException )
2.The btn1 and btn2, where should we get those from? Why we have give them there? . If I give any view from my project yields NullPointerException(This is the situation which makes me not sure on the first one).
If any one have tutorial AND sample codes to enable the App Indexing , kindly provide it. Its may help us.
1-webUrl1 is a object of Uri type you need to parse some url ex use your google play url
2-btn1 and btn2 can be any view the user is viewing example a image view or a text view containign some text