Recipe Adding a EULA

As discussed in Chapter 1,"Overview of Android," it is often useful to have an End User License Agreement (EULA) display when a user first installs and runs an app. If the user does not accept it, the downloaded application does not run. After a user does accept it, the EULA is never shown again.

This EULA functionality is already implemented and available publicly under the Apache License as the Eula class shown in Listing 9.7. It uses SharedPreferences with the boolean preference_eula_accepted to determine whether the EULA was previously accepted or not accepted.

1. The actual text of the EULA needs to be put in a text file called EULA (as specified by the asset_eula variable in Listing 9.7) and placed in the assets/ directory of the Android project.This is loaded by the readEula() method of the Eula class.

2. There are few strings that need to be specified for the Acceptance dialog box.These can be collected in the string's resource file. An example wording is shown in Listing 9.8.

Character-Building Thought Power by Ralph Waldo Trine. Ralph draws a distinct line between bad and good habits. In this book, every effort is made by the writer to explain what comprises good habits and why every one needs it early in life. It draws the conclusion that habits nurtured in early life concretize into impulses in future for the good or bad of the subject.