Android Landfills series: On the Millet series and other models on the release of positioning permission after the positioning of the request frame sample _android

Source: Internet
Author: User

Background

In the near future, because of the actual project needs, under the specific operation trigger the location request, takes the user position and the nearby position.

Problem:

After the initial selection, the final decision to access Baidu positioning, according to Baidu positioning SDK Android documents, access process relatively smooth.
But then found that in the Millet series and other parts of the model, into the app will appear "is trying to network or satellite to your mobile phone positioning."
Affects the user experience very much.

Resolution process:

1.Flurry Little Pit.

The project introduced a number of Third-party SDK, mainly including flurry, friends, a push, Baidu positioning SDK and so on. In the app startup initialization and into the first page of the implementation stream, mainly related to flurry, friends, a push.

And through all the introduction of the project in the Third-party SDK jar packet Search Locationmanager, found only flurry and Baidu positioning contains. So, preliminary positioning to flurry. Remove the flurry, found in this type of model on the app on the location of the request to appear the scene did disappear.

In flurry Official document finally found the corresponding switch interface: Flurryagent.setreportlocation (Boolean); This method directly determines whether the flurry escalation of the user address location information, and its default value is true.

Then, after the init of Flurry, call Flurryagent.setreportlocation (false) directly; Test again, the above must solve the problem.

2. Friendship Union's goodness

This thought that the problem has ended, do not want in the subsequent use of the process, in the Millet series and other models will appear on the irregular Position request pop-up box, and after careful verification, at this time also did not trigger the app's own positioning request, and the main problem is: irregular appearance, too weird!

There are some information on the Internet, there is no good clue. However, the above flurry resolution process gives some ideas, since the flurry has the right to locate the default access to geographic information, then other SDK will also be similar? With a curious mentality, looked at the next Friend League class file,

Found one of the Methods Setautolocation (Boolean), Ha, this is not the same as flurry. However, the discovery of a strange phenomenon, the Setautolocation method in the league has been abandoned.

public class Mobclickagent {
  private static final String a = ' input map is null ';
  Private static final D B = new D ();

  Public mobclickagent () {
  
  }

  /** @deprecated */public
  static void Setautolocation (Boolean var0) {
  
  }
  
  ...
  
}

has been abandoned, and become an empty method, that will be the hegemony of the Alliance, in the secret access to geographical information when the app does not even provide switch interface?

This switch method has been abandoned, there must be a reason, and finally found the old version of this method did not discard the friends of the Alliance SDK, compare the class file, found that the old version of the league SDK in the Locationmanager method, but the new version has not. And some people at the league forum have talked about this issue, and after the union was removed,

After a lot of testing found that the problem does exist, it seems that the Union is still very good, directly removed the access to user positioning information, so this switch method of course discarded.

3. Baidu positioning of the puzzle

Baidu Positioning SDK documentation requires the right to locate

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

In fact, having access_fine_location permissions also has access_coarse_location permissions. A large number of test results show that when the mobile phone on the GPS open, positioning pop-up box is a large probability, and Baidu positioning is the use of mixed positioning, the actual needs of the project without precise positioning,

Rough positioning has been able to meet the needs, then will have some relationship with the permissions, so the access_fine_location into Access_coarse_location, and through the reverse solution with other apps, the horizontal contrast, found that other use of Baidu positioning of the app is only the use of a cursory positioning authority, decisively changed.

After the change found that the location of the frame irregular occurrence probability is reduced.

Baidu positioning configuration also has the following service configuration

<!--Baidu Positioning service-->
 <service
  android:name= "com.baidu.location.f"
   android:enabled= "true"
   android:process= ": Remote" >
 </service>

In the actual test, found that if the permission is access_fine_location, the service configuration plus android:exported= "false" also to some extent, the probability of the positioning of the frame decreased,

Here decisively plus.

<!--Baidu Positioning service-->
<service
  android:name= "com.baidu.location.f"
  android:enabled= "true"
  Android:exported= "false"
  android:process= ": Remote" >
</service>

4. A push of the pit

After the above changes, irregular occurrence of the position of the bomb box probability is relatively small. I have it once in a long time. So who triggered the location request? After a lot of testing, it turns out that the problem becomes mandatory when the system time is modified.

Now that we have found a necessary path, we can locate a lot. Decisively remove Baidu positioning, friends of the Alliance and Flurry. However, the issue remains in the existing path under the required location.

Remove the push initialization and so on, the problem is decisively gone under the required path. I found you, a push!!

I thought some kind of good you should be with flurry and the old version of the Alliance, like, provide switch interface, but disappointed!

Contact a push the so-called technical support, the other side affirmed a push in the location of the right situation to get the position information, but for the switch interface problem answer chic!

But it does affect the user experience!!

At this point, puzzled over the days of the problem finally find the reason. The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

Related Article

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.