Giter Site home page Giter Site logo

myruntimepermission's Introduction

运行时权限处理:
    对于一些危险权限,在6.0以下的系统中,只要在AndroidManifest中注册了则可以正常运行; 但针对Android6.0以上的版本,只在AndroidManifest中注册仍会崩溃,
    其还需要在运行时进行权限处理。

    重点:
    ①检查某一项权限是否授权
        ContextCompat.checkSelfPermission()

    ②请求未授权的权限(可同时请求多个权限)(每一子项都不能为空!!!,否则不会弹出系统框)
        ActivityCompat.requestPermissions()

    ③ActivityCompat.shouldShowRequestPermissionRationale
        返回值 true: 第一次拒绝(未勾选不再提示)且后续再次判断时
        返回值 false:第一次判断;勾选不在提示框并拒绝后,再次判断

    ④生命周期流转(注:请求不一定要放在onClick中)
        onCrete->onStart->onResume->onclick->onPause->onResume

    ⑤待理解:
    AppOpsManagerCompat
    AppOpsManager

    ⑥华为手机位置信息关闭后的定位处理

    备注:查看手机危险权限命令行
    adb shell pm list permissions -d -g

myruntimepermission's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.