$ npm install react-native-assistant-context --save
or
$ yarn add react-native-assistant-context
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.ruykin.RNAssistantContextPackage;
to the imports at the top of the file - Add
new RNAssistantContextPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-assistant-context' project(':react-native-assistant-context').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-assistant-context/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-assistant-context')
import RNAssistantContext from 'react-native-assistant-context';
In MainActivity.java
import com.ruykin.RNAssistantContextModule;
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
public void onProvideAssistContent(AssistContent assistContent) {
super.onProvideAssistContent(assistContent);
RNAssistantContextModule.setAssistantContext(assistContent);
}
Tell assistant to share url:
RNAssistantContext.setWebUri(url);