Aug 25 | 8:55 AM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Aug 25 | 9:10 AM |
ndrocchietto_ivano | has entered the room |
Mark M. |
hello, Ivano!
|
Mark M. |
how can I help you today?
|
ndrocchietto_ivano |
Hey Mark Good morning! Today....
|
ndrocchietto_ivano |
would like to know about Retrofit2+RXJAVA is a small question, but on the book is not managed does it fine with you?
|
ndrocchietto_ivano |
is about where to put the Subscriber to retrieve the object with the JSON reply
|
ndrocchietto_ivano |
I eliminated onResponse
|
Mark M. |
I cannot really help on RxJava questions
|
ndrocchietto_ivano |
and does not work even if I put a Log is not retrieved
|
ndrocchietto_ivano |
OK
|
Mark M. |
I have played with it a bit, but nowhere near enough to be in position to help others
|
ndrocchietto_ivano |
I am really focused on that at the moment
|
Aug 25 | 9:15 AM |
Mark M. |
in 2017, I may be in better position to help
|
ndrocchietto_ivano |
I understand is a huge topic with houndreads of operators, but I want to take advantage and specialize on that
|
ndrocchietto_ivano |
OK I am going to study roboelectric/mockito/Junit session and will come back to you with some testing question that is also a topic that I want to master
|
Mark M. |
um, OK
|
Mark M. |
I may not be able to help there much either, as I stick mostly to instrumentation testing
|
ndrocchietto_ivano |
in the meantime as architectural way to proceed
|
ndrocchietto_ivano |
OK
|
ndrocchietto_ivano |
I want to update my todolist application with a backend, i decided to use PHP... and...
|
ndrocchietto_ivano |
I have some doubt regarding the architecture. basically it is not clear to me where I should update the app to maintain sync the content using sqlite internally and a content provider. where is best practice to put a POST request, and when a GET?
|
Aug 25 | 9:20 AM |
Mark M. |
I highly doubt that there is a single "best practice" here
|
ndrocchietto_ivano |
I have a fragment that update the db internally running queries to the content provider inside the fragment
|
ndrocchietto_ivano |
basically I guess the steps should be.. 1) create a PHP service where to put an SQL DB. 2) update the DB on back end if user did not do in the past 3) add a POST <WHERE???> every time there is a modification in the DB 4) adding a GET everytime the app is opened instead to pass to the DB.
|
Mark M. |
all of that, particularly steps 3 and 4, are very dependent upon how you want your app to work
|
ndrocchietto_ivano |
I am afraid 3 could not work because user does not have connection to internet, so that cannot post, in this case what I should do? put in onStop cycle a request to the DB? and if still there is any internet connection?
|
Aug 25 | 9:25 AM |
Mark M. |
"in this case what I should do?" -- keep track of what changes still need to be delivered, and arrange to do them sometime in the future (e.g., JobScheduler)
|
ndrocchietto_ivano |
mmh
|
Mark M. |
for example, perhaps you have a lastUpdated timestamp or something on relevant database rows
|
Mark M. |
and you also track somewhere your last successful sync timestamp
|
Mark M. |
then, at the next sync point, you need to deliver everything that is newer than the last successful sync timestamp
|
Mark M. |
where "the next sync point" might be attempted in real time (if the user is actively in your app) or periodically (e.g., JobScheduler)
|
ndrocchietto_ivano |
I start to shed some light
|
Mark M. |
presumably, you plan on this same data being updated by the user by other means (e.g., Web app), otherwise there is no reason for the backend in the first place
|
Mark M. |
in that case, you also have to push changes from the backend to the device
|
Mark M. |
that could be GCM/FCM, MQTT, or just periodic polling
|
Aug 25 | 9:30 AM |
ndrocchietto_ivano |
I see
|
Mark M. |
with periodic polling as a fallback even if you optimize using some sort of push messaging solution (e.g., GCM/FCM, MQTT)
|
Mark M. |
as those are not absolutely guaranteed to work
|
Mark M. |
but, if instead, your backend is really just for a data backup, without live editing, then perhaps you do not update the backend live ever, settling for a nightly backup job
|
ndrocchietto_ivano |
you gave me enough terms to run an extensive research: GCM, FCM, MQTT, sync timestamp, sync point. It was really hard for me to find some terms on my favorite search engine.
|
Mark M. |
this is why I wrote that I highly doubt that there is a single "best practice"
|
Mark M. |
of those, you will have the roughest time finding stuff on "sync timestamp" and "sync point"
|
Mark M. |
those are fairly generic terms for which I expect there are many alternatives
|
Mark M. |
GCM=Google Cloud Messaging, recently rebranded as FCM=Firebase Cloud Messaging
|
Mark M. |
I forget exactly what MQTT stands for, but that's easily searchable
|
ndrocchietto_ivano |
firebase sucks for my purposes
|
ndrocchietto_ivano |
because I have complex queries
|
Mark M. |
despite the branding, AFAIK, FCM is at best loosely coupled to the Firebase hosted database solution
|
ndrocchietto_ivano |
and firebases offer only a limited way to query, because is a NOSQL technology
|
Mark M. |
"Firebase" is becoming Google's overall brand for "hosted developer-focused services"
|
Mark M. |
with the original Firebase database solution being just one of those
|
ndrocchietto_ivano |
I see, google want to maintain this product because will become the google analytics of the apps
|
ndrocchietto_ivano |
OK
|
Aug 25 | 9:35 AM |
ndrocchietto_ivano |
I will try to look for tutorials PHP android
|
ndrocchietto_ivano |
should be a good starting point I guess
|
ndrocchietto_ivano |
I need to make things easy because I tend to make complex everything, and this is not good as my aim is to work in teams
|
ndrocchietto_ivano |
have a nice day and see you soon!
|
ndrocchietto_ivano |
and of course thanks
|
Mark M. |
you are very welcome
|
Aug 25 | 10:00 AM |
Mark M. |
that is a wrap for today's chat
|
Mark M. |
the transcript will be uploaded to https://commonsware.com/office-hours/ shortly
|
Mark M. |
the next chat is Saturday, 7:30pm US Eastern
|
Mark M. |
have a pleasant day!
|
ndrocchietto_ivano | has left the room |
Mark M. | turned off guest access |