Preferences
What are preferences?
Some settings are only needed for initial setup, or can not be done in the UI and/or should not be accessible by the user. For this we have the concept of a preference file.
With preferences you can for example: - Add a button to the interface to switch directly from PTV Navigator G2 to your application. We call it the ExtApp button. - Disable the ability to log out via the UI to make sure the license key stays the same. - Prevent users from switching vehicle profiles - ...
What is the structure of the file?
Its a json
How can I export it?
Switch on developer mode by clicking 25x on the build date (Menu -> System -> Build date). Export of preferences is done via Menu->System->Export Preferences (only visible in developer mode).
How can I import it?
The import file must be named preferences_import.json and located in the directory: /sdcard/Android/data/com.ptv.navigation.app/files/ directory.
Restart the application to import it. After the import the file will be deleted. You will see shortly a toast message.
For Android versions newer version 11 you can place the preferences_import.json in a folder /PTV Navigator/ that is located in the root of your Android device. The Navigator will request the rights to read and write this directory upon startup. Access to this folder has to be granted manually by the user.
ExtApp button. I want to have a button to switch between the PTV Navigator G2 and my own app:
To display the ExtApp button, the following three preference entries must be imported. A valid preferences_import.json would look like this:
{ "data": [ {"defaultOrValue": "com.axylog.mobileapp.MainActivity", "keyName": "external_app_class", "type": "STRING"}, {"defaultOrValue": "Axylog.png", "keyName": "external_app_icon", "type": "STRING"}, {"defaultOrValue": "com.axylog.mobileapp", "keyName": "external_app_package", "type": "STRING"} ], "version": 1.0 }
The Ext-App button is displayed in the MainFragment and in the NavigationFragment if the value of the key 'external_app_package' is is not empty.
The icon must be located in the application folder /sdcard/Android/data/com.ptv.navigation.app/files/ + path from 'external_app_icon' and can be of type PNG or Webp. Size of the icon at full HD display resolution: 300x300. If no icon is specified, or the path is incorrect, a default icon will be displayed.
Example: {"defaultOrValue": "com.axylog.mobileapp.MainActivity", "keyName": "external_app_class", "type": "STRING"}, {"defaultOrValue": "Axylog.png", "keyName": "external_app_icon", "type": "STRING"}, {"defaultOrValue": "com.axylog.mobileapp", "keyName": "external_app_package", "type": "STRING"}
In the example, the icon 'Axylog.png' must be in the directory /sdcard/Android/data/com.ptv.navigation.app/files/ directory.
Available Settings
Set vehicle profile
Provide the file name of the vehilce profile that is available in the profiles folder of the PTV Navigator G2.
folder of the PTV Navigator G2: "keyName": "settings_profile", "defaultOrValue": "truck40.json", "type": "STRING"
Device language
Either use the Android device language setting, or the language configured in the PTV Navigator G2 setting:
"keyName": "settings_use_device_language", "defaultOrValue": false, "type": "BOOLEAN"
Language setting
Set your UI language. For this settings_use_devices_language needs to be false. otherwise the PTV Navigator G2 will use the device language setting:
"keyName": "settings_language", "defaultOrValue": "de-DE-24", "type": "STRING"
Dark/Light mode - set the App design to dark or to light mode:
"keyName": "settings_theme", "defaultOrValue": "light", "type": "STRING"
Skip Intro
If set to true the intro dialogue will not be shown upon startup:
"keyName": "settings_skip_intro", "defaultOrValue": false, "type": "BOOLEAN"
Units
Here you can set METRIC for KM & Metric Tons or IMPERIAL for Miles & lbs:
"keyName": "settings_units", "defaultOrValue": "METRIC", "type": "STRING"
Traffic delay
What is the minimal traffic delay to trigger a rerouting in order to find a faster route? Range 3 minutes - 30 minutes:
"keyName": "navigation_traffic_delay", "defaultOrValue": 10, "type": "INT"
Traffic
Activate or deactivate the consideration of traffic:
"keyName": "routing_consider_traffic", "defaultOrValue": true, "type": "BOOLEAN"
Ferries
Avoid/allow use of ferries:
"keyName": "routing_avoid_ferry", "defaultOrValue": false, "type": "BOOLEAN"
Motorways
Avoid/allow use of motorways:
"keyName": "routing_avoid_motorways", "defaultOrValue": false, "type": "BOOLEAN"
Toll roads
Avoid/allow use of toll roads:
"keyName": "routing_avoid_toll_roads", "defaultOrValue": true, "type": "BOOLEAN"
Unpaved roads
Avoid/allow use of unpaved roads:
"keyName": "settings_routing_avoid_unpaved_roads", "defaultOrValue": false, "type": "BOOLEAN"
Tunnels
Avoid/allow use of tunnels:
"keyName": "routing_avoid_tunnels", "defaultOrValue": false, "type": "BOOLEAN"
Route optimization
How should the route be optimized? Fast/Distance/Economic
"keyName": "routing_optimization", "defaultOrValue": "Fast", "type": "STRING"
Traffic incidents
Show/hide traffic incidents on the map:
"keyName": "map_show_traffic_incidents", "defaultOrValue": true, "type": "BOOLEAN"
Truck restrictions
Show/hide truck restrictions on the map:
"keyName": "map_show_truck_restrictions", "defaultOrValue": true, "type": "BOOLEAN"
Hill shade
Show/hide hill shading layer on map:
"keyName": "map_show_hill_shading", "defaultOrValue": false, "type": "BOOLEAN"
ExtApp button
Set ExtApp button using your own app icon. You can open your app directly from the PTV Navigator G2:
{ "keyName": "external_app_package", "defaultOrValue": "", "type": "STRING" }, { "keyName": "external_app_class", "defaultOrValue": "", "type": "STRING" }, { "keyName": "external_app_icon", "defaultOrValue": "", "type": "STRING" },
Update check
Enable/disable automatic update check for a newer version of PTV Navigator G2. (available with version >= 9.6.0 )
"keyName": "update_check_enabled", "defaultOrValue": true, "type": "BOOLEAN"
Vehicle profile editing
Enable/disable. Setting this to true will hide the edit and add button for vehicle profiles in the UI.
"keyName": "settings_profile_deny_edit", "defaultOrValue": true, "type": "BOOLEAN"
Vehicle profile switching
Enable/disable. Setting this to true will disable the possibility of switching vehicle profiles in the UI. Vehicle profiles can still be set by the API.
"keyName": "settings_profile_deny_switch", "defaultOrValue": true, "type": "BOOLEAN"
Account logout
Enable/disable. Setting this to false will hide the logout button in the license check error screen. After logging out, the user has to enter a valid license key to use Navigator G2 again.
"keyName": "license_error_show_logout_button", "defaultOrValue": true, "type": "BOOLEAN"
App/APK update
Enable/disable. Setting this to true will allow the APK update over mobile network. Please be aware that the APK file size is > 150MB!
"keyName": "mobile_data_allow_app_update", "defaultOrValue": false, "type": "BOOLEAN"
Map download
Enable/disable. Setting this to true will allow the map download though mobile network. Map data is several GB big! (available with version >= 1.0.0)
"keyName": "mobile_data_allow_map_download", "defaultOrValue": false, "type": "BOOLEAN"
License Key import
Import a license key for automated login. The license key will only be imported but not exported.
"keyName": "license_key", "defaultOrValue": "YourLicenseKey", "type": "STRING"