react-native-firebase/docs/core/app.md

29 lines
1.1 KiB
Markdown
Raw Normal View History

2017-10-05 04:14:43 +00:00
## Apps
2017-07-17 18:41:51 +00:00
2017-10-05 04:14:43 +00:00
?> For the **default** app see: [Default App](/core/default-app)
2017-07-17 18:41:51 +00:00
2017-10-05 04:14:43 +00:00
?> For initializing **additional apps** natively and also via js code over the RN bridge see: [Dynamically Initializing Apps](/core/initialize-apps)
2017-07-17 18:41:51 +00:00
2017-10-05 04:14:43 +00:00
### Reading App Options
!> `<app>.options.clientId` is not available on the **Android Firebase SDK** so will return null for Android, see the issue: [firebase/firebase-ios-sdk#140 (comment)](https://github.com/firebase/firebase-ios-sdk/issues/140#issuecomment-315953708)
Just like the Firebase web sdk you can view options used to initialize an app instance in the same way, for example:
2017-08-26 04:49:34 +00:00
```js
2017-07-17 18:41:51 +00:00
import firebase from 'react-native-firebase';
const defaultApp = firebase.app();
2017-10-05 04:14:43 +00:00
// get the default app name/options that the app initialized with
2017-07-17 18:41:51 +00:00
console.log("name", defaultApp.name);
console.log("apiKey", defaultApp.options.apiKey);
console.log("applicationId", defaultApp.options.applicationId);
console.log("databaseUrl", defaultApp.options.databaseUrl);
console.log("messagingSenderId", defaultApp.options.messagingSenderId);
console.log("projectId", defaultApp.options.projectId);
console.log("storageBucket", defaultApp.options.projectId);
```