当前位置:网站首页>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 .
边栏推荐
- Neo4jdesktop (neo4j desktop version) configures auto start (boot auto start)
- Use Navicat to compare data differences and structure differences of multi environment databases, and automatic DML and DDL scripts
- Online notes on Mathematics for postgraduate entrance examination (8): Kego equations, eigenvalues and eigenvectors, similarity matrix, quadratic series courses
- js工具函数,自己封装一个节流函数
- 富时A50开户什么地方安全
- 可穿戴设备或将会泄露个人隐私
- [competition -kab micro entrepreneurship competition] KAB National College Students' micro entrepreneurship action participation experience sharing (including the idea of writing the application form)
- Flitter gets the height of the top status bar
- Voiceprint Technology (IV): Engineering deployment of voiceprint recognition
- Mysql 源码阅读(二)登录连接调试
猜你喜欢
[zufe school competition] difficulty classification and competition suggestions of common competitions in the school (taking Zhejiang University of Finance and economics as an example)
x86电脑上下载debian的arm64的包
x86的编码格式
Why should the terminal retail industry choose the member management system
【mysql学习笔记22】索引
Etcd教程 — 第四章 Etcd集群安全配置
SQL advanced
Remove the mosaic, there's a way, attached with the running tutorial
Atguigu---17-life cycle
8. Intelligent transportation project (1)
随机推荐
CYCA 2022少儿形体礼仪初级师资班 深圳总部站圆满结束
PHP obtains the IP address, and the apache2 server runs without error
Encoding format for x86
Mapping mode of cache
How to "transform" small and micro businesses (II)?
Study on correlation of pumpkin price and design of price prediction model based on BP neural network
Online notes on Mathematics for postgraduate entrance examination (9): a series of courses on probability theory and mathematical statistics
Processing picture class library
测试开发工程师
Is it safe to open a stock account through the account opening QR code of the account manager?
瑞萨RA系列-开发环境搭建
Armbian version name comparison
[buuctf.reverse] 117-120
x86电脑上下载debian的arm64的包
Wallys/MULTI-FUNCTION IPQ6010 (IPQ6018 FAMILY) EMBEDDED BOARD WITH ON-BOARD WIFI DUAL BAND DUAL
What functions should smart agriculture applet system design have
How to download the school logo, school name and corporate logo on a transparent background without matting
Data-driven anomaly detection and early warning of 21 May Day C
Creating a binary tree (binary linked list) from a generalized table
[zufe school competition] difficulty classification and competition suggestions of common competitions in the school (taking Zhejiang University of Finance and economics as an example)