Navigation
Navigation methods can be used in MyDataHelps Views to move the participant to a different screen or dashboard. In native apps, these can change which application is active.
Ways to Navigate
There are several ways to navigate within MyDataHelps.
Navigating to a Different Dashboard Tab
Tabs are the main screens used in your project’s dashboard. You can change the active tab using the MyDataHelps.showTab
method.
Navigating to External URLs
You can open URLs outside MyDataHelps in two ways:
- Outside the app using
MyDataHelps.openExternalUrl
. This will leave MyDataHelps and open the system browser (on native iOS/Android apps) or a new browser tab (on web).
- Within the app using
MyDataHelps.openEmbeddedUrl
. In the native iOS/Android MyDataHelps apps, this will remain within MyDataHelps and show the page using an embedded browser. On web, this will open a new browser tab.
Note
You cannot access the MyDataHelps JavaScript SDK from pages opened as external or embedded URLs. Use
custom views instead.
Navigating Between Views
You can present custom views within MyDataHelps both modally and non-modally.
Note
A view must undergo a
security review and be registered with your project before it can be used.
Use MyDataHelps.openApplication
to show a view. You may append query string parameters to your view’s url if needed, such as to show a specific object.
By default, the view will be shown in a non-modal mode. To go back, you must call MyDataHelps.back
to “pop” the current view off the stack. In the native iOS/Android MyDataHelps apps, this uses a “push” transition. The new view slides in from the right.
You can also present views in a modal window by passing modal:true
to the openApplication
options. This creates a “stack” of views. From the modal window, you can present additional views non-modally and then use MyDataHelps.back
as normal to “pop” them off the stack. MyDataHelps.dismiss
will dismiss the modal window and everything in it’s “stack”. In the native iOS/Android apps, a modal view slides in from the bottom and is presented “on top” of the current one.
Navigating to Other Applications
In the native Android MyDataHelps app, MyDataHelps.showGoogleFitSettings
method will open the Google Fit settings.
Open a Url Outside of the App
MyDataHelps.openExternalUrl(url)
Opens a url in the system browser. In native apps, this will cause the user to leave MyDataHelps.
Open a Url Inside the App (Native Only)
MyDataHelps.openEmbeddedUrl(url)
Opens a url in an embedded browser. In native apps, this will leave the user in MyDataHelps.
Note
On web, this functions identically to OpenExternalUrl.
Change the Active Tab in MyDataHelps
MyDataHelps.showTab(tabKey)
Switches the participant’s view to the specified tab. Tabs are the main screens used in your project, and each has a unique key. You can find the keys for your project’s tabs in your project settings screen under “App Layout”:
You can change the tab key by selecting the edit icon for each tab. The tab key is under “Advanced” tab settings.
Parameters
tabKey
string
(required)
The key for the tab you want to show.
Availability
Open a Registered View in MyDataHelps
MyDataHelps.openApplication(url, options)
See Navigating Between Views.
Parameters
url
string
(required)
The URL of the external application.
options
object
A javascript object. Set properties to control the operation. The only available option is modal
; set to true
to present the application modally.
Availability
Close the Current Modal View
MyDataHelps.dismiss()
See Navigating Between Views.
Navigate the Participant Back One Step
MyDataHelps.back()
See Navigating Between Views.
Show Google Fit Settings (Native Android Only)
MyDataHelps.showGoogleFitSettings()
Opens the Google Fit configuration screen. This will only work when accessing MyDataHelps via the native Android app, so you would want to check the Current Device Information before presenting this as an option.