Android targeting strategy

Source: Internet
Author: User

Request User Permissions

in order to receive from Network_provider or Gps_provider the location of the update, you must pass the declaration access_coarse_location or access_fine_location permission to separate in your Android Request user Permissions in the list, such as:

<manifest ... >

<uses-permission android:name= "Android.permission.ACCESS_FINE_LOCATION"/>

    ...

</manifest>

Without these permissions, your application will have a run-time error when the request location update occurs.

Note: If you are using both Network_provider and Gps_provider, you only need to apply for access_fine_location permissions because it contains the permissions for both location providers. (The access_coarse_location contains only Network_provider permissions.) )

Model that defines the best performance

Location-based applications are now more prevalent, but due to their poor precision, there are a number of ways to get the location of a user's movement, and they want to be able to save power, so getting a user's location is complex. To overcome the barriers to getting a good user position while protecting the battery consumption, you must define a consistent model to specify how the application obtains the user's location. This model contains the opportunity to start and stop listening for updates and to use cached location data.

Process for obtaining a user's location

The following is a typical process flow for acquiring a user's location:

1. launch the application;

2. later, initiate a monitoring of updates to the desired location provider;

3. to maintain a current optimal position assessment by selecting a new location;

4. Stop the monitoring of the location update;

5. Take advantage of the best location for the final assessment.

Figure 1 A visual timeline that demonstrates the location updates that are being monitored in the application, and the timing of these events:

Figure 1. represents the timeline of the window in the application that is used to listen for location updates.

this window model --- during a receive location update, you need to decide when to add location-based services to your application.

Android targeting strategy

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.