<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 15, 2017 at 3:55 PM, Wei Li <span dir="ltr"><<a href="mailto:weil@redhat.com" target="_blank">weil@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Yeah, agreed. Another thing we can also try is to call the sync API just before the app going into background. That should make sure the local data is uploaded even if the background sync frequency is very low.</div></blockquote><div><br></div><div>Point of order, during onPause and onStop you are supposed to be releasing resources and ending network connections, not starting new ones.</div><div><br></div><div>During backgrounding we should not start a new network request, we should migrate pending requests to a background sync mechanism. (aka JobScheduler)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div class="m_-2848487780925349942h5"><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 15, 2017 at 8:44 PM, David Martin <span dir="ltr"><<a href="mailto:davmarti@redhat.com" target="_blank">davmarti@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">I think there might be an expectation from some users that ic they use the app to update some data, that data will be make its way to the server as soon as possible.<br>
 If I make a change in an app then immediately put the app in the background, I would expect that change to be saved on the server pretty soon as long as I'm online. It wouldn't seem right if that change I made only got saved the next time I opened the App. </p>
<p dir="ltr">To take an hypothetical example, if I use a particular app for logging work, and log something last thing on a Friday . I then lock my phone, which puts the App into the background. <br>
The weekend staff take over on Saturday and pick up where I left off. However, my changes never got synced so they end up repeating some work I did. <br>
Having some background sync, even if it was every 15 minutes ,could help prevent this situation .<br>
</p><div class="m_-2848487780925349942m_-3853424801706827939HOEnZb"><div class="m_-2848487780925349942m_-3853424801706827939h5">
<br><div class="gmail_quote"><div dir="ltr">On Tue, 15 Aug 2017 17:58 Wei Li, <<a href="mailto:weil@redhat.com" target="_blank">weil@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I don't think it's necessary to run sync with high frequency when it's in the background mode. The app is not being used by the user, so no one cares if the data is actually up to date in the background.<div>From this point of view, I think it's ok to use the JobScheduler when it's in background. It probably will use less battery as well (I think perhaps we can reduce the frequency of sync when it's running in the background for old Android versions too?).</div><div><br></div><div>However users do expect the data is up to date ASAP when the app is in foreground mode. So this change is made, we probably should explain how developers can still achieve relatively good UX when the app is in the foreground again.</div><div>We can either:</div><div>* make sure sync API is called automatically when the app is brought into foreground. Or,</div><div>* provide documents & code sample of how to invoke the sync API when the app is in foreground mode.</div><div><br></div><div>My 2 cents...</div><div><br></div><div>Thanks,</div></div><div class="gmail_extra"></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 15, 2017 at 5:34 PM, Summers Pittman <span dir="ltr"><<a href="mailto:supittma@redhat.com" target="_blank">supittma@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">So fh-android-sdk uses a polling thread with a one second timeout to perform sync operations.  While the application is in the foreground this is fine since this thread just checks the Sync configuration and makes HTTP calls to sync if a sync timeout has been reached.  Because we want a real-ish time experience our demos keep this timeout rather low.  <div><br></div><div>Prior to Android O when the application is in the background these aggressive sync timeouts keep the local data updated until the application is killed by the system.  After Android O those requests fail and will begin to call the failure callback while the application is backgrounded.*  The way that Google advises apps to work around this is to use the JobScheduler APIs.</div><div><br></div><div>JobScheduler has one downside though, you can't schedule background tasks to run as frequently as the sync APIs want to run.  I believe the minimum is once every 15 minutes.  For polling from the background this probably isn't a big deal especially if there is a way to return the app to a more aggressive state when it is in the foreground.</div><div><br></div><div>For the next sprint the client SDK team is looking at implementing JobScheduler for sync because this will make the sync APIs work better in Android O.  Does anyone have any objection/points of discussion or clarification to the behavior and restrictions I mentioned?</div><div><br></div><div>Thanks,</div><div><br></div><div>Summers</div><div><br></div><div>* Specifically if the phone has gone into Doze mode.</div></div>
<br>______________________________<wbr>_________________<br>
feedhenry-dev mailing list<br>
<a href="mailto:feedhenry-dev@redhat.com" target="_blank">feedhenry-dev@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/feedhenry-dev" rel="noreferrer" target="_blank">https://www.redhat.com/mailman<wbr>/listinfo/feedhenry-dev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div></div><div class="gmail_extra">-- <br><div class="m_-2848487780925349942m_-3853424801706827939m_5724484152550286143m_256306704684150342gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><p style="color:rgb(0,0,0);font-family:overpass,sans-serif;font-weight:bold;margin:0px;padding:0px;font-size:14px;text-transform:uppercase"><span>WEI</span> <span>LI</span></p><p style="color:rgb(0,0,0);font-family:overpass,sans-serif;font-size:10px;margin:0px 0px 4px;text-transform:uppercase"><span>SENIOR SOFTWARE ENGINEER</span></p><p style="font-family:overpass,sans-serif;margin:0px;font-size:10px;color:rgb(153,153,153)"><a href="https://www.redhat.com/" style="color:rgb(0,136,206);margin:0px" target="_blank">Red Hat <span>Mobile</span></a></p><p style="font-family:overpass,sans-serif;margin:0px 0px 6px;font-size:10px;color:rgb(153,153,153)"><span style="margin:0px;padding:0px"><a href="mailto:weil@redhat.com" style="color:rgb(0,136,206);margin:0px" target="_blank">weil@redhat.com</a>   </span> <span>M: <a href="tel:+353862393272" style="color:rgb(0,136,206);font-size:11px;margin:0px" target="_blank">+353862393272</a>    </span></p><table border="0" style="color:rgb(0,0,0);font-family:overpass,sans-serif;font-size:medium"><tbody><tr><td width="100px"><a href="https://red.ht/sig" target="_blank"><img width="90" height="auto"></a></td></tr></tbody></table></div></div></div></div>
</div>
______________________________<wbr>_________________<br>
feedhenry-dev mailing list<br>
<a href="mailto:feedhenry-dev@redhat.com" target="_blank">feedhenry-dev@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/feedhenry-dev" rel="noreferrer" target="_blank">https://www.redhat.com/mailman<wbr>/listinfo/feedhenry-dev</a><br>
</blockquote></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_-2848487780925349942m_-3853424801706827939gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><p style="color:rgb(0,0,0);font-family:overpass,sans-serif;font-weight:bold;margin:0px;padding:0px;font-size:14px;text-transform:uppercase"><span>WEI</span> <span>LI</span></p><p style="color:rgb(0,0,0);font-family:overpass,sans-serif;font-size:10px;margin:0px 0px 4px;text-transform:uppercase"><span>SENIOR SOFTWARE ENGINEER</span></p><p style="font-family:overpass,sans-serif;margin:0px;font-size:10px;color:rgb(153,153,153)"><a href="https://www.redhat.com/" style="color:rgb(0,136,206);margin:0px" target="_blank">Red Hat <span>Mobile</span></a></p><p style="font-family:overpass,sans-serif;margin:0px 0px 6px;font-size:10px;color:rgb(153,153,153)"><span style="margin:0px;padding:0px"><a href="mailto:weil@redhat.com" style="color:rgb(0,136,206);margin:0px" target="_blank">weil@redhat.com</a>   </span> <span>M: <a href="tel:+353862393272" style="color:rgb(0,136,206);font-size:11px;margin:0px" target="_blank">+353862393272</a>    </span></p><table border="0" style="color:rgb(0,0,0);font-family:overpass,sans-serif;font-size:medium"><tbody><tr><td width="100px"><a href="https://red.ht/sig" target="_blank"><img width="90" height="auto"></a></td></tr></tbody></table></div></div></div></div>
</div></div></div></div></div>
</blockquote></div><br></div></div>