Privacy Notice¶
The privacy notice can be used to explain to app users why the app needs specific permissions. It allows the application developer to describe why a specific feature that the user wants to access requires a particular permission.
There are two variations of the privacy notice that the application developer can use: FioriPrivacyNotice
and FioriPrivacyNoticeDialog
. Currently there are five predefined types of permissions supported: LOCATION
, STORAGE
, CALENDAR
, CAMERA
and CUSTOM
. The first four permission types provide the privacy notice text, icons and, in the case of FioriPrivacyNotice
, launching the Android system permission dialog out-of-the-box. For the CUSTOM
permission type, the application developer needs to set the appropriate fields.
Privacy Notice Component¶
FioriPrivacyNotice
is a traditional composable
function that presents the privacy notice text, icon, etc., and it can be displayed while the user is onboarding. It allows the user to be made aware of all the permissions, and their purpose, that an app may require before being used.
Using the Privacy Notice¶
For the CUSTOM
permissions type, you can initialize a FioriPrivacyNoticeSettings
object and pass it into the FioriPrivacyNotice
function with the settings
parameter. In this case, you need to specify all of the information, such as permission, notice text, icon etc., into the FioriPrivacyNoticeSettings
object. The parameter type
should be FioriPrivacyNoticeType.CUSTOM
and the parameter permission
should be an android.Manifest.permission
, such as Manifest.permission.CALL_PHONE
.
For other predefined types of permissions (except the CUSTOM
type), you can use the FioriPrivacyNotice
function with a specified type
parameter. In this case, the FioriPrivacyNotice
will use default settings, such as privacy notice text, icons, etc., for those predefined permissions. You can also use the FioriPrivacyNoticeSettings
object to set those predefined permission types. Use the getPrivacyNoticeSettings
function to get the FioriPrivacyNoticeSettings
object with the default settings for the predefined permission types. In this case, you can change the predefined notice information and pass the object back to FioriPrivacyNotice
for customization.
val permissionGranted by remember { mutableStateOf(false) }
FioriPrivacyNotice(
type = FioriPrivacyNoticeType.LOCATION,
modifier = Modifier.fillMaxSize(),
onResult = {
permissionGranted = it
}
)
FioriPrivacyNotice(
settings = FioriPrivacyNoticeSettings(
type = FioriPrivacyNoticeType.CUSTOM,
permission = Manifest.permission.CALL_PHONE,
title = "Call Phone",
description = "Allows an application to initiate a phone call without going through the Dialer user interface for the user to confirm the call",
imgId = R.drawable.ic_audio_grey_24px
),
modifier = Modifier.fillMaxSize(),
onResult = {
permissionGranted = it
}
)
Privacy Notice Dialog¶
Use the FioriPrivacyNoticeDialog
to display a dialog before the app is about to request a specific permission. This allows the app developer to only show the Privacy Notice dialog if and when the user accesses a feature of the app that requires a particular permission. FioriPrivacyNoticeDialog
provides a button that takes the user to the app's info screen, where the user can grant the corresponding permission to the app.
Using the Privacy Notice Dialog¶
To display the Privacy Notice dialog containing the privacy notice, create a FioriPrivacyNoticeDialogSettings
object and set the permission type using the type
parameter. For the CUSTOM
permissions type, the permission
parameter is mandatory. You can also specify all other notice information here, including the title, message, etc. However, for predefined permission types (LOCATION
, STORAGE
, CALENDAR
, and CAMERA
), all default settings will be used if it isn't specified in FioriPrivacyNoticeDialogSettings
. The FioriPrivacyNoticeDialog
function also exposes two callbacks, onPositiveClick
and onNegativeClick
, to responds to the positive button or negative button click event when the dialog is dismissed.
FioriPrivacyNoticeDialog(
settings = FioriPrivacyNoticeDialogSettings(type = Manifest.permission.ACCESS_COARSE_LOCATION),
onPositiveClick = {},
onNegativeClick = {}
)
FioriPrivacyNoticeDialog(
settings = FioriPrivacyNoticeDialogSettings(
type = FioriPrivacyNoticeType.CUSTOM,
permission = Manifest.permission.ACCESS_WIFI_STATE,
title = "WIFI State"
)
)
Customization¶
As with the simple text field, the Privacy Notice dialog also provides several customization methods using FioriPrivacyNoticeDefaults
. Use these methods to customize the notice's colors, text styles, height, and width, etc. For additional information, see SimpleTextField
.