<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"><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">feedhenry-dev@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/feedhenry-dev" rel="noreferrer" target="_blank">https://www.redhat.com/<wbr>mailman/listinfo/feedhenry-dev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_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 src="https://www.redhat.com/files/brand/email/sig-redhat.png" width="90" height="auto"></a></td></tr></tbody></table></div></div></div></div>
</div>