![Page 1: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/1.jpg)
Lifecycle Management AndroidMobile and Ubiquitous Games ICS 163 Donald J. Patterson
Android documentation
![Page 2: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/2.jpg)
The Manifest
![Page 3: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/3.jpg)
The Manifest
http://developer.android.com/training/basics/activity-lifecycle/starting.html
![Page 4: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/4.jpg)
Working with Location
![Page 5: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/5.jpg)
What are some ways that location is used in mobile dev?
• Fused Location
• Sensor fusion from a variety of different location sources
• Asking for location based on high level concerns rather than
technologies
• Geofencing
• Setting up geographic triggers
• Activity Recognition
![Page 6: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/6.jpg)
Geofencing
![Page 7: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/7.jpg)
Working with Location
• In order to work with location more set up must be done
• The Google Play SDK must be installed
• This library links the phone, the user and the location data
tools together
• Many location data tools are personalized
• Frequently visited places
• Recommended routes
• Recommended destinations
![Page 8: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/8.jpg)
Working with Location
![Page 9: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/9.jpg)
Working with Location
![Page 10: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/10.jpg)
Working with Location
• Android projects have to be packaged
• This creates an “.apk” file
• In that file are
• a manifest
• resources associated with your app
• graphics, sounds, data files
• compiled byte code
• “gradle” is the tool/language that describes how to package
the “.apk”
![Page 11: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/11.jpg)
Working with Location
• Gradle must be told to package the Google Play SDK
![Page 12: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/12.jpg)
Working with Location
![Page 13: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/13.jpg)
Working with Location
![Page 14: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/14.jpg)
Working with Location
![Page 15: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/15.jpg)
Working with Location
• The Manifest needs to be updated to tell Android that this
application uses “location”
• There are about 100 sensitive permissions that apps might
need to request:
• See them all here:
• http://developer.android.com/reference/android/
Manifest.permission.html
![Page 16: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/16.jpg)
Working with Location
![Page 17: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/17.jpg)
Working with Location
![Page 18: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/18.jpg)
Connecting to Google Play Services
![Page 19: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/19.jpg)
Connecting to Google Play Services
• Lots of failure modes that must be handled
• User hasn’t logged in
• Phone software is out of date
• Network connection fails
• Phone rotates while user is fixing a problem
![Page 20: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/20.jpg)
Connecting to Google Play Services
• Let’s get an example of an application getting your last known
location running
![Page 21: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/21.jpg)
Example
• Create a skeleton program
• Install/require Google Play SDK
• Give app permission to use location
• Create a Google Play Object
• Handle error conditions
• Create a UI
• Get references to the UI elements
• Connect Google Play Object
• On success, put our last known location into the UI
![Page 22: Lifecycle Management - University of California, Irvinedjp3/classes/2015_03_ICS... · Lifecycle Management Android Mobile and Ubiquitous Games ICS 163 Donald J. Patterson Android](https://reader033.vdocuments.us/reader033/viewer/2022042309/5ed6a96539f16f294d573ab7/html5/thumbnails/22.jpg)