当前位置: 首页 > 编程日记 > 正文

微信小程序获取用户设备的信息

微信小程序开发交流qq群   173683895

   承接微信小程序开发。扫码加微信。

可以获取用户的手机型号,手机操作系统,微信版本,屏幕宽高等等。

Object wx.getSystemInfoSync()

wx.getSystemInfo 的同步版本

返回值

Object res

属性类型说明最低版本
brandstring设备品牌1.5.0
modelstring设备型号
pixelRationumber设备像素比
screenWidthnumber屏幕宽度,单位px1.1.0
screenHeightnumber屏幕高度,单位px1.1.0
windowWidthnumber可使用窗口宽度,单位px
windowHeightnumber可使用窗口高度,单位px
statusBarHeightnumber状态栏的高度,单位px1.9.0
languagestring微信设置的语言
versionstring微信版本号
systemstring操作系统及版本
platformstring客户端平台
fontSizeSettingnumber用户字体大小(单位px)。以微信客户端「我-设置-通用-字体大小」中的设置为准1.5.0
SDKVersionstring客户端基础库版本1.1.0
benchmarkLevelnumber设备性能等级(仅Android小游戏)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50)1.8.0
albumAuthorizedboolean允许微信使用相册的开关(仅 iOS 有效)2.6.0
cameraAuthorizedboolean允许微信使用摄像头的开关2.6.0
locationAuthorizedboolean允许微信使用定位的开关2.6.0
microphoneAuthorizedboolean允许微信使用麦克风的开关2.6.0
notificationAuthorizedboolean允许微信通知的开关2.6.0
notificationAlertAuthorizedboolean允许微信通知带有提醒的开关(仅 iOS 有效)2.6.0
notificationBadgeAuthorizedboolean允许微信通知带有标记的开关(仅 iOS 有效)2.6.0
notificationSoundAuthorizedboolean允许微信通知带有声音的开关(仅 iOS 有效)2.6.0
bluetoothEnabledboolean蓝牙的系统开关2.6.0
locationEnabledboolean地理位置的系统开关2.6.0
wifiEnabledbooleanWi-Fi 的系统开关2.6.0

示例代码

wx.getSystemInfo({success(res) {console.log(res.model)console.log(res.pixelRatio)console.log(res.windowWidth)console.log(res.windowHeight)console.log(res.language)console.log(res.version)console.log(res.platform)}
})
try {const res = wx.getSystemInfoSync()console.log(res.model)console.log(res.pixelRatio)console.log(res.windowWidth)console.log(res.windowHeight)console.log(res.language)console.log(res.version)console.log(res.platform)
} catch (e) {// Do something when catch error
}

相关文章:

php 命令执行crud_如何使用原始JavaScript执行CRUD操作

php 命令执行crudby Zafar Saleem通过Zafar Saleem 如何使用原始JavaScript执行CRUD操作 (How to perform CRUD operations using vanilla JavaScript) Nowadays there are a number of JavaScript frameworks around such as React, Angular, Vue and so on. They all offer …

关于手机系统信息的总结

