opened
vanlooverenkoen
username_0
### Issue Description

Tried to use permissions API while not attached to an Activity.
I am using react-native-navigation to start a Tab Navigation. In one of the tabs I request permission to read Contacts. with this code:

```
  getContacts = async () => {
    const resp = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.READ_CONTACTS);
    console.warn("Permission => " + resp);
    if (resp) {
      console.warn("GET ALL CONTACTS");
    } else {
      try {
        const granted = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.READ_CONTACTS);
        if (granted === PermissionsAndroid.RESULTS.GRANTED) {
          console.warn("GET ALL CONTACTS");
        } else {
          console.warn("PERMISSION DENIED");
        }
      } catch (err) {
        console.warn(err);
      }
    }
  }

```
The permissions dialog is shown. But when I press allow or deny. The app crashes with this error
`Tried to use permissions API while not attached to an Activity.`

How can I handle this issue?

### Steps to Reproduce / Code Snippets / Screenshots

Create a tab navigation and in the first tab request permission in the componentDidMount.

---
### Environment
React Native Navigation version: 1.1.406
React Native version: 0.52.2
Platform(s) (iOS, Android, or both?): Android
Device info (Simulator/Device? OS version? Debug/Release?): Simulator, device, any OS, any buildType.
Tried to use permissions API while not attached to an Activity.
issue
created
vanlooverenkoen
username_0
I currently use a timeout of 500 ms. and everything works fine. But the crash happens from an Activity but yet it is not attached to an activity. makes no sense
![image](https://user-images.githubusercontent.com/21172855/41097498-75b2c326-6a58-11e8-86df-7e8f80e6d9f5.png)
comment
created
garrottkai
username_1
This is happening for me when requesting location permissions
comment
created
hugows
username_2
I had to go into "App info" (Android emulator) and then concede Location permissions manually - but the app never asked for them. Now the app works... (in debug/dev still).
comment
created
heron2014
username_3
I am having the same issue with location permission. I am using react-native-navigation version 1, would that mean the issue is resolved in version 2?

Did you resolve it @username_1?
comment
created
amin3mej
username_4
Any update???
comment
created
umerbaig
username_5
facing same issue
comment
created
thekundankamal
username_6
comment