aykit / MyOwnNotes

Notes for ownCloud App - Android
GNU General Public License v3.0
69 stars 27 forks source link

Sync with Android app not working (incorrect JSON due to redirect of note API to main page?) #124

Closed improti closed 9 years ago

improti commented 9 years ago

I just cannot seem to get it to work, therefore I try to follow your bug-reporting howto (https://github.com/aykit/MyOwnNotes/blob/master/CONTRIBUTING.rst#user-content-how-to-submit-bugs-issues) now.

Server: ownCloud 8.1.3 (stable) Server-App: OwnNote 1.05 Android: Cyanogen 12.1 Android-App: MyOwnNotes 1.6 (from F-Droid)

I can create and edit notes with the web frontend just fine. On Android I use the Owncloud app and DAVDroid without problems.

For MyOwnNotes I provided the basic URL (xxx/owncloud), but only get an error "no valid JSON received from server, server ok?" (displayed in my language though). Looking at logcat (long output enabled and actual domain replaced):

D/NoteListActivity(11595): menu: start sync
D/NoteListActivity(11595): starting note synchonization
D/NoteListActivity(11595): basePath no port: my.dyndns.domain/owncloud/index.php/apps/notes/api/v0.2/notes
D/NoteListActivity(11595): urlToConnect:https://my.dyndns.domain/owncloud/index.php/apps/notes/api/v0.2/notes
D/NoteListActivity(11595): writing modified notes to server
D/NoteListActivity(11595): cursor rows modified notes:0
D/NoteListActivity(11595): deleting notes from server
D/NoteListActivity(11595): cursor rows to delete:0
D/NoteListActivity(11595): writing new notes to server
D/NoteListActivity(11595): cursor rows new notes:0
D/NoteListActivity(11595): getting notes from server
D/DOWNLOADTASK(11595): url:https://my.dyndns.domain/owncloud/index.php/apps/notes/api/v0.2/notes
D/NoteListActivity(11595): download connection ok, doing the downloading
W/System.err(11595): org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONArray
W/System.err(11595):    at org.json.JSON.typeMismatch(JSON.java:111)
W/System.err(11595):    at org.json.JSONArray.<init>(JSONArray.java:96)
W/System.err(11595):    at org.json.JSONArray.<init>(JSONArray.java:108)
W/System.err(11595):    at org.aykit.owncloud_notes.NoteListActivity.updateDatabase(NoteListActivity.java:513)
W/System.err(11595):    at org.aykit.owncloud_notes.NoteListActivity$DownloadNotesTask.onPostExecute(NoteListActivity.java:1264)
W/System.err(11595):    at org.aykit.owncloud_notes.NoteListActivity$DownloadNotesTask.onPostExecute(NoteListActivity.java:1129)
W/System.err(11595):    at android.os.AsyncTask.finish(AsyncTask.java:636)
W/System.err(11595):    at android.os.AsyncTask.access$500(AsyncTask.java:177)
W/System.err(11595):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:653)
W/System.err(11595):    at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err(11595):    at android.os.Looper.loop(Looper.java:135)
W/System.err(11595):    at android.app.ActivityThread.main(ActivityThread.java:5293)
W/System.err(11595):    at java.lang.reflect.Method.invoke(Native Method)
W/System.err(11595):    at java.lang.reflect.Method.invoke(Method.java:372)
W/System.err(11595):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
W/System.err(11595):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
E/NoteListActivity(11595): no correct JSON data returned from server. result from server:<!DOCTYPE html>
[...]
D/NoteListActivity(11595): updateDatabase() executed
D/MySimpleCursorLoader(11595): loading cursor
D/HeadsetStateMachine( 2734): Disconnected process message: 10, size: 0

The URL generated by the app gets redirected to the main page, i.e. when entered in the browser I get to see the login-page. I replaced the rest of the HTML code with [...] above. The HTML of the main page is correctly recognised by the app as not being JSON then.

Any ideas how comes and what to do about it? I noticed the htaccess file does have lines with rewrite rules specifically for apps/calendar/caldav and alike, is there maybe one needed for the notes module?

steppenhahn commented 9 years ago

Server-App: OwnNote 1.05

that's the problem right there.

myownnotes only works with "Notes" by Bernhard Posselt and Jan-Christoph Borchardt. you need to enable and use this app in order to make myownnotes work.

improti commented 9 years ago

Wow. Thx opening my eyes on this ... detail ;)

P.S.: https://github.com/owncloud/notes - for any others being lost and searching ...