飞行模式的开启和关闭

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

if(Settings.System.getString(getActivity().getContentResolver(),Settings.Global.AIRPLANE_MODE_ON).equals("0")) { Settings.System.putInt(getActivity().getContentResolver(),Settings.Global.AIRPLANE_MODE_ON,1); Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); intent.putExtra("state",true); getActivity().sendBroadcast(intent); Log.i(TAG,"airplane on"); } else { Settings.System.putInt(getActivity().getContentResolver(), Settings.Global.AIRPLANE_MODE_ON,0); Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); intent.putExtra("state",false); getActivity().sendBroadcast(intent); Log.i(TAG,"airplane off"); } <uses-permission android:name="android.permission.WRITE_SETTINGS"/> <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/> 这个权限有警告,这是因为只有系统程序才能有这个权限,我的程序是普通程序不能写这个权限要求,写了也没有用。 当在我的手机(android5.1.1)上运行时报异常: java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.AIRPLANE_MODE from pid=928, uid=10118

这是因为我的手机API超过了4.2,必须要root之后才能有效。 网上有二篇文件介绍: http://blog.csdn.net/hrklzwzj/article/details/51940507 http://blog.csdn.net/u012889434/article/details/71248917

转载于:https://my.oschina.net/u/2963604/blog/1621990

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/391197.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

消解原理推理_什么是推理统计中的Z检验及其工作原理?

消解原理推理I Feel:我觉得&#xff1a; The more you analyze the data the more enlightened, data engineer you will become.您对数据的分析越多&#xff0c;您将变得越发开明。 In data engineering, you will always find an instance where you need to establish whet…

pytest+allure测试框架搭建

https://blog.csdn.net/wust_lh/article/details/86685912 https://www.jianshu.com/p/9673b2aeb0d3 定制化展示数据 https://blog.csdn.net/qw943571775/article/details/99634577 环境说明&#xff1a; jdk 1.8 python 3.5.3 allure-commandline 2.13.0 文档及下载地址&…

lintcode433 岛屿的个数

岛屿的个数 给一个01矩阵&#xff0c;求不同的岛屿的个数。 0代表海&#xff0c;1代表岛&#xff0c;如果两个1相邻&#xff0c;那么这两个1属于同一个岛。我们只考虑上下左右为相邻。 您在真实的面试中是否遇到过这个题&#xff1f; Yes样例 在矩阵&#xff1a; [[1, 1, 0, …

大数据分析要学习什么_为什么要学习数据分析

大数据分析要学习什么The opportunity to leverage insights from data has never been greater.利用来自数据的洞察力的机会从未如此大。 Humans tend to generate a lot of data each day - from heart rates to favorite songs, fitness goals and movie preferences. You …

POJ - 3257 Cow Roller Coaster (背包)

题目大意&#xff1a;要用N种材料建一条长为L的路&#xff0c;如今给出每种材料的长度w。起始地点x。发费c和耐久度f 问&#xff1a;在预算为B的情况下&#xff0c;建好这条路的最大耐久度是多少 解题思路&#xff1a;背包问题 dp[i][j]表示起始地点为i。发费为j的最大耐久度…

leetcode 1473. 粉刷房子 III(dp)

在一个小城市里&#xff0c;有 m 个房子排成一排&#xff0c;你需要给每个房子涂上 n 种颜色之一&#xff08;颜色编号为 1 到 n &#xff09;。有的房子去年夏天已经涂过颜色了&#xff0c;所以这些房子不需要被重新涂色。 我们将连续相同颜色尽可能多的房子称为一个街区。&a…

大学生信息安全_给大学生的信息

大学生信息安全You’re an undergraduate. Either you’re graduating soon (like me) or you’re in the process of getting your first college degree. The process is not easy and I can only assume how difficult the pressures on Masters and Ph.D. students are. Ho…

打破冷漠僵局文章_保持冷静并打破僵局-最佳

打破冷漠僵局文章Hack The Box (HTB) is an online platform allowing you to test your penetration testing skills. It contains several challenges that are constantly updated. Some of them simulating real world scenarios and some of them leaning more towards a …

使用DOM Breakpoints找到修改属性的Javascript代码

