Also add the camera permissions in info.plist for IoS
Also for voice transcription support, add the following permissions to the app.
IOS:
Initialization
Declare and initialize the spotcheck variable using the initializeSpotChecks().
Anonymous users
If you wish not to keep track of users' data, you can follow the below syntax for initialization.
Known Users
If you wish to keep track of users' data and perform conditional Survey triggers, you can follow the below syntax for initialization.
Add Spotcheck inside the navigation container only once in the App component
Screen Track
It provides the ability to keep track of screens the users are visiting and to enable the survey trigger on that screen.
Syntax:
Example:
If a survey needs to be triggered on the payment page, the name of the ScreenName should be specified in the TrackScreen function.
Event Track
It provides the ability to keep track of events which when triggered, will enable the survey to be popped.
Syntax:
Example:
If a survey needs to be triggered when the user completes a payment, then the TrackEvent function should be called with the respective ScreenName and optional custom properties.
Make sure to have the eventName configured in the Checks section of the configure panel
import { initializeSpotChecks } from 'surveysparrow-react-native-sdk';
//Initialize once at the root of the App
useLayoutEffect(() => {
initializeSpotChecks({
domainName: ‘your-domain-name',
targetToken: 'your-target-token’,
// Should Not Pass userDetails as const
userDetails: {},
variables: {},
customProperties: {},
});
},[]);
import { initializeSpotChecks } from 'surveysparrow-react-native-sdk';
//Initialize once at the root of the App
useLayoutEffect(() => {
initializeSpotChecks({
domainName: ‘your-domain-name',
targetToken: 'your-target-token’',
userDetails: {
email:"<user_email>",
mobile:"<user_mobile>",
uuid: '<uuid_value>' // Optional
},
variables: {
sparrowLang: "ta" // Eg: ta, en,
<api_identifier_of_variable>:"<variable_value>",
},
customProperties: {
<custom_property_name>: ‘<custom_property_value>’
},
});
},[]);
import Spotcheck from 'surveysparrow-react-native-sdk';
<NavigationContainer>
<Stack.Navigator>
<your-app-code>
</Stack.Navigator>
<Spotcheck/>
</NavigationContainer>