CS371m - Mobile Computing
Persistence - Web Based Storage CHECK OUT https://developer.android.com/trainin g/sync-adapters/index.html
CS371m - Mobile Computing Persistence - Web Based Storage CHECK OUT - - PowerPoint PPT Presentation
CS371m - Mobile Computing Persistence - Web Based Storage CHECK OUT https://developer.android.com/trainin g/sync-adapters/index.html The Cloud . 2 Backend No clear definition of backend front end - user interface backend
CS371m - Mobile Computing
Persistence - Web Based Storage CHECK OUT https://developer.android.com/trainin g/sync-adapters/index.html
The Cloud ……….
2Backend
does not interact with directly
…
Back End As a Service - May Provide:
–server initiates communication, not the client
Clicker
providers exist?
B. about 5 C. about 10
E. 30 or more
https://github.com/relatedcode/ParseAlternatives
5MBaaS
6Some Examples of MBaas
Examples of Using a MBaaS
models
set up and use
1/28/2017
9Parse Set Up in AndroidStudio
1. request api key 2. Download Parse SDK 3. Unzip files 4. Create libs directory in app directory (select Project view) 5. Drag jar files to libs directory
10Parse Set Up in AndroidStudio
6. add dependencies to gradle build file under app like so:
11https://www.parse.com/apps/quickstart# parse_data/mobile/android/native/new
Testing Parse
network state and use internet
Testing Parse
– handles doing this in the background,
Result of Test
–JavaScript Object Notation
14ParseObject
can be saved and retrieved from the Parse
– like a table in a data base
– String - Object – keys must be alphanumerics – like a column in the row
15ParseObject
to Parse in a background thread
–saveAll(List) –saveEventually() - if server or network not available –saveInBackground(SaveCallback)
16Parse and RandomArt
equations
save equations
random equation others liked
ParseObject allowed addition of any key value pair. Keys must be Strings.
saveEquation
the expression table
– uses another table with one row with one column (GACK, no auto increment function)
count (0 based indexing)
Parse Dashboard
demo Saving an Equation
22Get Random Saved Art
saved expression and render that image
recreate image
–time vs. space trade off
getRandomGoodArt
24callback object
equation
25good one logcat
26More Parse
– save objects on device, save to cloud later – abstracts away a lot of the details – Kyle Norton from Pariveda: "Assume you WON'T be connected to the network."
– less than 128 kb – not for images – Parse files for large pieces of data
successfully
27Firebase
could easily host chat as part of site
sending non chat data (such as game state) via the tool
29Firebase for Android
sandwich) or higher
–same as fused location
name
–Tools -> Firebase
30Firebase Project Set up
Firebase Project Console
Firebase for Android Project
(for use of some Firebase features)
with Java
–"Manages a keystore (database) of cryptographic keys, X.509 certificate chains, and trusted certificates. "
33Adding Firebase to Android App
34Using keytool
–created automatically when Android Studio installed
<USER>/.android/debugkeystore
35Debug Signing Certificate
36Running keytool
Firebase Config File for App
fingerprint ...
google-services.json specific for this project
–multiple projects / apps -> repeat steps
Firebase Config File for App
39google-services.json
40Update Gradle Files
41Firebase Capabilities
Firebase Database
database to Firebase
somewhat apparent
–lots of chat examples –realtime updates –emphasis on authorized users
43One More Setup Step
previous setup steps:
44Firebase Database Rules
Firebase Database Rules
46Hello Firebase
Result When App Run
network connections exists:
48Firebase database
traditional database
always) like rows in a traditional table
49Random Art Data on Firebase
child to assign ids and pick random equation
with children for each equation
50Random Art
count
whenever count changes, local copy is updated
51Random Art
equations)
Random Art - Count Listener
53Random Art - Save Equation
Map<String, Object>, List<Object>
constructor and public getters for properties
54Random Art - Get Equation
number of equations
55JSON
Strings
between servers and clients
that humans can also read and write
57JSON Format
–collection of name-value pairs: a.k.a.
–an ordered list of values: a.k.a. an array
JSON Format
–string, number, object, array, true, false, null
59JSON Values
60Syntax Diagrams for string and number: http://www.json.org/
JSON Strings
61JSON Numbers
62JSON Examples
–"Round Rock"
–["Round Rock", "Dallas", "Houston"]
–{"height":70,"weight":165}
63