使用Chrome开发者工具的DOM断点功能可以让您快速找到修改了某一个DOM元素的Javascript代码。 在Chrome开发者工具里&#xff0c;选中想要监控的DOM元素&#xff0c;点击右键&#xff0c;选择Break on->Attributes modifications: 之后在DOM Breakpoints的tab里能看到对应的断…

特斯拉最安全的车_特斯拉现在是最受欢迎的租车选择

特斯拉最安全的车Have you been curious to know which cars are most popular in US and what are their typical rental fares in various cities? As the head of Product and Data Science at an emerging technology start-up, Ving Rides, these were some of the quest…

leetcode 740. 删除并获得点数(dp)

给你一个整数数组 nums &#xff0c;你可以对它进行一些操作。 每次操作中&#xff0c;选择任意一个 nums[i] &#xff0c;删除它并获得 nums[i] 的点数。之后&#xff0c;你必须删除每个等于 nums[i] - 1 或 nums[i] 1 的元素。 开始你拥有 0 个点数。返回你能通过这些操作…

WebSocket入门

WebSocket前言  WebSocket是HTML5的重要特性&#xff0c;它实现了基于浏览器的远程socket&#xff0c;它使浏览器和服务器可以进行全双工通信&#xff0c;许多浏览器&#xff08;Firefox、Google Chrome和Safari&#xff09;都已对此做了支持。 在WebSocket出现之前&#xff…

安卓游戏开发推箱子_保持冷静并砍箱子-开发

安卓游戏开发推箱子Hack The Box (HTB) is an online platform allowing you to test your penetration testing skills. It contains several challenges that are constantly updated. Some of them simulating real world scenarios and some of them leaning more towards …

自定义TabLayout

本文为kotlin仿开眼视频Android客户端的后续补充内容&#xff0c;本篇为大家介绍如何对TabLayout进行定制使用&#xff0c;基于项目需求&#xff0c;本篇主要对部分功能进行了定制&#xff0c;如&#xff1a;指示器距离文字的距离、文字选中加粗、文字选中变大等 本文部分代码参…

ml dl el学习_DeepChem —在生命科学和化学信息学中使用ML和DL的框架

ml dl el学习Application of Machine Learning and Deep Learning for Drug Discovery, Genomics, Microsocopy and Quantum Chemistry can create radical impact and holds the potential to significantly accelerate the process of medical research and vaccine developm…

响应式网站设计_通过这个免费的四小时课程,掌握响应式网站设计

响应式网站设计This video tutorial from Kevin Powell teaches you to build responsive websites from scratch. 凯文鲍威尔(Kevin Powell)的这段视频教程教您从头开始构建响应式网站。 The course starts with explaining the core concepts needed to start thinking resp…

2017-2018-1 20179215《Linux内核原理与分析》第二周作业

20179215《Linux内核原理与分析》第二周作业 这一周主要了解了计算机是如何工作的&#xff0c;包括现在存储程序计算机的工作模型、X86汇编指令包括几种内存地址的寻址方式和push、pop、call、re等几个重要的汇编指令。主要分为两部分进行这周的学习总结。第一部分对学习内容进…

python:单例模式--使用__new__(cls)实现

单例模式&#xff1a;即一个类有且仅有一个实例。 那么通过python怎么实现一个类只能有一个实例呢。 class Earth:"""假如你是神&#xff0c;你可以创造地球"""print 欢迎来到地球# 生成一个地球 a Earth() print id(a)# 再生成一个地球 b Ear…

重学TCP协议(5) 自连接

1.自连接是什么 在发起连接时&#xff0c;TCP/IP的协议栈会先选择source IP和source port&#xff0c;在没有显示调用bind()的情况下&#xff0c;source IP由路由表确定&#xff0c;source port由TCP/IP协议栈从local port range中选取尚未使用的port。 如果destination IP正…

Gradle复制文件/目录方法

2019独角兽企业重金招聘Python工程师标准>>> gradle复制文件/文件夹方法 复制文件 //复制IDE生成的classes.jar文件到build/libs中&#xff0c;并改名为FileUtils.jar. task copyFile(type:Copy) {delete build/libs/FileUtils.jarfrom(build/intermediates/bundles…