Android16Location

January 13, 2018 | Author: Anonymous | Category: Arts & Humanities, Performing Arts, Drama
Share Embed Donate


Short Description

Download Android16Location...

Description

Android 16: Location Kirk Scott

1

2

3

4

• • • • •

16.1 16.2 16.3 16.4 16.5

Introduction Google Services Google Play Services Location APIs Making Your App Location Aware

5

16.1 Introduction • This unit belongs to the third third of the course • It covers a topic that might be of some interest when developing your final project

6

• Unless you planned it up front, it’s unlikely that you could randomly add location • However, this is a worthwhile topic to consider since it’s part of what makes Android mobile devices so interesting

7

• The full title of the related section in the API guide is “Location and Sensors” • This section in the API guides consists of the subsections listed on the following overhead

8

• • • • • •

Location and Maps Location Strategies Sensors Overview Motion Sensors Position Sensors Environment Sensors

9

• What’s shown on the following two overheads is what you find if you go to the section on Location and Maps

10

• Location and Maps • Note: • This is a guide to the Android framework location APIs in the package android.location. • The Google Location Services API, part of Google Play Services, provides a more powerful, highlevel framework that automates tasks such as location provider choice and power management. • Location Services also provides new features such as activity detection that aren't available in the framework API. 11

• Developers who are using the framework API, as well as developers who are just now adding location-awareness to their apps, should strongly consider using the Location Services API. • To learn more about the Location Services API, see Google Location Services for Android.

12

• So the moral of the story is that this set of overheads will not cover any technical content • It will just cover the overview information on the services structure for supporting location in Android apps • It will conclude with the introduction to the training section, where the reader could go for technical content 13

16.2 Google Services

14

15

• Google Services • Google offers a variety of services that help you build new revenue streams, manage app distribution, track app usage, and enhance your app with features such as maps, sign-in, and cloud messaging. • Although these Google services are not included in the Android platform, they are supported by most Androidpowered devices. • When using these services, you can distribute your app on Google Play to all devices running Android 2.2 or higher, and some services support even more devices. 16

• Google Maps • Include the power of Google Maps in your app with an embeddable map view. • You can customize the map with markers and overlays, control the user's perspective, draw lines and shapes, and much more.

17

• Google Play In-App Billing • Build an app with a steady revenue stream that keeps users engaged by offering new content or virtual goods directly in your app. • All transactions are handled by Google Play Store for a simple user experience.

18

• Google+ • Allow users to sign in with their Google account, customize the user experience with Google+ info, pull people into your app with interactive posts, and add +1 buttons so users can recommend your content.

19

• Google Wallet Instant Buy • Provide fast and easy checkout in your app when selling physical goods and services. • Increase conversions by streamlining your purchase flow and reducing the amount of information your customers need to enter.

20

• Google Cloud Platform • Build and host the backend for your Android app at Google-scale. • With an infrastructure that is managed automatically, you can focus on your app. • Then, scale to support millions of users.

21

• Google Analytics • Measure your success and gain insights into how users engage with your app content by integrating Google Analytics. • You can track in-app purchases, the number of active users, interaction patterns, and much more.

22

• Google Cloud Messaging • Immediately notify your users about timely events by delivering lightweight messages from your web server. • There are no quotas or charges to use Google Cloud Messaging.

23

• Google Mobile Ads • Display ads from Google Mobile Ads offer you an alternative revenue opportunity that leverages multiple ad networks with targeted ads and several display formats.

24

16.3 Google Play Services

25

26

• Google Play Services • Give your apps more features to attract users on a wider range of devices. • With Google Play services, your app can take advantage of the latest, Google-powered features such as Maps, Google+, and more, with automatic platform updates distributed as an APK through the Google Play store. • This makes it faster for your users to receive updates and easier for you to integrate the newest that Google has to offer. 27

• Google Technology • Google Play services provides you with easy access to Google services and is tightly integrated with the Android OS. • Easy-to-use client libraries are provided for each service that let you implement the functionality you want easier and faster.

28

• Standard Authorization • All products in Google Play services share a common authorization API that leverages the existing Google accounts on the device. • You and your users have a consistent and safe way to grant and receive OAuth2 access tokens to Google services.

29

• Automatic Updates • Devices running Android 2.2 and newer and that have the Google Play Store app automatically receive updates to Google Play services. • Enhance your app with the most recent version of Google Play services without worrying about your users' Android version. 30

• To start integrating Google Play services into your app, follow the Setup guide.

31

How It Works • The Google Play services client library • The client library contains the interfaces to the individual Google services and allows you to obtain authorization from users to gain access to these services with their credentials.

32

• It also contains APIs that allow you to resolve any issues at runtime, such as a missing, disabled, or out-of-date Google Play services APK. • The client library has a light footprint if you use ProGuard as part of your build process, so it won't have an adverse impact on your app's file size. 33

• If you want to access added features or products, you can upgrade to a new version of the client library as they are released. • However, upgrading is not necessary if you don't care about new features or bug fixes. • We anticipate more Google services to be continuously added, so be on the lookout for these updates. 34

• The Google Play services APK • The Google Play services APK contains the individual Google services and runs as a background service in the Android OS. • You interact with the background service through the client library and the service carries out the actions on your behalf.

