//通讯录权限组
group:android.permission-group.CONTACTS
permission:android.permission.WRITE_CONTACTS
permission:android.permission.GET_ACCOUNTS
permission:android.permission.READ_CONTACTS
//通话权限组
group:android.permission-group.PHONE
permission:android.permission.READ_CALL_LOG
permission:android.permission.READ_PHONE_STATE
permission:android.permission.CALL_PHONE
permission:android.permission.WRITE_CALL_LOG
permission:android.permission.USE_SIP
permission:android.permission.PROCESS_OUTGOING_CALLS
permission:com.android.voicemail.permission.ADD_VOICEMAIL
//日历、日程信息权限组
group:android.permission-group.CALENDAR
permission:android.permission.READ_CALENDAR
permission:android.permission.WRITE_CALENDAR
//摄像头权限组
group:android.permission-group.CAMERA
permission:android.permission.CAMERA
//身体传感器权限组
group:android.permission-group.SENSORS
permission:android.permission.BODY_SENSORS
//定位权限组
group:android.permission-group.LOCATION
permission:android.permission.ACCESS_FINE_LOCATION
permission:android.permission.ACCESS_COARSE_LOCATION
//外部存储卡权限组
group:android.permission-group.STORAGE
permission:android.permission.READ_EXTERNAL_STORAGE
permission:android.permission.WRITE_EXTERNAL_STORAGE
//录音权限组
group:android.permission-group.MICROPHONE
permission:android.permission.RECORD_AUDIO
//短信权限组
group:android.permission-group.SMS
permission:android.permission.READ_SMS
permission:android.permission.RECEIVE_WAP_PUSH
permission:android.permission.RECEIVE_MMS
permission:android.permission.RECEIVE_SMS
permission:android.permission.SEND_SMS
permission:android.permission.READ_CELL_BROADCASTS
https://github.com/Vanish136/RTPermission
使用public class MainActivity extends AppCompatActivity implements View.OnClickListener, OnPermissionResultListener
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.btn_main01).setOnClickListener(this);
findViewById(R.id.btn_main02).setOnClickListener(this);
}
@Override
public void onClick(View v)
{
switch (v.getId())
{
case R.id.btn_main01:
new RTPermission.Builder()
.permissions(Manifest.permission.BODY_SENSORS)
.start(this, this);
break;
case R.id.btn_main02:
new RTPermission.Builder()
.permissions(Manifest.permission.WRITE_EXTERNAL_STORAGE
, Manifest.permission.READ_EXTERNAL_STORAGE
, Manifest.permission.RECORD_AUDIO
, Manifest.permission.CAMERA
, Manifest.permission.ACCESS_FINE_LOCATION)
.start(this, this);
break;
}
}
@Override
public void onAllGranted(String[] allPermissions)
{
Toast.makeText(MainActivity.this, "所有权限都已通过", Toast.LENGTH_SHORT).show();
}
@Override
public void onDeined(String[] dinedPermissions)
{
Toast.makeText(MainActivity.this, "无法获取所有权限", Toast.LENGTH_SHORT).show();
}
}