Assets for Android apps

Push-Notifications

To follow Google requirements we have to keep a push notification, However, you can customize the notification.

You can customize strings that used for user notifications:
Place in the project?

<string name="app_name">TelematicsSDK</string>
<string name="tracking_notification_title">Action Required</string>
<string name="tracking_notification_is_work">Your trip is being scored.</string>
<string name="tracking_notification_is_not_work">Trip not in progress.</string>
<string name="tracking_notification_tracking_disabled">Tracking disabled.</string>
<string name="tracking_notification_gps_disabled">Please enable GPS to enable driver assessment.</string>
<string name="tracking_notification_power_saving_enabled">Your trips may not be recorded when battery saving mode is enabled</string>
<string name="tracking_notification_looking_for_tracks_upload" >Waiting for the tracks uploading</string>

Also, you can add your own icon to the notification. Place your own icons to res/drawable folders with the following names:

ic_tracking_sdk_status_bar.png - use a white-colored square image with alpha-channel
ic_tracking_sdk_notification.png - use colored square image with alpha-channel

Wizard screens customization

The permission wizard contains a separate set of screens for different phone models. there are 8 screens in total.

UI overview

The Wizard is a set of user-friendly screens with a step-by-step description of each required permission and the button 'Proceed " to call the request. i.e. wizard for Android 10 is below:

The permission wizard supports flexible UX parameters, including the parameter when users are enforced to grant permissions.

Two customizable parameters are available;
1. EnableAggressivePermissionsWizard (EAPW):
true - user can't close the wizard screen
false** - user can close the wizard, including the option with "back button".

  1. EnableAggressivePermissionsWizardPage (EAPW-page);
    true - user can't switch to the next screen without granting necessary permissions.
    false - user can switch to the next screen/ complete wizard with rejected permissions.

The table below shows possible combinations and outcomes.

EAPW (1)

EAPW-page (2)

Wizard can be closed

Can proceed w/o granted permissions

Can complete wizard w/o granted permissions

TRUE

TRUE

NO

NO

NO

TRUE

FALSE

NO

YES

NO

FALSE

FALSE

YES

NO

NO

FALSE

FALSE

YES

YES

YES



[SDK for Android app] ## Setting up

📘

This part is taken from Android SDK installation . if you are already done with this part, you can skip it :point-down:

To start the Permission Wizard from your activity or fragment, please use the code below :point-down:

startActivityForResult(
       PermissionsWizardActivity
               .getStartWizardIntent(
                       context = this,
                       enableAggressivePermissionsWizard  = false,
                       enableAggressivePermissionsWizardPage  = false
               ),
       PermissionsWizardActivity.WIZARD_PERMISSIONS_CODE
)

And after that you can get the result in onActvityResult method by this way:

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
   super.onActivityResult(requestCode, resultCode, data) 
   // don’t forget to call here and in all base activity/fragments
   if (requestCode == PermissionsWizardActivity.WIZARD_PERMISSIONS_CODE) {
       when (resultCode) {
           WIZARD_RESULT_ALL_GRANTED -> {
               /* when user finished wizard with all required permissions
granted - enable SDK if Device ID is exist*/
               enableSDK()
           }
           WIZARD_RESULT_CANCELED -> {
               // when user canceled wizard
               Toast.makeText(this, "Wizard closed!",
Toast.LENGTH_SHORT).show()
           }
           WIZARD_RESULT_NOT_ALL_GRANTED -> {
               /* when user finished wizard with not all required permissions
granted*/
               Toast.makeText(this, "NOT All Required Permissions Granted!",
Toast.LENGTH_SHORT).show()
           }
       }
   }
}

Common style

All resources support Html-markup styling. Also you can set custom fonts or font for a part of text via annotations

Directory;


Font

  • Specify your font in resources (check documentation)
  • Specify annotation for the text with name font

Sample: Add custom a Font library

Resource

  • digital_font.xml
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto">
    <font app:font="@font/digital" />
</font-family>

Add the <annotation> tag, and define the key-value pair. In this case, the key is font, and the value is the font resource name

