Skip to content

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.

1
2
3
4
        <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:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
        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 licence 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:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
    /**
     * 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:

1
2
3
        Intent i = new Intent(getIntent());
        settings.setEULAUrl("file:///android_asset/eula.html");
        settings.saveToIntent(i);