35

• An easy-to-use authorization flow is also provided to gain access to the each Google service, which provides consistency for both you and your users. • The Google Play services APK is delivered through the Google Play Store, so updates to the services are not dependent on carrier or OEM system image updates. 36

• In general, devices running Android 2.2 (Froyo) or later and have the Google Play Store app installed receive updates within a few days. • This allows you to use the newest APIs in Google Play services and reach most of the devices in the Android ecosystem (devices older than Android 2.2 or devices without the Google Play Store app are not supported). 37

• The Google Play services APK on user devices receives regular updates for new APIs, features, and bug fixes.

38

• The benefits for your app • Google Play services gives you the freedom to use the newest APIs for popular Google services without worrying about device support. • Updates to Google Play services are distributed automatically by the Google Play Store and new versions of the client library are delivered through the Android SDK Manager. 39

• This makes it easy for you to focus on what's important: your users' experience. • To get started, set up the SDK and check out the various products in the Google Play services platform now!

40

16.4 Location APIs

41

42

• Location APIs • The location APIs make it easy for you to build location-aware applications, without needing to focus on the details of the underlying location technology. • They also let you minimize power consumption by using all of the capabilities of the device hardware. 43

• To get started, first set up the Google Play services SDK. • You can learn how to use the APIs in the training class Making Your App Location Aware, and details are available in the Location API reference.

44

Key Developer Features • Fused location provider • The Fused Location Provider intelligently manages the underlying location technology and gives you the best location according to your needs.

45

• Simple APIs: • Lets you specify high-level needs like "high accuracy" or "low power", instead of having to worry about location providers. • Immediately available: • Gives your apps immediate access to the best, most recent location.

46

• Power-efficiency: • Minimizes your app's use of power. • Based on all incoming location requests and available sensors, fused location provider chooses the most efficient way to meet those needs.

47

• Versatility: • Meets a wide range of needs, from foreground uses that need highly accurate location to background uses that need periodic location updates with negligible power impact.

48

• Geofencing APIs • Lets your app setup geographic boundaries around specific locations and then receive notifications when the user enters or leaves those areas.

49

• Simple but powerful APIs: • Allows batch addition and removal of geofences. • Ability to manage multiple geofences at the same time. • Ability to filter alerts for both entry and exit or entry only or exit only.

50

• Optimized for battery: • Adjusts location updates based on user’s proximity to the geofence and user’s modality (still, walking, driving, and so on).

51

• Activity recognition • With apps becoming increasingly contextual, understanding what the user is doing is critical to surfacing the right content. • The Activity recognition API makes it easy to check the user’s current activity—still, walking, cycling, and in-vehicle—with very efficient use of the battery. 52

• Optimized for battery: • Uses low-power sensors to recognize the user's current physical activity.

53

• Enhances other services with context: • Great for adding movement awareness to location awareness. • Apps can adjust the amount of location awareness they provide, based on the current user movement. • For example, a navigation app can request more frequent updates when the user is driving. 54

• Features for advanced applications: • For advanced applications that want to do their own post-processing, this API also makes available confidence values for each of the activities. • It also includes two activities that indicate unreliable measurements: unknown and tilt.

55

16.5 Making Your App Location Aware • [Note: This section is taken from the training part of the developers’ Web site.]

56

• Making Your App Location-Aware • One of the unique features of mobile applications is location awareness. • Mobile users bring their devices with them everywhere, and adding location awareness to your app offers users a more contextual experience.

57

• The new Location Services API available in Google Play services facilitates adding location awareness to your app with automated location tracking, geofencing, and activity recognition. • This API adds significant advantages over the plaform's location API.

58

• This class [training class, not API class] shows you how to use Location Services in your app to get the current location, get periodic location updates, look up addresses, create and monitor geofences, and detect user activities. • The class includes sample apps and code snippets that you can use as a starting point for adding location awareness to your own app.

59

• Note: Since this class is based on the Google Play services client library, make sure you install the latest version before using the sample apps or code snippets. • To learn how to set up the client library with the latest version, see Setup in the Google Play services guide.

60

Lessons • • • •

Retrieving the Current Location Learn how to retrieve the user's current location. Receiving Location Updates Learn how to request and receive periodic location updates. • Displaying a Location Address • Learn how to convert a location's latitude and longitude into an address (reverse geocoding). 61

• Creating and Monitoring Geofences • Learn how to define one or more geographic areas as locations of interest, called geofences, and detect when the user is close to or inside a geofence.

62

• Recognizing the User's Current Activity • Learn how to recognize the user's current activity, such as walking, bicycling, or driving a car, and how to use this information to modify your app's location strategy.

63

• Testing Using Mock Locations • Learn how to test a location-aware app by injecting mock locations into Location Services. • In mock mode, Location Services sends out mock locations that you inject instead of sensor-based locations.

64

Summary and Mission • This is where this set of overheads ends • For the time being, none of the individual classes will be covered • The end of the semester is nearing • If anyone is interested, they will have to pursue this on their own

65

The End

66

View more...

Comments

Copyright � 2017 NANOPDF Inc.
SUPPORT NANOPDF