Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class MainActivity extends AppCompatActivity {
### Request Permissions

The example below shows how to request permissions for a method that requires both
`CAMERA` and `CHANGE_WIFI_STATE` permissions. There are a few things to note:
`CAMERA` and `ACCESS_FINE_LOCATION` permissions. There are a few things to note:

* Using `EasyPermissions#hasPermissions(...)` to check if the app already has the
required permissions. This method can take any number of permissions as its final
Expand All @@ -56,16 +56,16 @@ The example below shows how to request permissions for a method that requires bo
This can also be achieved by adding logic on the `onPermissionsGranted` callback.

```java
@AfterPermissionGranted(RC_CAMERA_AND_WIFI)
@AfterPermissionGranted(RC_CAMERA_AND_LOCATION)
private void methodRequiresTwoPermission() {
String[] perms = {Manifest.permission.CAMERA, Manifest.permission.CHANGE_WIFI_STATE};
String[] perms = {Manifest.permission.CAMERA, Manifest.permission.ACCESS_FINE_LOCATION};
if (EasyPermissions.hasPermissions(this, perms)) {
// Already have permission, do the thing
// ...
} else {
// Do not have permissions, request them now
EasyPermissions.requestPermissions(this, getString(R.string.camera_and_wifi_rationale),
RC_CAMERA_AND_WIFI, perms);
EasyPermissions.requestPermissions(this, getString(R.string.camera_and_location_rationale),
RC_CAMERA_AND_LOCATION, perms);
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void onClick(View v) {
});

// Button click listener that will request two permissions.
findViewById(R.id.button_location_and_wifi).setOnClickListener(new View.OnClickListener() {
findViewById(R.id.button_location_and_contacts).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
locationAndContactsTask();
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
android:text="@string/camera" />

<Button
android:id="@+id/button_location_and_wifi"
android:id="@+id/button_location_and_contacts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/location_and_contacts" />
Expand Down