EULA Screen¶
This screen let the user to accept or reject the End User License Agreement.
The Layout of the EULA Screen¶
It contains the following elements:
- A headline label
- The detailed EULA text
- A button labeled as
"Agree"
- A button labeled as
"Disagree"
All the mentioned labels can be customized via the Settings configuration, i.e. you can overwrite them via the corresponding set methods of the EULAScreenSettings
class. The EULAScreenSettings
class can be instantiated with default
constructor. The set methods should be called before calling the saveToIntent
method, which saves the configuration into
an Intent
. Finally, this intent should be used when starting the EULAScreenActivity
via the startActivityForResult
method.
The detailed EULA text is stored as an 'HTML' object, which can be customized.
Add EULA Screen Activity to Your Manifest File¶
The EULAScreenActivity
should be added to the AndroidManifest.xml
file in an activity xml
tag.
<activity
android:name="com.sap.cloud.mobile.onboarding.eula.EULAScreenActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
</activity>
Start the EULAScreenActivity
¶
The EULAScreenActivity
can be started with standard startActivityResult
method of the Activity
and you can configure it via the EULAScreenSettings
class. For example:
Intent i = new Intent(getIntent());
i.setComponent(new ComponentName(
getPackageName(),
"com.sap.cloud.mobile.onboarding.eula.EULAScreenActivity"));
EULAScreenSettings settings = new EULAScreenSettings();
settings.setEULATitle("EULA");
settings.setEULAUrl("file:///android_asset/eula.html");
settings.setEULAButtonConfirm("Confirm");
settings.setEULAButtonReject("Reject");
settings.saveToIntent(i);
startActivityForResult(i, EULA);
If the user accepts the license agreement the activity returns RESULT_OK
, otherwise the result code is RESULT_CANCELED
.
Customizing the EULA Screen¶
You can use the EULAScreenSettings
object for customize the labels of the EULA screen.
The following options are available:
/**
* Sets the headline label to show on the EULA screen
* @param title the headline label
*/
public void setEULATitle(String title) {
this.eulaTitle = title;
}
/**
* Sets the confirm button title to use on the EULA screen.
* @param buttonConfirm the confirm button title
*/
public void setEULAButtonConfirm(String buttonConfirm) {
this.eulaButtonConfirm = buttonConfirm;
}
/**
* Sets the reject button title to use on the EULA screen.
* @param buttonReject
*/
public void setEULAButtonReject(String buttonReject) {
this.eulaButtonReject = buttonReject;
}
/**
* Sets the EULA url on the EULA screen
* @param url the EULA url
*/
public void setEULAUrl(String url) {
this.eulaUrl = url;
}
The title of the EULA screen is hidden by default.
Setting the Destination of the License Agreement¶
The destination can be set via the EULAScreenSettings
class:
Intent i = new Intent(getIntent());
settings.setEULAUrl("file:///android_asset/eula.html");
settings.saveToIntent(i);