惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
月光博客
月光博客
MyScale Blog
MyScale Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
爱范儿
爱范儿
P
Proofpoint News Feed
人人都是产品经理
人人都是产品经理
Last Week in AI
Last Week in AI
罗磊的独立博客
G
Google Developers Blog
Y
Y Combinator Blog
博客园 - 【当耐特】
WordPress大学
WordPress大学
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
J
Java Code Geeks
酷 壳 – CoolShell
酷 壳 – CoolShell
V
Visual Studio Blog
美团技术团队
宝玉的分享
宝玉的分享
Jina AI
Jina AI
小众软件
小众软件
T
Tailwind CSS Blog
A
About on SuperTechFans

博客园 - Jokeyyu

联想扬天V340笔记本进入BIOS currentTimeMillis获取时间异常,基于服务器获取当前世界真实时间 git 打补丁用.diff文件不能成功 打包的时候报错 app:lintVitalRelease ,不能下载kotlin-compiler-27.0.1.jar tag mismatch 注册了上下文菜单的列表长按没有效果 recycleview 支持context menu android studio 不能安装调试并没有提示哪里异常 mysql 将一个字段的值复制到另一个字段 新单词 part 20 git 打patch 流程 新单词 part 19 新单词 part 18 retrofit 同时上传文件和参数 数据结构笔记 reclyceview 实现自由拖动排序 Android material-design-icons 图标资源 好用的 pdf 加载工具 wifi 开发指南 viewbinding 和 include 标签同时使用时注意事项
Android 11 wifiInfo.getSSID 获取不到WiFi名称
Jokeyyu · 2023-08-08 · via 博客园 - Jokeyyu

android 高版本获取WiFi名称需要授予位置权限:

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

获取权限代码:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
if (ContextCompat.checkSelfPermission(getApplicationContext(),
Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQ_CODE_FINE_LOCATION);
}
}

获取权限回调

public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case REQ_CODE_FINE_LOCATION:
if (grantResults.length > 0 &&
grantResults[0] == PackageManager.PERMISSION_GRANTED) {
} else {
TMLUtils.showTips(this, getString(R.string.req_location_tips));
}
break;
}
}