This document summarizes the topics covered on the third and fourth days of training:
1) On day 3, monetization strategies, publishing apps, services, and cloud solutions were discussed. Potential revenue sources for apps like in-app purchases and subscriptions were also covered.
2) Day 4 focused on location basics in Android like accessing location providers, requesting location updates, and handling callbacks. The LocationManager was introduced as the root of the location system. Key location classes like Location were also summarized.
3) Questions were solicited from participants before moving to a test of the material. Progress bars and connecting with the instructor after the workshop were also briefly mentioned for day 4.
2. This is our last day, and yesterday we
talk about:
• Monetizing your app
• Publishing your app
• Before you upload you APK
• Using Services in you app
• What is a Service
• Tell me something about Service priority
• How do we start a service
• Cloud solutions
• Training options
• Pluralsight
• Coursera (this is what I’ve forgot yesterday)
2
6. Before we start Day 4 lectures
• Let’s look at Eclipse IDE
• How to import projects
• What android device do you have???
• What kind of device do you have
• http://developer.samsung.com/android/tools-sdks/Samsung-Andorid-USBDriver-for-Windows
• How to use device to run app
6
8. Android location basics
• Accessing the location systems
• Location providers and security
• Handling location information
• Receiving location updates
• Getting a single location value
8
9. Accessing the location system
• Location manager is the root of the location system
•
•
•
•
•
Get current location
Monitor for changes in status of location hardware
Request notification when reaching a location
Exposed as system service
Use | Context.getSystemService (Context.LOCATION_SERVICE)
9
10. Selecting a location provider
• Global Positioning System (GPS)
•
•
•
•
LocationManager.GPS_PROVIDER
Satellite based
Extremely accurate (3 meters)
Very power intensive
• Network-based
•
•
•
•
LocationMAnage.NETWORK_PROVIDER
Uses a combination of known Wi-Fi hotspots and cellular towers
Accuracy varies (10m-1km)
Less power
10
11. Location is a secured service
• You must request permissions
• How?
• Different permission depending on location accuracy
• Course location providers
• Network provider is considered low-accuracy (a.k.a course)
• Request ACCESS_COURSE_LOCATION permission
• Fine location providers
• GPS provider is consider high-accuracy (a.k.a fine)
• Request ACCESS_FINE_LOCATION
• Fine location permission implies course
11
12. Location provided through callbacks
• Implement the LocationListener interface to receive updates
• OnLocationChanged
• onProviderEnabled/onProviderDisabled
• onStatusChanged
12
13. Understanding Location class
• Providers row location information
• Core fields
• getLatitude, getLongitude, getAccuracy
• Provides latitude/longitude and accuracy in meters
• Time
• getTime (UTC)
• getElapsedRealtimeNanos
• Added in Android 4.2
• Other information varies depending on provider
• getSpeed, getAltitude ( use has method to check)
13
15. Steps to receive location updates
• Request a reference to location service
• Create instance of LocationListener implementation
• Call the location service’s requestLocationUpdates method
15
16. Getting a single location value
• Getting a single location value quickly
• LocationManage.getLastKnownLocation
• Immediately returns the last Location received by the provider
• Getting a single, current location value
• Locationmanage.requestSingleUpdate
• Uses callback model like requestLocationUpdates
• To run callback on main thread, pass null as the 3rd (Looper) parameter
16
17. Summary
• The LocationManage is exposed as a system service
• Location Providers offer varaying features
• GPS
• Network
• Location requires appropriate security privilages
• Implement LocationListener interface to receive location callbacks
• Location class contains raw details
• Get single location quickly with getLastKnownLocation (watch the
time)
17
23. Do we have time to look into progress
bars
• Let check documentation
23
24. How can you connect with me
• Twitter: @gdjonovic – fastest way to ask question and get answer
• Email: djonovic.g@gmail – send me an email to get material
• LinkedIn: http://www.linkedin.com/in/gdjonovic
• Slide share: http://www.slideshare.net/gorandjonovic
• Git hub: https://github.com/gdjonovic
• Blog: http://gdjonovic.me/ - fresh
24/13
25. Farewell speech
• You are smart – Question everything
• Solve problems
• Be passionate
• Go out your comfort zone – grow
• Share your knowledge
• Learn true value
25