Is this a bug report?
Yes
Yes
Environment
react-native -v: 0.45.1
node -v: 7.9.0
npm -v: 4.2.0
yarn --version: 0.23.2
Then, specify:
- Development Operating System: macOC Sierra
- Build tools: Android Studio
Steps to Reproduce
- ask for permission just like in documentation
- press home button
- open the App again and it crashes on this line
if (results[0] == PackageManager.PERMISSION_GRANTED) {
Expected Behavior
Check results array before accessing it.
instead of
if (results[0] == PackageManager.PERMISSION_GRANTED) {
something like
if (results.length > 0 && results[0] == PackageManager.PERMISSION_GRANTED) {
Actual Behavior
On some devices app crashes after Requesting a permission on Android. App crashed on Xiaomi Redmi 4 Prime(Android 6.0.1), Lenovo C2 (Android 6.0), Sony Xperia Z3Compact (Android 6.0.1), Samsung Galaxy A3 (Android 7.0.). App is not crashing on Huawei P10 lite(Android 7) or Sony Xperia L1(Android 7). After crash, the app is restarted.
Reproducible Demo
(Paste the link to an example project and exact instructions to reproduce the issue.)
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
react-native -v: 0.45.1node -v: 7.9.0npm -v: 4.2.0yarn --version: 0.23.2Then, specify:
Steps to Reproduce
if (results[0] == PackageManager.PERMISSION_GRANTED) {Expected Behavior
Check results array before accessing it.
instead of
if (results[0] == PackageManager.PERMISSION_GRANTED) {something like
if (results.length > 0 && results[0] == PackageManager.PERMISSION_GRANTED) {Actual Behavior
On some devices app crashes after Requesting a permission on Android. App crashed on Xiaomi Redmi 4 Prime(Android 6.0.1), Lenovo C2 (Android 6.0), Sony Xperia Z3Compact (Android 6.0.1), Samsung Galaxy A3 (Android 7.0.). App is not crashing on Huawei P10 lite(Android 7) or Sony Xperia L1(Android 7). After crash, the app is restarted.
Reproducible Demo
(Paste the link to an example project and exact instructions to reproduce the issue.)