获取IMEI号: /*** 获取IMEI号* * Description:* param param activity* param return* return String*/public static String getIMEI(Activity activity) {TelephonyManager manager (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);return manage…

pat1011. World Cup Betting (20)

1011. World Cup Betting (20) 时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueWith the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing b…

如何清空定时器

微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 看代码 var aaaa; //利用slice function truncate(arr) {return arr.slice(0, -1); } Page({data: {},onShow() {console.log(yyyyyyyyyyyyyyyyyyy)clearInterval(aaaa)aaaa setInterval(function () {…

如何解决JavaScript中的根查找

介绍 (Introduction) I’ve been wanting to write about this topic for a while now. I recently had the opportunity to work on simulating the GoalSeek functionality of Excel for a web application. I found the whole purpose of GoalSeek and how it works fascina…

菜单样式1:鼠标悬停向下弹出列表

JS部分:var qcloud{};$([_t_nav]).hover(function(){var _nav $(this).attr(_t_nav);clearTimeout( qcloud[ _nav _timer ] );qcloud[ _nav _timer ] setTimeout(function(){$([_t_nav]).each(function(){$(this)[ _nav $(this).attr(_t_nav) ? addClass:remo…

JS 保持数组长度为3位并且值不重复

微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 需求:保存用户搜索的3次历史记录,新的代替旧的,重复的不录入。 这里有几种情况: 1.第一次搜索,搜索的历史缓存数组为空,就直接添…

Mysql 查询 字符串 (索引和通配符)

需要查询的 Mission_Info 字段 值 CYVR-0220-1240-ZYTX-1415-1740-ZUUU-9999-9999-ZZZZ-9999-9999-ZZZZ SELECT Mission_Info FROM flightplan WHERE Mission_Info LIKE %CYVR-____-____% AND Mission_Info LIKE %-ZYTX%AND instr(Mission_Info, CYVR) <instr(Mission_In…

使用Python和NLTK的自然语言处理(NLP)教程

Natural language processing (NLP) is a branch of artificial intelligence that helps computers understand, interpret, and manipulate human language.自然语言处理(NLP)是人工智能的一个分支&#xff0c;可以帮助计算机理解&#xff0c;解释和操纵人类语言。 This vid…

微信公众号网页获取用户信息

微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 效果图 html 代码&#xff1a; <!DOCTYPE html> <html><head><meta name"viewport" content"widthdevice-width, initial-scale1.0, user-scalableno, minimum-sc…

React Native —— App

使用 React Native 作为 app 框架&#xff0c;Redux 作为数据层&#xff0c;因此我们需要选用一些支持性的技术和工具&#xff1a; 开源的 Parse Server 做数据存储 - 运行在 Node.js 上。Flow 用来做 React Native 的 JavaScript 输入错误检查&#xff0c;防止低级的输入错误。…

数据库访问性能优化

数据库访问性能优化 转载于:https://www.cnblogs.com/daishuguang/p/4707357.html

如何使用日志进行程序调试_如何使用日志节省调试时间

如何使用日志进行程序调试by Maya Gilad通过Maya Gilad 如何使用日志节省调试时间 (How to save hours of debugging with logs) A good logging mechanism helps us in our time of need.一个 良好的日志记录机制可以在需要时帮助我们。 When we’re handling a productio…

(转)线程的同步

Java线程&#xff1a;线程的同步-同步方法线程的同步是保证多线程安全访问竞争资源的一种手段。线程的同步是Java多线程编程的难点&#xff0c;往往开发者搞不清楚什么是竞争资源、什么时候需要考虑同步&#xff0c;怎么同步等等问题&#xff0c;当然&#xff0c;这些问题没有很…

wpf浏览器应用程序发布后获取当前应用地址

AppDomain.CurrentDomain.ApplicationIdentity.CodeBase 获取作为URL的部署清单的位置 Eg&#xff1a;发布前地址为E:\PROJECTWORK\LandaV8\bin\Debug\xxxxx.xbap&#xff08;xxxxx.xbap为部署站点下的文件&#xff09;&#xff0c;部署后获取的地址为http://192.168.1.1/xxx…

微信小程序获取用户手机号,后端php实现 (前后端完整代码附效果图)

微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 如图&#xff1a; 小程序代码&#xff1a; 第一步&#xff0c;登录&#xff0c;获取用户的 session_key&#xff1b; 第二步&#xff0c;点击按钮调用 bindgetphonenumber 事件&#xff0c;通过该事件…

pytorch与keras_Keras vs PyTorch:如何通过迁移学习区分外星人与掠食者

pytorch与kerasby Patryk Miziuła通过PatrykMiziuła Keras vs PyTorch&#xff1a;如何通过迁移学习区分外星人与掠食者 (Keras vs PyTorch: how to distinguish Aliens vs Predators with transfer learning) This article was written by Piotr Migdał, Rafał Jakubanis…

Ubuntu 16.04安装QQ(不一定成功)

注意1&#xff1a;如果是刚新装的系统&#xff0c;可以正常安装&#xff0c;但是&#xff0c;如果你已经装了很多软件&#xff0c;千万不要安装&#xff0c;因为会把系统上一般的依赖包和你之前装的软件全部卸载掉&#xff01;甚至将桌面Dock都会卸载&#xff01;最终只能重装U…

for循环动态的给select标签添加option内容

微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 html <select class"form-control selectpicker" name"college" id"eq_num" data-actions-box"true" data-live-search"true" data-live-sea…

Linux下Debug模式启动Tomcat进行远程调试

J2EE开发各类资源下载清单, 史上最全IT资源&#xff0c;点击进入&#xff01; 一&#xff0e; 应用场景 在实际的测试过程中&#xff0c;可能会遇到由于程序执行的不间断性&#xff0c;我们无法构造测试场景来验证某个功能的正确性&#xff0c;只有通过代码级的调试才能验…

guice google_与Google Guice的动手实践

guice googleby Sankalp Bhatia通过Sankalp Bhatia 与Google Guice的动手实践 (A hands-on session with Google Guice) A few months ago, I wrote an article explaining dependency injection. I had mentioned of a follow-up article with a hands-on session of Google …

IQKeyboardManager使用方法

使用方法&#xff1a;将IQKeyboardManager 和 IQSegmentedNextPrevious类文件加进项目中。在AppDelegate文件中写下以下一行代码&#xff1a; [IQKeyBoardManager installKeyboardManager]; 搞定&#xff01; 也可以开启或者关闭keyboard avoiding功能&#xff1a; [IQKeyBoard…

JQ加AJAX 加PHP实现网页登录功能

微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 前端代码 <!DOCTYPE HTML> <html><head><link href"css/style.css" rel"stylesheet" type"text/css" media"all" /><meta http-eq…

web安全简介_Web安全:HTTP简介

web安全简介by Alex Nadalin通过亚历克斯纳达林 Web安全&#xff1a;HTTP简介 (Web Security: an introduction to HTTP) This is part 2 of a series on web security: part 1 was “Understanding The Browser”这是有关网络安全的系列文章的第2部分&#xff1a;第1部分是“…

继承实现的原理、子类中调用父类的方法、封装

一、继承实现的原来 1、继承顺序 Python的类可以继承多个类。继承多个类的时候&#xff0c;其属性的寻找的方法有两种&#xff0c;分别是深度优先和广度优先。 如下的结构&#xff0c;新式类和经典类的属性查找顺序都一致。顺序为D--->A--->E--->B--->C。 class E:…

hdu 5366 简单递推

记f[i]为在长度是i的格子上面至少放一个木桩的方法数。考虑第i个格子&#xff0c;有放和不放两种情况。 1.如果第i个格子放了一个木桩&#xff0c;则i - 1和i - 2格子上面不能放木桩&#xff0c;方案数为&#xff1a;f[i - 3] 1 2.如果第i个格子没有放木桩&#xff0c;则方案数…

git 代理 git_如何不再害怕GIT

git 代理 git了解减少不确定性的机制 (Understanding the machinery to whittle away the uncertainty) 到底什么是Git&#xff1f; (What is Git anyway?) “It’s a version control system.”“这是一个版本控制系统。” 我为什么需要它&#xff1f; (Why do I need it?)…

Python 基础 - Day 2 Assignment - ShoppingCart 购物车程序

作业要求 1、启动程序后&#xff0c;输入用户名密码后&#xff0c;如果是第一次登录&#xff0c;让用户输入工资&#xff0c;然后打印商品列表 2、允许用户根据商品编号购买商品 3、用户选择商品后&#xff0c;检测余额是否够&#xff0c;够就直接扣款&#xff0c;不够就提醒 4…

hdu 1878 欧拉回路

欧拉回路 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10548 Accepted Submission(s): 3849 Problem Description欧拉回路是指不令笔离开纸面&#xff0c;可画过图中每条边仅一次&#xff0c;且可以回到起点…

bootstrap 时间日期日历控件(datetimepicker)附效果图

开发交流QQ群: 173683895 173683895 526474645 人满的请加其它群 效果图 代码 <!DOCTYPE html> <html><head><meta charset"UTF-8"><link href"https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel&q…