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

[TIMOB-20320] Android: Provide generic requestPermission(s) method #7778

Closed
wants to merge 3 commits into from
Closed

[TIMOB-20320] Android: Provide generic requestPermission(s) method #7778

wants to merge 3 commits into from

Conversation

stgrosshh
Copy link
Contributor

Add generic permissions request handling for Android Marshmallow
see example usage in tipermissions module
https://github.com/stgrosshh/tipermissions

JIRA: https://jira.appcelerator.org/browse/TIMOB-20320

Add generic permissions request handling for Android Marshmallow
see example usage in tipermissions module
https://github.com/stgrosshh/tipermissions
@AppWerft
Copy link

It is very handy to use. Actually we only need requestPermissions(). hasPermission() is only for static test.

Here my test:

require('ti.permissions').requestPermissions(['android.permission.RECORD_AUDIO', 'android.permission.WRITE_EXTERNAL_STORAGE'], 0, function(e) {
    if (e.success == !0) startAudioRecorder();
    else alert(L('USER_HAS_DENIED'));
});

Change to strong references to avoid some issues with async UI creation
Provide infos about requested and denied permissions in callback result
@ashcoding
Copy link
Contributor

There seems to be slight formatting issues here and there in the code. Could you format the code?
Line 558 to 564. Line 460. Line 495. Line 112. Line 121. (And maybe a bit more)
You can refer to this to fix it up http://docs.appcelerator.com/platform/latest/#!/guide/Java_Coding_Standards

Or if you're using an IDE with some format function, that might help speed things up. :)

@hansemannn hansemannn changed the title Proposal for TIMOB-20320 [TIMOB-20320] Android: Provide generic requestPermission(s) method Mar 1, 2016
@stgrosshh
Copy link
Contributor Author

Done formatting as requested.

@hansemannn
Copy link
Collaborator

@stgrosshh Can you add the docs for your new method? Also, how does this affect current apps? We have to ensure backwards-compatibility by deprecating the old API. Thank you!

@stgrosshh
Copy link
Contributor Author

@hansemannn for documentation pls see the provided JavaDoc. It's meant as a means for module developers primarily. See my tipermissions module https://github.com/stgrosshh/tipermissions for an example of usage.

I deprecated the old permission specific methods in my PR so there would be time for migration. I think some of the Appcelerator provided modules use those right now. Therefore some migration effort would be required though. In the meantime they still work of course.

@hieupham007
Copy link
Contributor

Thanks for your contributions! I've refactored the code so we can remove the deprecated internal methods. Please refer to this PR: #7948

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

Successfully merging this pull request may close these issues.

None yet

5 participants