Questionnaires inside your Android App, powered by Google Forms.
Google Forms is a powerful tool to create Questionnaires. This helps integrating them into your app by
- wrapping them in a WebView
- replacing the CSS with a mobile friendly one
- closing the WebView when the user has answered the questionnaire
- remembering if the user has already answered the questionnaire
Should work with Android 1.6 or larger (I have no 1.6 phone to test, though...).
In Google Drive, create a new form. Click "Form -> Go to live form" and copy the URL.
Clone the contents of the library folder and add it as a library to your project.
If you use eclipse, import the library as an existing project. Then right-click on your project -> Properties -> Android and add the imported project as a library.
In your manifest, you have to add the Internet permission (if you haven't already), and declare the activity.
<activity
android:name="co.appeti.util.simplequestionnaire.Questionnaire"
android:theme="@style/AppTheme" />
Declaring the theme is optional, but it'll make the questionnaire look nice among your other activities.
You can now use the co.appeti.util.simplequestionnaire.Questionnaire class from other activities. Check the Java Docs, but usage is pretty simple, e.g.
QuestionnaireActivity.openQuestionnaireIfUnanswered(this, "https://docs.google.com/spreadsheet/viewform?formkey=YOURFORM");
opens the questionnaire only if the user hasn't answered it before.
I have added a sample application in the sample-directory that shows how to open a questionnaire if the app is closed via the back-button. It also shows how to first ask the user whether he wants to answer the questionnaire at all.