Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"requestPermissions" in Android Permissions is not working #1574

Closed
sabariferin opened this issue May 17, 2017 · 4 comments
Closed

"requestPermissions" in Android Permissions is not working #1574

sabariferin opened this issue May 17, 2017 · 4 comments
Assignees

Comments

@sabariferin
Copy link
Contributor

sabariferin commented May 17, 2017

I'm submitting a ... (check one with "x")
[x ] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://ionicworldwide.herokuapp.com/

Current behavior:
1. I have the below code in my component

 this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.READ_SMS).then(
              success => {  console.log('Permission granted');  }
              err => { console.log('Error'); }
            );

Throwing error: "TypeError: Cannot read proerty 'READ_SMS' of undefined".
Please see the SS below.
image

2. I have the below code in my component
this.androidPermissions.requestPermissions("android.permission.READ_SMS");

Throwing error: "JSON error".
Please see the SS below.
image

@ihadeed ihadeed self-assigned this May 17, 2017
@ihadeed
Copy link
Collaborator

ihadeed commented May 17, 2017

Regarding the first issue, the PERMISSION object was defined incorrectly. I just fixed it and it should work well in the next release.

As for the second issue, the function requestPermissions takes an array of strings, not a single string. The typescript definition is incorrect. I fixed this as well and added requestPermission method to request a single permission.

@sabariferin
Copy link
Contributor Author

Thanks a lot. When can I expect the next release?
May I know your file changes? So that I can update my local code and continue my development.
Thanks again :)

@ihadeed
Copy link
Collaborator

ihadeed commented May 17, 2017

Have a look at ebf4028

I will publish a release soon once I review some more issues.

@didabhs
Copy link

didabhs commented Feb 23, 2018

 this.androidPermissions.requestPermissions([this.androidPermissions.PERMISSION.CAMERA, this.androidPermissions.PERMISSION.GET_ACCOUNTS]).then(
    success => {
      this.presentToast("Has permission?  "+ success,"toast-warning")
  
     
    },
    err => this.androidPermissions.requestPermissions(this.androidPermissions.PERMISSION.CAMERA)
  ); 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants