Demo app to help developers understand slang-fitness-assistant in a react native app.
3 steps to get started with this project
$ git clone https://github.com/SlangLabs/react-native-slang-fitness-assistant-playground.git
$ cd react-native-slang-fitness-assistant-playground/
$ yarn
OR
$ npm install
After successful installation of node packages attach your Android device and run
$ adb devices
To get your device ID example: ER45TBZM1D64Q.
Now run the following command to build and run on your device
$ react-native run-android --deviceId=<your-device-ID>
In the code, the component that initializes slang is in src/main.js
Open it in your favorite text editor and make changes to load your buddy when the component mounts.
// Slang is initialised with the below function
// Add your assistant Id and API key to this function and run your app
try {
SlangFitnessAssistant.initialize({
requestedLocales: ['en-IN', 'hi-IN'],
assistantId: "YourAssistantId",
apiKey: "YourApiKey",
enableCustomTrigger: true,
triggerPosition: {
baseUIPosition: AssistantUIPosition.BaseUIPosition.BOTTOM_RIGHT,
offsetY: -20,
offsetX: -20,
draggable: false,
forcedAtStartup: true
},
});
// callback function once slang initialises successfully
SlangFitnessAssistant.setAction(fitnessAssistantListener);
} catch (error) {
console.error(error);
}
Find documentation here.
For any queries contact us support@slanglabs.in