// Android format
b = system_app_name.exec(ʃpackage_nameʃ, activity_nameʅʅ);
// Windows format
b = system_app_name.exec(executable_name);
The
SystemApp.exec function executes a system application associated with the
SystemApp object. Any arguments set using the
SystemApp.setArgument function are passed to the system application. On Android, a system application can return results which can be queried with the
SystemApp.getResult function.
The function returns a logical value of 1 (true) if the system application is started successfully and 0 (false) otherwise.
Starting with Android 11, the version of CSEntry installed using
Google Play is
prohibited from querying for applications not explicitly specified. Google insists that this restriction is to protect sensitive information. The following packages are explicitly specified in the version of CSEntry in Google Play:
If you want to execute an application not in the above list, you can sideload a non-Google Play version of CSEntry. This version can query for all applications. To get this version, you must contact the
CSPro development team. Alternatively, you can request that the developers add your desired application to the specified list.
One workaround to this limitation is to use
deep links instead of a package name. If the package name cannot be resolved, CSPro will attempt to "view" the argument used for the package name. Because deep links are handled by
Intent.ACTION_VIEW, you can use this to open applications not explicitly specified by CSEntry.
On Android, the optional string expression
package_name specifies the name of the Android application (package) that will be executed. An optional string expression
activity_name specifies the name of the activity within the package that should be opened. If no arguments are provided, then the arguments specified using
SystemApp.setArgument will be processed by the Android operating system and, if there is a way to handle these arguments, then an appropriate application will be opened.
// get directions to the U.S. Census Bureau using Google Maps
SystemApp google_maps_navigation;
google_maps_navigation.setArgument("action", "android.intent.action.VIEW");
google_maps_navigation.setArgument("data", "google.navigation:q=U.S.+Census+Bureau");
google_maps_navigation.exec("com.google.android.apps.maps");
// get driving directions from the White House to the U.S. Census Bureau using an Organic Maps deep link
SystemApp organic_maps;
organic_maps.exec(maketext("om://route?sll=%v,%v&saddr=%s&dll=%v,%v&daddr=%s&type=vehicle",
38.897778, -77.036389, encode(PercentEncoding, "White House"),
38.84839, -76.931098, encode(PercentEncoding, "U.S. Census Bureau")));
On Windows, a system application is an executable specified by the string expression executable_name. Typically the name is the full path of the executable, but for applications that have registered their name in the Windows Registry, you only need to provide the executable file name.
// play the training video in Windows Media Player
SystemApp windows_media_player;
windows_media_player.setArgument(pathconcat("../Videos/Census Training.mp4"));
windows_media_player.exec("wmplayer.exe");