Google releases source for Google I/O 2017 for Android

This 12 months’s app additionally featured a Feed to apprise customers about
hour-by-hour trends at I/O (lots of the app’s customers have been far off, and the
Feed was once a window into the convention for them). The Feed was once additionally powered by way of
RTDB, with knowledge driven to the server the usage of a easy CMS. We used a Cloud
Function to watch RTDB feed knowledge; when feed knowledge was once up to date at the server,
the Function despatched a Cloud Messaging downstream message to shoppers, which
visually surfaced the presence of latest feed pieces to the person.

In 2015 and 2016, we had followed an MVP structure for IOSched, and we
endured the usage of that this 12 months. This structure supplies us with excellent
separation of issues, facilitates checking out, and generally makes our code
cleaner and more straightforward to take care of. For the Feed function, we determined to experiment
with a extra light-weight MVP implementation impressed by way of Android
Architecture Blueprints
, which supplied the important modularity whilst being
really easy to conceptualize. The function right here was once each pedagogical and sensible: we
sought after to exhibit an alternative MVP development for builders; we additionally sought after to
exhibit an structure that was once an acceptable are compatible for our wishes for this
function.

For the primary time, IOSched made heavy use of Firebase Remote
Config
. In the previous, we had discovered ourselves not able to tell customers when
non-session knowledge – wifi data, commute time table, bargain codes for
ridesharing, and so forth. – modified simply sooner than or all through the convention. Forcing an app
replace was once now not possible; we simply sought after in-app default values to be updatable.
Using far off config simply solved this drawback for us.

In the tip, we ended up with a three-tier gadget of informing customers about
adjustments:

  1. Conference knowledge and person knowledge adjustments have been communicated by the use of Cloud Messaging
    and information syncs (ping and fetch type).
  2. Feed knowledge adjustments have been managed by the use of RTDB.
  3. Changes to in-app constants have been managed by the use of Remote Config.

Future plans

Even despite the fact that we are liberating the 2017 code, we nonetheless have paintings forward folks for
the approaching months. We’ll be updating the code to apply trendy patterns for
background processing (and making our app “O” compliant), and at some point
we’re going to be adopting Android’s Architecture
Components
to simplify the entire design of the app. Developers can apply
adjustments to the code on GitHub.

Today we are liberating the source
code
for the respectable Google
I/O 2017
for Android app.

This 12 months’s app considerably modifies present capability and provides a number of
new options. It additionally expands the tech stack to make use of Firebase.
In this publish, we’re going to spotlight a number of notable adjustments to the app in addition to
their design concerns.

The maximum outstanding new function for 2017 is the development
reservation gadget, designed to lend a hand save in-person attendees’
time and supply a streamlined convention revel in. Registered attendees may just
reserve classes and sign up for waitlists previous to and all through the convention; a
reservation supplied expedited access to classes with no need to attend in lengthy
traces. Reservation knowledge was once synced with attendees’ convention badges, permitting
match body of workers to ensure reservations the usage of NFC-enabled telephones. Not handiest was once the
reservation function extremely standard, however the reservation knowledge helped match
body of workers alternate the dimensions of consultation rooms each sooner than and all through I/O to regulate for
exact call for for seats.

The reservation function was once carried out the usage of Firebase Realtime
Database
(RTDB) and Cloud Functions for
Firebase
. RTDB supplied simple sync throughout person gadgets — we simply needed to
put in force a listener in our code to obtain database updates. RTDB additionally supplied
out-of-the-box offline make stronger, permitting convention knowledge to be to be had even in
the face of intermittent community connectivity whilst touring. A Cloud Function
processed reservation requests within the background for the person, the usage of
transactions to make sure correctness of state (combating mischievous customers from
grabbing too many seats!) and speaking with the development badging gadget.

