Indexing applications for dynamic content

My application has one action. The application has a list box, which is populated by my content provider. In the box, the user can select an item, and then the activity will be filled dynamically with the corresponding content. I am not sure how to implement application indexing in this case. I mean based on step 3 of the tutorial , is it expected that the activity seems to show one content (am I mistaken about this)?

Note. I already have work with deep connections (I have a website and a content map for the content in the application).

In particular, I am interested in dynamically changing the following every time the user changes the content:

mUrl = "http://examplepetstore.com/dogs/standard-poodle"; mTitle = "Standard Poodle"; mDescription = "The Standard Poodle stands at least 18 inches at the withers"; 

And if so, what about the fact that I only need to call once (only on onStart). And again, my data is downloaded from the content provider. The provider itself is loaded from the server, but this call loads everything - unlike just loading a single page.

+5
source share
1 answer

AFAIK, you must connect your GoogleApiClient once per activity. However, you can index your dynamic content as much as you want (but it’s better not to index the content too many times), just remember to turn them off when your activity ends. The following is what I did in my project:

 HashMap<String, Action> indexedActions; HashMap<String, Boolean> indexedStatuses; public void startIndexing(String mTitle, String mDescription, String id) { if (TextUtils.isEmpty(mTitle) || TextUtils.isEmpty(mDescription)) return; // dont index if there no keyword if (indexedActions.containsKey(id)) return; // dont try to re-indexing if (mClient != null && mClient.isConnected()) { Action action = getAction(mTitle, mDescription, id); AppIndex.AppIndexApi.start(mClient, action); indexedActions.put(id, action); indexedStatuses.put(id, true); LogUtils.e("indexed: " + mTitle + ", id: " + id); } else { LogUtils.e("Client is connect : " + mClient.isConnected()); } } public void endIndexing(String id) { // dont endindex if it not indexed if (indexedStatuses.get(id)) { return; } if (mClient != null && mClient.isConnected()) { Action action = indexedActions.get(id); if (action == null) return; AppIndex.AppIndexApi.end(mClient, action); indexedStatuses.put(id, false); } } 
+3
source

All Articles