Upload
goran-djonovic
View
269
Download
0
Embed Size (px)
DESCRIPTION
Citation preview
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
Potential Revenues sources
• Pay-per download• In-app advertising• In-app purchase• Subscriptions• Affiliate sales
4
• Sponsorship• Promotions• Analytics
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-USB-Driver-for-Windows
• How to use device to run app
6
Android location basics
• Accessing the location systems• Location providers and security• Handling location information• Receiving location updates• Getting a single location value
8
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
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
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
Location provided through callbacks
• Implement the LocationListener interface to receive updates
• OnLocationChanged• onProviderEnabled/onProviderDisabled• onStatusChanged
12
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
Steps to receive location updates
• Request a reference to location service• Create instance of LocationListener implementation• Call the location service’s requestLocationUpdates method
15
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
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
And now – THE TEST
• Just a few questions from summaries
19
Workshop Evaluation
• Why it is so important• What you need to pay attention to
22
Do we have time to look into progress bars
• Let check documentation
23
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
Farewell speech
• You are smart – Question everything• Solve problems • Be passionate• Go out your comfort zone – grow• Share your knowledge• Learn true value
25