In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "how to solve the problem that the Android10/AndroidQ phone cannot be positioned properly in the background". In the daily operation, I believe many people have doubts about how to solve the problem that the Android10/AndroidQ phone cannot be positioned properly in the background. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubt that "how to solve the problem of Android10/AndroidQ phone can not be positioned normally in the background". Next, please follow the editor to study!
Android 10 was officially released in September 2019, bringing about a very significant change in GPS permissions. Users are provided with permission only when using this application. Once users choose "allow only when using this application", APP will not be able to record GPS tracks properly in the background or when locking the screen, which has a great influence on DiDi, bike sharing and running software.
In response to this change, Google also gives a new solution.
Step 1: upgrade SDK
Modify build.gradle and upgrade compileSdkVersion and targetSdkVersion of APP.
Android {compileSdkVersion 29 defaultConfig {targetSdkVersion 29}}
Step 2: increase the permission of background location
Modify the AndroidManifest.xml file, add ACCESS_BACKGROUND_LOCATION permissions, and add android:foregroundServiceType= "location" to the corresponding service.
Step 3: apply for background location permission
If (Build.VERSION.SDK_INT > = Build.VERSION_CODES.Q) {ActivityCompat.requestPermissions (this,arrayOf (Manifest.permission.ACCESS_COARSE_LOCATION, ACCESS_BACKGROUND_LOCATION))} else {ActivityCompat.requestPermissions (this,arrayOf (Manifest.permission.ACCESS_COARSE_LOCATION), 101)}
Through the above method, you can get whether the user allows APP background positioning, and if the user does not allow it, it will prompt the following dialog box.
At this point, the study on "how to solve the problem that Android10/AndroidQ phones can not be positioned properly in the background" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.