Developer Docs - Mobile Docs - Navigation Commands
Some blocks include a setting called Navigate Mode, which lets you control how navigation to another page should happen. The available options align with specific page navigation commands.
MapAddress
M v3.0
This command tries to open a location—either an address or coordinates—directly in the device’s default maps app, like Google Maps or Apple Maps. It skips the step of launching a browser, making the experience quicker and more seamless for an individual.
This command will not work when defining properties inline: {Rock:MapAddressParameters Name='', Address=''}
Using an address (recommended):
Using latitude/longitude:
OpenAppSettings
M v3.0
This command will open the device's settings application and take the user directly to the settings for your mobile application.
There are currently no parameters available for this command.
OpenBrowser
M v1.0
This command allows you to open a web address using the built-in browser inside the application.
If you are opening a URL to your own Rock server and wish to ensure the user is logged in, you can pass an empty rckipid parameter and an impersonation token will be automatically generated.
Note that tokens generated with an empty parameter will use the settings defined in Rock's global attributes, which may be more open than your specific implementation needs. Consider your impersonation strategy and understand the risk that individuals can share their impersonated URL without realizing it. Alternatively, you can use the Lava filter PersonImpersonationToken.
OpenExternalBrowser
M v1.0
Similar to the OpenBrowser command, this one opens a URL in a browser window. The difference between the two is that this command uses the devices native web browser and opens the URL in that application. This means your user leaves your mobile app and gets sent over to Safari or Chrome.
If you are opening a URL to your own Rock server and wish to ensure the user is logged in, you can pass an empty rckipid parameter and an impersonation token will be automatically generated.
Note that tokens generated with an empty parameter will use the settings defined in Rock's global attributes, which may be more open than your specific implementation needs. Consider your impersonation strategy and understand the risk that individuals can share their impersonated URL without realizing it. Alternatively, you can use the Lava filter PersonImpersonationToken.
PopPage
M v1.0
This command works as the opposite of the PushPage command. Simply put, it behaves like the user tapping the back button in the navigation bar—it removes the current page from the stack and brings the previous one back into view. For example, imagine you’ve pushed a page asking the user to confirm an action, and you want a "Cancel" button that takes them back to where they were.
This command only works when a navstack is present and there's a page to return to. The navstack is not available when a Page is set to Show Full Screen or the shell's Application Type is set to Blank.
Did you know push page now support anchor-based navigation using fragment identifiers (e.g., #elementName) to automatically scroll to a specific element when a page loads. Read more here.
PushPage
M v1.0
This command pushes a new page onto the navigation stack. This type of navigation allows the user to use the back button to return to the page that pushed the new page.
If you are using data binding you can also bind the CommandParameter to a true GUID value, in which case it must be the GUID of a valid page.
Finally, if you need advanced parameter usage you can use a PushPageParameters object.
ReplacePage
M v1.0
This command replaces the current page with a new page. This differs from the PushPage command. Using the ReplacePage command, if the user then taps the back button then they will be taken back to the page they were on before the page that called the ReplacePage command.
If you are using data binding you can also bind the CommandParameter to a true GUID value, in which case it must be the GUID of a valid page.
Finally, if you need advanced parameter usage you can use a PushPageParameters object.
ShowPage
M v1.0
This command replaces the entire navigation stack with a new page. This means there will be no back button to return to any previous page.
If you are using data binding you can also bind the CommandParameter to a true GUID value, in which case it must be the GUID of a valid page.
Finally, if you need advanced parameter usage you can use a PushPageParameters object.
When you use ShowPage to open a page in the tab bar, the active tab is switched automatically. However, it's important to note that because each tab maintains its own navigation stack, the ShowPage command will only function correctly if the targeted tab is currently displaying its root page; otherwise, the command will not take effect.