NativeScript support¶
Contextual has developed a plugin for NativeScript. It is still in Beta testing, but here are the instructions for how to get the Beta plugin working with Android
From the sample app created with "tns create" these are the instructions to integrate the plugin.
Requirements¶
- An Account with Contextual
1 Set minSDKVersion¶
Go to /app/App_Resources/Android/app.gradle and change the minSdkVersion to at least 21
2 Add Contextual initialisation¶
Go to /app/App_Resources/Android/src/main/AndroidManifest.xml and under the application opening tag add the following snippet, replacing <YOUR_APP_KEY>
with the App Key you are using in the Contextual dashboard.
1 2 3 |
|
3 Set the MaterialComponents theme¶
Go to /app/App_Resources/Android/src/main/res/values/styles.xml and change
1 |
|
to
1 2 |
|
and
1 |
|
1 |
|
4. Add the Contextual plugin¶
Run on the root of your project
1 |
|
Contextual should be properly installed by then.
5 Identify pages¶
To identify pages so that you are able to run guides on them, you will need to follow the following instructions
On the ""loaded"" event of each page, add the import:
1 |
|
Then add this code inside the method changing <PAGE_NAME>
to the name you want to refer to that page as:
1 |
|
6 Identify users¶
To identify a user, at any point after the app has started up or on your root page loaded event, run this line changing <USER_ID>
to the identifier for this user:
1 |
|