Conference App Secrets #1: EULA at first start of APP

October 9, 2013

Writing mobile applications in most cases you want to provide a EULA (End-User-License-Agreement) and the user has to agree to your conditions before using the App. Doesn’t matter if the app is free or not.

It’s recommended to download the Conference App, so you can see how it all works in the context of a complex app.

The EULA is the first Dialog visible after downloading and opening the App, but it was the last part I developed 😉

I allready had implemented an english version hard-coded, but for licenses it’s important that the user understands the content, so the license must be available in all languages.

Last – Minute hacking MUC -> DUBAI -> Hong Kong

I got this information just as I was boarding my flight from Munich to Hong Kong via Dubai. Fortunately the A380 from Emirates has WiFi on board.
So I could communicate and hacking the code.

In Dubai I had to wait some hours for my connection flight, so I did some last coding …

…and finally uploaded the App.

Thanks to BlackBerry I’m allowed to blog about the conference app, patterns used and tips or tricks. This article is the first one of a series.

Usecase

I want to give you some hints HowTo show a localized EULA at startup.

Extracting code from the Conference App into a easy-to-use sample will make it easy for you to use it.

Let’s take a look at the UI first

UI (QML)

We need a Dialog with a Title, the License Text and two Buttons: Agree / Don’t Agree. To solve this the easiest way, we create a Custom Dialog with some properties: alias properties to fill the fields and a result string.

As you can see there’s a second Dialog, a SystemDialog – this Dialog is used if the user doesn’t accept the license. There’s only one chance to retry – if second time the license was not accepted, the App is closed:

Application.requestExit();

If the EULA is ACCEPTED we call a method from C++:

app.setEulaAccepted()

If the EULA is accepted, a value was inserted into Settings, so next time no EULA was displayed.

Now let’s take a look HowTo open the EULA Dialog. At the bottom of main.qml as part of the onCreationCompleted slot:

While testing the Conference App on different devices with different OS we found out that an older 10.1 OS Version has some problems opening the Dialog direct from the onCreationCompleted{}. So we’re doing this async and start a single-shot QTimer, which then opens the dialog.

As soon as you got the list, you can search for the current locale. If an entry is found give this back.

If no entry found check for the first 2 characters only: the language. Per ex. ‘de_DE’ and ‘de_AT’ are valid locales for german language in Germany (DE) or Austria (AT), so if ‘de_DE’ not found, we look for ‘de’. If again no entry found, we use ‘en’ – english as default.

Trackbacks and Pingbacks:

[…] looking to implement a Login to start your app, you can implement your Login logic similar to the EULA license dialog. I have extracted the code to do a Custom Login into a sample app. It is now available at […]

[…] looking to implement a Login to start your app, you can implement your Login logic similar to the EULA license dialog. I have extracted the code to do a Custom Login into a sample app. It is now available at […]