Droidcon NYC 2015 - Android, May I?

By: touchlab

11   0   708

Uploaded on 09/12/2015

Larry Schiefer
HIQES LLC
Android, May I?
http://droidcon.nyc/2015/dcnyc/45/

Droidcon NYC - http://droidcon.nyc
*********************************************
Droidcon NYC has become an event where the American and International Android development and design community come together to share what’s new and what they’ve been working on. Our goal is to serve the community and move the Android platform forward.

In 2015 for the first time touchlab & Apps4All will partner to produce Droidcon SF. Join us there on 11/10-11/11 - http://sf.droidcon.com

Touch Lab - http://touchlab.co
*********************************************
Droidcon NYC was produced by the team at touchlab, America’s premier Android-only development & design shop. Our goal is to keep growing our company by serving the community. Can’t wait for the next Droidcon, stop by our next meetup: http://www.meetup.com/android-developers-nyc.

We’re hiring, get in touch.

Comments (4):

By anonymous    2017-09-20

There are a couple of issues with the code which relate to the problems you are seeing:

  1. Regardless of whether your app has been granted the record audio permission, it still calls promptSpeechInput(). This should not happen unless you have the permission. This means it should be called only if PERMISSION_GRANTED here or when onRequestPermissionResult() is called for the request.
  2. The app is checking for READ_CONTACTS then requesting RECORD_AUDIO.
  3. The result of ActivityCompat.shouldShowRequestPermissionRationale() may not be what you expect if the app has never previously requested the permission. This method should be used only after the app has requested and been denied permission. It provides you with information on whether or not you should inform the user why the permission is needed (and if they want to be told about it.)

The newer permissions model can be tricky to work with. You may find this talk on the new model helpful: https://youtu.be/WGz-alwVh8A

You may also find this permissions helper library easier to work with. It will handle the user prompting under the recommended conditions as well as calling the relevant "protected" code when the app has permission: https://github.com/hiqes/andele

Original Thread

By anonymous    2017-09-20

The permissionChecker() usage looks like it is throwing things off. Just because you have requested the permission does not mean it has been granted.

This Droicon talk will help explain the permissions model and usage: https://youtu.be/WGz-alwVh8A

You may also find this library helpful for keeping your code simpler and easier to follow: https://github.com/hiqes/andele

Original Thread

Submit Your Video

If you have some great dev videos to share, please fill out this form.