<string name="wizard_telematics_gps_google_desc">You will receive a popup shortly to turn on <b>device location</b>, which uses <annotation font="digital">Google\'s</annotation> location service.\n\n
    For the app to work properly choose <b>OK</b>
</string>

Font size

  1. Add dimen resource
  2. Specify annotation for the text with name textSize
    Sample Dimen-resource:
<dimen name="text_size">12sp</dimen>

Add the <annotation> tag, and define the key-value pair. In this case, the key is textSize, and the value is the dimen-resource name

<string name="wizard_telematics_gps_google_desc">You will receive a popup shortly to turn on <b>device location</b>, which uses <annotation font="digital" textSize="text_size">Google\'s</annotation> location service.\n\n
    For the app to work properly choose <b>OK</b>
</string>

Image resources

If you don't want to use our bottom dialog view you can replace it with your own drawable resource:
Specify drawable resource with the name:

// location permission screen image
ic_wizard_image_location

// background location permission screen image
ic_wizard_image_location_background

// activity recognition permission screen image
ic_wizard_image_activity_recognition

// device location screen image
ic_wizard_image_gps_sensor

// battery optimization permission screen image
ic_wizard_image_battery_optimization

// huawei autostart permission screen image
ic_wizard_autostart_huawei

// xiaomi autostart permission screen image
ic_wizard_autostart_xiaomi

// default autostart permission screen image
ic_wizard_autostart_default

// notifications showing permission screen image
ic_wizard_notifications_default

Colors

Resources: values\colors.xml

Wizard

<!-- Wizard -->
<color name="colorTelematicsWizardBackground">#FAFAFA</color>
<color name="colorTelematicsWizardPrimaryText">#494949</color>
<color name="colorTelematicsWizardSecondaryText">#80464646</color>
<color name="colorTelematicsWizardButtonText">#fff</color>
<color name="colorTelematicsWizardButtonNorm">#80464646</color>
<color name="colorTelematicsWizardButtonPressed">#464646</color>

Alert dialog inside wizard - common colors

<!-- Alert dialog inside wizard - common colors -->
<color name="colorTelematicsDialogAlertBackground">#fff</color>
<color name="colorTelematicsDialogAlertButtonActiveBg">#ff8400</color>
<color name="colorTelematicsDialogAlertText">#80464646</color>
<color name="colorTelematicsDialogAlertButtonActiveText">#fff</color>

for Android <= 9

<!-- Alert dialog inside wizard for Android =< 9 -->
<color name="colorTelematicsDialogAlertInactiveText">#009687</color>

for Android 10+

<!-- Alert dialog inside wizard for Android >= 10 -->
<color name="colorTelematicsDialogAlertInactiveTextQ">#a7c7f9</color>

Dimens

Resources:

  • values\dimens.xml
  • values-xhdpi\dimens.xml
  • values-xxhdpi\dimens.xml

DialogFragment SDK resources

<!-- Overrided DialogFragment SDK resources -->
<dimen name="dialog_telematics_view_bubble_corners">20dp</dimen>
<dimen name="dialog_telematics_button_corners">35dp</dimen>

Wizard SDK resources

<!-- Overrided Wizard SDK resources -->
<dimen name="wizard_telematics_button_corners">5dp</dimen>

Location permission

