List of usage examples for android.app.assist AssistContent setStructuredData
public void setStructuredData(String structuredData)
From source file:com.commonsware.android.assist.mo.MainActivity.java
@TargetApi(23) @Override//from w ww . j a v a 2 s.c om public void onProvideAssistContent(AssistContent outContent) { super.onProvideAssistContent(outContent); outContent.setWebUri(Uri.parse("https://commonsware.com")); try { JSONObject json = new JSONObject().put("@type", "Book").put("author", "https://commonsware.com/mmurphy") .put("publisher", "CommonsWare, LLC") .put("name", "The Busy Coder's Guide to Android Development"); outContent.setStructuredData(json.toString()); } catch (JSONException e) { Log.e(getClass().getSimpleName(), "Um, what happened here?", e); } }
From source file:net.olejon.mdapp.MedicationActivity.java
@Override public void onProvideAssistContent(AssistContent assistContent) { super.onProvideAssistContent(assistContent); try {/*from w w w.ja va 2 s . c o m*/ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { String structuredJson = new JSONObject().put("@type", "Drug").put("name", medicationName) .put("activeIngredient", medicationSubstance).put("manufacturer", medicationManufacturer) .toString(); assistContent.setStructuredData(structuredJson); } } catch (Exception e) { Log.e("MedicationActivity", Log.getStackTraceString(e)); } }