As in earlier years, we used a ContentProvider as an abstraction layer over all
app knowledge, which supposed we had to determine tips on how to combine RTDB knowledge with the
ContentProvider. We had to negotiate between having two native caches for
knowledge: 1) the extant native SQLite database accessed by the use of the ContentProvider, and
2) the native cache created by way of RTDB to facilitate offline get right of entry to. We determined to
combine all app knowledge underneath the ContentProvider: every time reservation knowledge for
the person modified in RTDB, we up to date the ContentProvider, making it the only
source of reality for app knowledge all the time. This supposed that we had to stay
open connections to RTDB handiest on a unmarried display, the Session Detail Activity,
the place customers may well be actively managing their reservations. Reservation knowledge
displayed in different portions of the app was once subsidized by way of the ContentProvider. In
offline mode, or in case of a flaky or not on time connection to RTDB, shall we simply
get the closing recognized state of the person’s reservations from the ContentProvider.

We additionally had to determine excellent patterns for integrating RTDB into the entire
sync common sense of IOSched, particularly since RTDB comes with an excessively other sync
type than the ping-and-fetch means we have been the usage of within the app. We determined to
proceed the usage of Cloud Endpoints
to synchronize person knowledge throughout gadgets and with the internet and iOS shoppers (the
knowledge itself was once saved in Datastore).
While RTDB supplies out-of-the-box knowledge syncing, we would have liked to ensure that a
person’s reservation knowledge was once present throughout all gadgets, even if the app
was once now not within the foreground.
We used a Cloud Function to combine RTDB
reservation knowledge into the sync drift: as soon as reservation knowledge for a person modified in
RTDB, the serve as up to date the endpoint, which brought on a Firebase Cloud
Messaging
downstream message to all of the person’s gadgets, which then scheduled
knowledge syncs.

This 12 months’s app additionally featured a Feed to apprise customers about
hour-by-hour trends at I/O (lots of the app’s customers have been far off, and the
Feed was once a window into the convention for them). The Feed was once additionally powered by way of
RTDB, with knowledge driven to the server the usage of a easy CMS. We used a Cloud
Function to watch RTDB feed knowledge; when feed knowledge was once up to date at the server,
the Function despatched a Cloud Messaging downstream message to shoppers, which
visually surfaced the presence of latest feed pieces to the person.

In 2015 and 2016, we had followed an MVP structure for IOSched, and we
endured the usage of that this 12 months. This structure supplies us with excellent
separation of issues, facilitates checking out, and generally makes our code
cleaner and more straightforward to take care of. For the Feed function, we determined to experiment
with a extra light-weight MVP implementation impressed by way of Android
Architecture Blueprints
, which supplied the important modularity whilst being
really easy to conceptualize. The function right here was once each pedagogical and sensible: we
sought after to exhibit an alternative MVP development for builders; we additionally sought after to
exhibit an structure that was once an acceptable are compatible for our wishes for this
function.

For the primary time, IOSched made heavy use of Firebase Remote
Config
. In the previous, we had discovered ourselves not able to tell customers when
non-session knowledge – wifi data, commute time table, bargain codes for
ridesharing, and so forth. – modified simply sooner than or all through the convention. Forcing an app
replace was once now not possible; we simply sought after in-app default values to be updatable.
Using far off config simply solved this drawback for us.

In the tip, we ended up with a three-tier gadget of informing customers about
adjustments:

  1. Conference knowledge and person knowledge adjustments have been communicated by the use of Cloud Messaging
    and information syncs (ping and fetch type).
  2. Feed knowledge adjustments have been managed by the use of RTDB.
  3. Changes to in-app constants have been managed by the use of Remote Config.

Future plans

Even despite the fact that we are liberating the 2017 code, we nonetheless have paintings forward folks for
the approaching months. We’ll be updating the code to apply trendy patterns for
background processing (and making our app “O” compliant), and at some point
we’re going to be adopting Android’s Architecture
Components
to simplify the entire design of the app. Developers can apply
adjustments to the code on GitHub.

Source link

Reply