当前位置:网站首页>Set the location permission in the shutter to "always allow"
Set the location permission in the shutter to "always allow"
2022-06-25 09:43:00 【Moon Spring】
Link to the original text :https://www.5axxw.com/questions/content/6zrs4y
Use permission_handler After setting the location permission, only ’ Allow... Only when using the app ’, After looking for a while, I couldn't find the reason . The link above solves my problem .
/// Dynamically apply for location permission
void requestPermission() async {
// Application authority
bool hasLocationPermission = await requestLocationPermission();
if (hasLocationPermission) {
print(" The application for location permission passed ");
} else {
print(" The application for location permission fails ");
}
}
/// Apply for location rights
/// Granting location permission returns true, Otherwise return to false
Future<bool> requestLocationPermission() async {
// Get current permissions
var locationWhenInUse = await Permission.location.status;
if (locationWhenInUse == PermissionStatus.granted) {
// Has authorized
return true;
} else {
// If not authorized, initiate an application
locationWhenInUse = await Permission.location.request();
if (locationWhenInUse == PermissionStatus.granted) {
return true;
} else {
return false;
}
}
}
//***************************** Split line *************************************************//
AndroidManifest.xml Used in
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION " />
Adding a permission
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
Then, there are... In the location permission settings “ Always allow ” The choice of .
边栏推荐
- Neat Syntax Design of an ETL Language (Part 2)
- [wechat applet full stack development course] course directory (mpvue+koa2+mysql)
- [zero foundation understanding innovation and entrepreneurship competition] overall cognition and introduction of mass entrepreneurship and innovation competition (including FAQs and integration of bl
- [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate
- 处理图片类库
- Creo makes a mobius belt in the simplest way
- STM32 receives data by using idle interrupt of serial port
- 35 websites ICER must know
- 2台三菱PLC走BCNetTCP协议,能否实现网口无线通讯?
- Is the client that gets the scanning code wechat or Alipay
猜你喜欢

Chitubox micromake l3+ slicing software configuration correspondence

Pytorch_ Geometric (pyg) uses dataloader to report an error runtimeerror: sizes of tenants must match except in dimension 0
![[MySQL learning notes 21] storage engine](/img/3a/a3cd573281efc689cafdb7d7562ce0.png)
[MySQL learning notes 21] storage engine

puzzle(019.2)六边锁

How much money have I made by sticking to fixed investment for 3 years?

Question B of the East China Cup: how to establish a population immune barrier against novel coronavirus?

With the QQ group file storage function of super nice, you immediately have n cloud disks that are easy to download and never expire
![[competition - Rural Revitalization] experience sharing of Zhejiang Rural Revitalization creative competition](/img/b4/84c30ed112c4dffd8d51697b2f4a4f.jpg)
[competition - Rural Revitalization] experience sharing of Zhejiang Rural Revitalization creative competition

Data-driven anomaly detection and early warning of item C in the May 1st mathematical modeling competition in 2021

使用Navicat对比多环境数据库数据差异和结构差异,以及自动DML和DDL脚本
随机推荐
Question B of the East China Cup: how to establish a population immune barrier against novel coronavirus?
35 websites ICER must know
What are the PMP scores?
[design completion - opening report] zufeinfo 2018 software engineering major (including FAQ)
How do dating applets make millions a year? What is the profit model?
C语言刷题随记 —— 猴子吃桃
Atguigu---01-scaffold
MySQL创建给出语句
Reasons for Meiye to choose membership system
[buuctf.reverse] 117-120
Neo4jdesktop (neo4j desktop version) configures auto start (boot auto start)
Cassava tree disease recognition based on vgg16 image classification
[buuctf.reverse] 121-125
[project part - structure and content writing of technical scheme] software system type mass entrepreneurship and innovation project plan and Xinmiao guochuang (Dachuang) application
I put a two-dimensional code with rainbow candy
A game WP
Japanese online notes for postgraduate entrance examination (9): composition template
Fcpx quickly add subtitles | Final Cut Pro import fcpxml subtitle file does not match the video time? I got it in code
Rxjs TakeUntil 操作符的学习笔记
匯付國際為跨境電商賦能:做合規的跨境支付平臺!