Open jaredsieling opened 9 years ago
Debugging locally, I found that with the compliance-diary
survey, if I opened the survey by selecting a notification that had been delivered, I would see this error in the Logcat.
10-02 11:28:50.987 14280-14280/io.smalldatalab.android.ohmage E/SQLiteDatabase﹕ Error inserting response_data={"ReasonToTurnOffApp":["to save battery power"],"PhoneNotPhysicallyOnAct":"Driving","TurnOffApp":1,"ActivityDuringPhoneOff":"Sitting","PhonePhysicallyOn":"Forgot","PhoneIsPhysicallyOnHours":0,"HoursWithPhoneOn":0} response_extras={} survey_id=LisaWitkin:compliance-diary response_metadata={"timestamp":"2015-10-02T11:28:50.948-05:00","id":"6654364a-fb97-40b4-b7fd-b818d62bd050","location":{"accuracy":19.760000228881836,"longitude":-93.4416646,"time":1443803329219,"latitude":45.1149836}} survey_version=null
android.database.sqlite.SQLiteConstraintException: responses.survey_version may not be NULL (code 19)
at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:973)
at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:788)
at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:86)
at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1591)
at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1461)
at org.ohmage.provider.ResponseContentProvider.insert(ResponseContentProvider.java:95)
at android.content.ContentProvider$Transport.insert(ContentProvider.java:213)
at android.content.ContentResolver.insert(ContentResolver.java:917)
at org.ohmage.app.SurveyActivity.submit(SurveyActivity.java:317)
at org.ohmage.app.SurveyActivity$SubmitResponseFragment$1.onClick(SurveyActivity.java:530)
at android.view.View.performClick(View.java:4475)
at android.view.View$PerformClick.run(View.java:18796)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5455)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
at dalvik.system.NativeStart.main(Native Method)
If I started the survey manually from the Home page, the survey_version
was 1, and the save was successful. The difference occurred at the line here.
This makes a lot of sense! I never tested it through notification and so was never able to reproduce the isusse.
Reported with version 45(4.0.8) of the app, occasionally participants would report submitting surveys, and that they received the "Survey responses have been submitted" toast. However, those responses were never attempted to be uploaded (indicated by the log event SurveyUploadStarted), no response data would hit the server, with no trace of what happened to cause the data to disappear.