Android changes Location restrictions twice on 10 and 11 versions.
If you want to customize the description of this screen you should do it in the following resources:

  • values/strings.xml
  • values-v29/strings.xml
  • `values-v30/strings.xml
<!-- Generic location permission description -->
    <string name="wizard_telematics_location_desc">As the next step, you will receive a popup to grant rights to access to <b>location</b>.\n\n
        We use location service for evaluating your driving manner.\nBy enabling <b>Allow</b> on location, application will be able to automatically determine when you have started and ended a drive.
    </string>

    <!-- Bottom dialog before the app name text-->
    <string name="wizard_telematics_attention_dialog_location_before">Allow</string>
    
    <!-- Bottom dialog after the app name text -->
    <string name="wizard_telematics_attention_dialog_location_after">to\naccess this device\'s location?</string>
<!-- Android 10 location permission description -->
<string name="wizard_telematics_location_desc">As the next step, you will receive a popup to grant rights to access to <b>location</b>.\n\n
    We use location service for evaluating your driving manner.\nBy enabling <b>Allow all the time</b> on location, application will be able to automatically determine when you have started and ended a drive.
</string>
<!-- Bottom dialog after the app name text-->
<string name="wizard_telematics_attention_dialog_location_after">to access this device\'s location?</string>
<!-- Android 11 location permission description -->
<string name="wizard_telematics_location_desc">As the next step, you’ll see a popup to grant app access to <b>location services</b>.\n\n
        The app uses your location data to automatically record your trips in background, determine when you have started and ended your trip and to measure your score.\n\n
        The app will not work without this permission.\n\n
        On the next popup, please select <b>While using the app</b>.
</string>

Background location

Since Android 11 Google introduced new privacy requirements related to location permission. Now if the application needs access to user location in the background it should first grant access to foreground location and only then, it can ask permission to access location in the background.

  • values/strings.xml
<!-- background location permission description -->
<string name="wizard_telematics_background_location_desc">
        As the next step, you should grant rights to access to <b>location in background.</b>\n\n
        The app will not work without this permission.\n\n
        You should navigate to app settings and choose "<b>Allow all the time</b> on the Location permission screen.</string>
    
<!-- Additional text in the bottom dialog -->
<string name="wizard_telematics_location_additional_description">This app may want to access your location all the time, even when you\'re not using the app. <font color="#a7c7f9"><u>Allow in settings.</u></font></string>

<!-- Dialog text before app name -->        
<string name="wizard_telematics_attention_dialog_background_location_before">Change location access for </string>

<!-- Dialog text after app name -->      
<string name="wizard_telematics_attention_dialog_background_location_after">\?</string>

<!-- Dialog text to keep permission in "While using the app" -->  
<string name="wizard_telematics_location_additional_keep">Keep \'While using the app\'</string>

Activity recognition (since Android 10)

  • values/strings.xml
  • values-v29/strings.xml
<!-- Wizard activity recognition section -->
<string name="wizard_telematics_activity_recognition_desc">Then, you will receive a popup to grant access to your <b>physical activity</b>. \nWe need this information to create a driving score.\n\n
    Please, choose <b>Allow</b> for application to grant access to physical activity.
</string>
<!-- Bottom dialog before the app name text-->
<string name="wizard_telematics_attention_dialog_activity_recognition_before">Allow</string>
<!-- Bottom dialog after the app name text-->
<string name="wizard_telematics_attention_dialog_activity_recognition_after">to\naccess your physical activity?</string>
<!-- Bottom dialog after the app name text-->
<string name="wizard_telematics_attention_dialog_activity_recognition_after">to access your physical activity?</string>

Device location services

The popup call when location services are switched off on the device (not on application)

  • values/strings.xml
<!-- Gps services description -->
<string name="wizard_telematics_gps_google_desc">You will receive a popup shortly to turn on <b>device location</b>, which uses Google\'s location service.\n\n
    For the app to work properly choose <b>OK</b>
</string>
<string name="wizard_telematics_attention_dialog_gps_google">For a better experience, turn on device location, which uses Google\'s location service.</string>
<string name="dialog_telematics_attention_dialog_gps_google_ok">OK</string>
<string name="dialog_telematics_attention_dialog_gps_google_no">No, thanks</string>

Battery optimization

  • values/strings.xml
<string name="wizard_telematics_ignore_system_battery_optimization_desc">You will receive a popup shortly to ignore <b>battery optimizations</b>.\n\n
    For the app to work properly choose <b>ALLOW</b>
</string>
<string name="wizard_telematics_attention_dialog_battery">Let app always run in background?\n\nAllowing application to always run in the\nbackground may reduce battery life.\n\nYou can change this later from\nSettings > Apps &amp; notifications.</string>
<string name="dialog_telematics_attention_dialog_battery_ok">ALLOW</string>
<string name="dialog_telematics_attention_dialog_battery_no">DENY</string>

Power management

Effected devices;

  • Samsung
  • Xiaomi,
  • OPPO
  • Huawei,
  • etc

Resources;

  • values/strings.xml
<string name="wizard_telematics_extra_power_management_desc">By press "Proceed" you will be forwarded to settings to setup <b>power management</b>.\n
For the app to work properly <b>DISABLE</b> power management.
</string>

Autostart enable

Effected devices;

  • Xiaomi,
  • OPPO
  • Huawei,
  • etc

Resources;

  • values/strings.xml
<string name="wizard_telematics_extra_autostart_desc">By press "Proceed" you will be forwarded to settings to setup <b>AUTOSTART</b>.\n
    For the app to work properly <b>ENABLE</b> autostart</string>

Notifications

Resources

  • values/strings.xml
<string name="wizard_telematics_extra_notifications_desc">By press "Proceed" you will be forwarded to settings to setup <b>notifications</b>.\n
For the app to work properly <b>ENABLE</b> all notification.</string>

Additional resources

Resources

  • values/strings.xml
<!-- Bottom proceed button resource -->
<string name="wizard_telematics_show_request">Proceed</string>
<!-- Allow button resource -->
<string name="wizard_telematics_deny">Deny</string>
<!-- Deny button resource -->
<string name="wizard_telematics_allow">Allow</string>
<!-- Allow all the time resource -->
<string name="wizard_telematics_allow_all_time">Allow all the time</string>
<!-- Allow only while using the app resource -->
<string name="wizard_telematics_allow_while_using">Allow only while using the app</string>
<!-- Steps resource in the top of wizard. !Important! FORMAT SHOULD BE THE SAME! -->
<string name="wizard_telematics_step">STEP %1s of %2s</string>

<string name="wizard_telematics_please_grant">Please, grant all required permissions</string>

<!-- Android 11 new resources-->
<string name="wizard_telematics_while_using_11">While using the app</string>
<string name="wizard_telematics_only_this_time">Only this time</string>
<string name="wizard_telematics_ask_every_time">Ask every time</string>

Permission status popup

Overview

Permissions status Dialog is a DialogFragment (non-fullscreen popup window) with buttons to call system permissions and show the current status

To call the dialog from your activity or fragment, you have to use the following code:

private var permsFragment: PermissionsDialogFragment? = null
override fun onCreate(savedInstanceState: Bundle?) {
   super.onCreate(savedInstanceState)
   permsFragment = PermissionsDialogFragment.newInstants(dismissIfAllGranted =
false)
   permsFragment?.setPermissionsGrantedListener(object :
PermissionsDialogFragment.PermissionsGrantedListener {
       override fun onGrantedStatus(allPermsGranted: Boolean) {
           if (allPermsGranted) enableSDK() // enabled SDK if not enabled
       }
   })
}
private fun showPermissionsDialog() {
   permsFragment?.let {
       if (!permsFragment!!.isVisible) permsFragment?.show(supportFragmentManager, PermissionsDialogFragment.PERMISSION_FRAGMENT_TAG)
   }
}

if dismissIfAllGranted

  • true - the dialog will be dismissed (closed) automatically when all permissions are granted.
  • false - the dialog won't be closed even with all permissions are granted, it can be closed by users.

Color

Resources: values\colors.xml

<!-- Permission Dialog Fragment -->
<color name="colorTelematicsDialogBackground">#fff</color>
<color name="colorTelematicsDialogPrimaryText">#494949</color>
<color name="colorTelematicsDialogSecondaryText">#80464646</color>
<color name="colorTelematicsDialogButtonText">#494949</color>
<color name="colorTelematicsDialogButtonNorm">#fff</color>
<color name="colorTelematicsDialogButtonPressed">#80464646</color>

Dimens

Resoiurces:

  • values\dimens.xml
  • values-xhdpi\dimens.xml
  • values-xxhdpi\dimens.xml
<!-- Overrided DialogFragment SDK resources -->
<dimen name="dialog_telematics_view_bubble_corners">20dp</dimen>
<dimen name="dialog_telematics_button_corners">35dp</dimen>
<!-- Overrided Wizard SDK resources -->
<dimen name="wizard_telematics_button_corners">5dp</dimen>

Drawables

Resources: values/drawable-xxxhdpi

Assert [PNG]


Did this page help you?