Skip to content

This is a survey project for android class. Users should firstly create their surveys on the web platform and then post. For each survey,there is a QR code which can be scanned through the android application to generate a questionnair, and then users can answer it and save it to the local database or upload it to the local webserver.Please make…

Notifications You must be signed in to change notification settings

LuSylvia/survey-teamwork

This branch is 1 commit ahead of, 8 commits behind WindWaving/survey-teamwork:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

0829521 · Apr 3, 2020

History

57 Commits
Apr 3, 2020
Mar 20, 2020
Mar 20, 2020

Repository files navigation

SURVEY-TEAMWORK

A website to create surveys and an Android APP to fill in the surveys.

Dependencies

com.journeyapps:zxing-android-embedded:3.5.0

Table of contents

Installation

  • Move the server/root folder to your web server.
  • Open your web server and Android DevTools to open the android-client folder.
  • Open the home page, for a local web server for example: http:localhost:8080/index.html, you are supposed to see a page like this; image.png
  • You can just open the app-debug.apk in android-client root folder, or build one with your Android DevTools. You should see the Welcome page.

Usage

  • Create a survey on the web platform. After you finished one, they should show on the home page. image.png
  • Click the Scan QRcode button on the specific survey, here is the QR code for this survey. image.png
  • Scan the QR code with your suvey app, the specific survey will automatically display in your app.
  • After finish the questions, upload it to the android database and server database. A prompt will pop up to inform you.
  • Exiting the APP requires you to unlock your system lock. Use your fingerprint or enter the passwork correctly, You can leave the app now.

Note

  • Please Never Name the Survey Title in Chinese
  • Please make sure your phone and computer in the same LAN when you test on local server

Team

Cherry_20176134 Cynthia_20175980 Geralt_20175990
https://github.com/WindWaving/survey-teamwork https://github.com/Cynthia879/survey-teamwork https://github.com/LuSylvia/survey-teamwork

Code

1.How to create my own page dynamically?

  • First, you have to write the XML of the page you want to create, assign an ID to the button control in the page, bind the control in the oncreate method, and then add the onClick attribute to the button, with the value of nextque. And a unique identifier is added to the page for representation.
  • Then, add new judgment statements ionActivityResult method, such as
    if(Jo.getString("type").equals("YourType")){
      ShowYourType();
    }
    
  • Next, you need to judge the newly added page at thbeginning of the nextque method, such as
    public void nextque(View view) throwJSONException {
     Boolean flag=false;
     ......
      if(style.equals("YourType")){
         flag=saveYourTypeAnswer();
      }
     ......
    }  
    
  • Then judge whether the flag is true, and then adjudgment in the branch of if (current + 1 < coun, such as
    if(current+1<count){
      ......
      if(Jo.getString("type").equals("YourType")){
          ShowYourType();
      }
      ......
    }
    
  • Finally, implement showyourtype ansaveyourtypeanswer methods. There are similar methodin the source code. You can refer to them timplement your own methods.

2. How to upload the data?

  • First, in ChooseActivity, all the answer will be saved in a String variable saveAnswer and questions will be saved in a array of string. The The total number of questions and the id of the questionnaire are also stored in the variables. They will be put into an intent pasted to the ReportActivity
 CtoR.putExtra("answerJSON",saveAnswer);
        CtoR.putExtra("count",count);
        CtoR.putExtra("survey_id",Survey_id);
        String[] quesArr=quesList.toArray(new String[quesList.size()]);
        CtoR.putExtra("quesArr",quesArr);
  • Second, ReportActivity will get the intent from ChooseActivity and get all the data to show them in a TextView. In this activity, the app will ask the user to get the permission of ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION and READ_PHONE_STATE to get the information of user's location and imei.
    • function of getting data and time when the user uploads the result
      public String getTime(){...}
    • function of getting location when the user uploads the result
      public String getLocation() {...}
    • function of getting the imei of user's phone
     public String[] getIMEI() throws Exception {

All the data will be saved in the sqlite of the client and the database of the server. Once a data cannot be properly obtained it will be set to null. If the server receives the uploaded data, it will prompt the user to upload successfully. Otherwise, it will prompt the user to upload failed and ask the user to check the information of network Settings

Contract

Contract me if you have any problem in the following way:

About

This is a survey project for android class. Users should firstly create their surveys on the web platform and then post. For each survey,there is a QR code which can be scanned through the android application to generate a questionnair, and then users can answer it and save it to the local database or upload it to the local webserver.Please make…

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 52.3%
  • JavaScript 38.1%
  • PHP 4.3%
  • CSS 3.0%
  • HTML 2.3%