├── .gitignore ├── LICENSE ├── README.md ├── android-logo.png ├── docs ├── _config.yaml ├── _search.yaml ├── _sidebar.yaml ├── about.md ├── admob │ ├── android.md │ ├── error-handling.md │ ├── ios.md │ ├── reference │ │ ├── AdRequest.md │ │ ├── Banner.md │ │ ├── Interstitial.md │ │ ├── NativeExpress.md │ │ ├── RewardedVideo.md │ │ ├── VideoOptions.md │ │ └── admob.md │ └── sizes.md ├── analytics │ ├── android.md │ ├── ios.md │ ├── reference │ │ └── analytics.md │ └── reserved-events.md ├── auth │ ├── android.md │ ├── getting-started.md │ ├── ios.md │ ├── phone-auth.md │ ├── reference │ │ ├── ActionCodeInfo.md │ │ ├── ActionCodeSettings.md │ │ ├── AdditionalUserInfo.md │ │ ├── AuthCredential.md │ │ ├── AuthSettings.md │ │ ├── ConfirmationResult.md │ │ ├── EmailAuthProvider.md │ │ ├── Error.md │ │ ├── FacebookAuthProvider.md │ │ ├── GithubAuthProvider.md │ │ ├── GoogleAuthProvider.md │ │ ├── IdTokenResult.md │ │ ├── OAuthCredential.md │ │ ├── OAuthProvider.md │ │ ├── PhoneAuthProvider.md │ │ ├── TwitterAuthProvider.md │ │ ├── User.md │ │ ├── UserCredential.md │ │ ├── UserInfo.md │ │ ├── UserMetadata.md │ │ └── auth.md │ └── social-auth.md ├── config │ ├── android.md │ ├── example.md │ ├── ios.md │ └── reference │ │ └── config.md ├── contributing.md ├── core │ ├── default-app.md │ ├── initialize-apps.md │ └── reference │ │ ├── App.md │ │ └── core.md ├── crashlytics │ ├── android.md │ ├── ios.md │ ├── manual-initialization.md │ └── reference │ │ └── crashlytics.md ├── database │ ├── android.md │ ├── ios.md │ └── reference │ │ ├── DataSnapshot.md │ │ ├── OnDisconnect.md │ │ ├── Query.md │ │ ├── Reference.md │ │ ├── ServerValue.md │ │ └── database.md ├── faqs.md ├── firestore │ ├── android.md │ ├── ios.md │ ├── reference │ │ ├── Blob.md │ │ ├── CollectionReference.md │ │ ├── DocumentChange.md │ │ ├── DocumentReference.md │ │ ├── DocumentSnapshot.md │ │ ├── FieldPath.md │ │ ├── FieldValue.md │ │ ├── FirestoreError.md │ │ ├── GeoPoint.md │ │ ├── MetadataChanges.md │ │ ├── Query.md │ │ ├── QuerySnapshot.md │ │ ├── SetOptions.md │ │ ├── Settings.md │ │ ├── SnapshotError.md │ │ ├── SnapshotMetadata.md │ │ ├── Transaction.md │ │ ├── WriteBatch.md │ │ └── firestore.md │ └── transactions.md ├── functions │ ├── android.md │ ├── ios.md │ └── reference │ │ ├── HttpsError.md │ │ └── functions.md ├── getting-started.md ├── iid │ ├── android.md │ ├── ios.md │ └── reference │ │ └── iid.md ├── installation │ ├── android.md │ ├── basic-kit.md │ ├── initial-setup.md │ ├── ios.md │ ├── javascript.md │ └── migration-guide.md ├── invites │ ├── android.md │ ├── ios.md │ └── reference │ │ ├── AndroidInvitation.md │ │ ├── Invitation.md │ │ ├── InvitationOpen.md │ │ └── Invites.md ├── links │ ├── android.md │ ├── ios.md │ └── reference │ │ ├── AnalyticsParameters.md │ │ ├── AndroidParameters.md │ │ ├── DynamicLink.md │ │ ├── IOSParameters.md │ │ ├── ITunesParameters.md │ │ ├── NavigationParameters.md │ │ ├── SocialParameters.md │ │ └── links.md ├── messaging │ ├── android.md │ ├── device-token.md │ ├── introduction.md │ ├── ios.md │ ├── receiving-messages.md │ ├── reference │ │ ├── IOSMessaging.md │ │ ├── Messaging.md │ │ └── RemoteMessage.md │ ├── topics.md │ └── upstream-messages.md ├── notifications │ ├── android-actions.md │ ├── android-channels.md │ ├── android.md │ ├── displaying-notifications.md │ ├── introduction.md │ ├── ios.md │ ├── receiving-notifications.md │ ├── reference │ │ ├── AndroidAction.md │ │ ├── AndroidBadgeIconType.md │ │ ├── AndroidCategory.md │ │ ├── AndroidChannel.md │ │ ├── AndroidChannelGroup.md │ │ ├── AndroidDefaults.md │ │ ├── AndroidGroupAlert.md │ │ ├── AndroidImportance.md │ │ ├── AndroidLights.md │ │ ├── AndroidNotification.md │ │ ├── AndroidNotifications.md │ │ ├── AndroidPriority.md │ │ ├── AndroidProgress.md │ │ ├── AndroidRemoteInput.md │ │ ├── AndroidSemanticAction.md │ │ ├── AndroidVisibility.md │ │ ├── IOSAttachment.md │ │ ├── IOSAttachmentOptions.md │ │ ├── IOSNotification.md │ │ ├── IOSNotifications.md │ │ ├── Notification.md │ │ ├── NotificationOpen.md │ │ ├── Notifications.md │ │ └── Schedule.md │ └── scheduling-notifications.md ├── perf-mon │ ├── android.md │ ├── example.md │ ├── ios.md │ └── reference │ │ ├── HttpMetric.md │ │ ├── Trace.md │ │ └── perf-mon.md ├── reference.md ├── release-notes.md ├── releases │ ├── v5.0.0.md │ ├── v5.1.0.md │ ├── v5.1.1.md │ └── v5.2.0.md ├── storage │ ├── android.md │ ├── ios.md │ └── reference │ │ ├── Reference.md │ │ ├── StorageTask.md │ │ └── storage.md ├── testing.md └── troubleshooting │ ├── android.md │ └── ios.md └── ios-logo.png /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache-2.0 License: 2 | ------------------ 3 | 4 | Copyright (c) 2016-present Invertase Limited 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this library except in compliance with the License. 8 | 9 | You may obtain a copy of the Apache-2.0 License at 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, software 14 | distributed under the License is distributed on an "AS IS" BASIS, 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | See the License for the specific language governing permissions and 17 | limitations under the License. 18 | 19 | 20 | Creative Commons Attribution 3.0 License 21 | ---------------------------------------- 22 | 23 | Copyright (c) 2016-present Invertase Limited 24 | 25 | Documentation and other instructional materials provided for this project 26 | (including on a separate documentation repository or it's documentation website) are 27 | licensed under the Creative Commons Attribution 3.0 License. Code samples/blocks 28 | contained therein are licensed under the Apache License, Version 2.0 (the "License"), as above. 29 | 30 | You may obtain a copy of the Creative Commons Attribution 3.0 License at 31 | 32 | https://creativecommons.org/licenses/by/3.0/ 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | Do not use this repository, it is for the obsolete / unsupported version 5 of react-native-firebase. 3 | 4 | React Native Firebase docs are now contained directly in the react-native-firebase repository, and you may easily edit any documentation page by using the edit button at the top right of every page on rnfirebase.io 5 | 6 | Thanks! 7 | -------------------------------------------------------------------------------- /android-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/invertase/react-native-firebase-docs/cb0330930f057f2c2aaef1dddd72d98fc7a33e70/android-logo.png -------------------------------------------------------------------------------- /docs/_config.yaml: -------------------------------------------------------------------------------- 1 | android: 2 | build: 3 | tools: 3.2.0 4 | fabric: 5 | tools: 1.25.4 6 | version: 2.9.5 7 | firebase: 8 | version: 16.0.6 9 | ads: 15.0.1 10 | analytics: 16.0.6 # part of core ?? 11 | auth: 16.1.0 12 | config: 16.1.2 13 | core: 16.0.6 14 | crashlytics: 2.9.5 15 | database: 16.0.5 16 | firestore: 17.1.5 17 | functions: 16.1.3 18 | invites: 16.0.6 19 | messaging: 17.3.4 20 | perf: 16.2.3 21 | storage: 16.0.5 22 | plugins: 1.1.5 23 | gms: 24 | google-services: 4.0.1 25 | play-services-base: 16.0.1 26 | ios: 27 | fabric: 28 | tools: 1.7.13 29 | version: 3.10.9 30 | firebase: 31 | ads: 5.15.0 32 | auth: 5.15.0 33 | config: 5.15.0 34 | core: 5.15.0 35 | crash: 5.15.0 36 | crashlytics: 3.10.7 37 | database: 5.15.0 38 | firestore: 5.15.0 39 | functions: 5.15.0 40 | invites: 5.15.0 41 | links: 5.15.0 42 | messaging: 5.15.0 43 | perf: 5.15.0 44 | storage: 5.15.0 45 | -------------------------------------------------------------------------------- /docs/_search.yaml: -------------------------------------------------------------------------------- 1 | - module: crash 2 | methods: 3 | - setCrashCollectionEnabled 4 | - isCrashCollectionEnabled 5 | - log 6 | - logcat 7 | - report 8 | 9 | - module: perf 10 | methods: 11 | - setPerformanceCollectionEnabled 12 | - newTrace 13 | classes: 14 | Trace: 15 | - start 16 | - incrementCounter 17 | - stop 18 | -------------------------------------------------------------------------------- /docs/about.md: -------------------------------------------------------------------------------- 1 | # About React Native Firebase 2 | 3 | The React Native Firebase project started life in late 2016 as a personal project [Mike Diarmid](https://twitter.com/mikediarmid) and [Elliot Hesp](https://twitter.com/elliothesp) were working on. The project gained instant popularity, allowing React Native developers to hook into the native services Firebase provides. 4 | 5 | During the first few months of its development, the repository was moved into the organisation of Invertase on Github. The organisation was a collection of the personal and combined Open Source efforts Mike and Elliot had been working over the past number of years. With a constant flow of feature requests, issues and contributions, the library rapidly grew in popularity, achieving over 100k NPM downloads in its first 12 months of development. 6 | 7 | In mid-2017, we were approached by Google, who offered to help ensure the projects continued support by providing direct contact with the Firebase team and by providing funding to ensure the project had dedicated time assigned to its upkeep. 8 | 9 | In the 2018 Firebase Summit in Prague during the opening keynote, Google openly announced their working relationship with Invertase - check it out below: 10 | 11 | > https://twitter.com/rnfirebase/status/1056839638961348608/video/1 12 | 13 | ## Future of React Native Firebase 14 | 15 | The React Native Firebase library has been a huge driving force for our knowledge and experience. Even with years of experience in Open Source, JavaScript, Android and iOS, we're constantly learning and improving the library - whilst focusing on the needs of the community and many users of the library. Maintaining a popular Open Source library is hard, yet rewarding work. 16 | 17 | With the support from the community and Google, we're pleased to announce that starting in 2019, our very own Mike Diarmid will be working full time on the library. With the lessons we've learnt, we'll be focusing on taking the library to a new level. 18 | 19 | > Keep an eye out for our upcoming blog on version 6! 20 | 21 | The success and upkeep of the library wouldn't be possible without the support and contributions from the community. To date, we've had contributions from 114 members of the Open Source community on the repository to who we're very grateful to, the project wouldn't be where it is without you. Special thanks to Chris Bianca at [CS Frequency Limited](http://invertase.link/csf-website) for their work in helping to get this project off the ground. 22 | 23 | We'd also like to extend our thanks to our backers on [Open Collective](https://opencollective.com/react-native-firebase), whose contributions have made it possible to sustain the vast amount of time required in the upkeep of such a project. 24 | 25 | The future of Invertase and React Native Firebase is exciting. We're excited to see worldwide apps using our library, and with Expo now [integrating our library](https://blog.expo.io/using-firebase-in-expo-e13844061832) into their core service, 2019 is full of possibilities. 26 | -------------------------------------------------------------------------------- /docs/admob/android.md: -------------------------------------------------------------------------------- 1 | # Android Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup). 4 | 5 | ## Add the dependency 6 | 7 | Add the Firebase Admob dependancy to `android/app/build.gradle`: 8 | 9 | ```groovy 10 | dependencies { 11 | // ... 12 | implementation "com.google.firebase:firebase-ads:{{ android.firebase.ads }}" 13 | } 14 | ``` 15 | 16 | ## Install the RNFirebase Admob package 17 | 18 | Add the `RNFirebaseAdMobPackage` to your `android/app/src/main/java/com/[app name]/MainApplication.java`: 19 | 20 | ```java 21 | // ... 22 | import io.invertase.firebase.RNFirebasePackage; 23 | import io.invertase.firebase.admob.RNFirebaseAdMobPackage; // <-- Add this line 24 | 25 | public class MainApplication extends Application implements ReactApplication { 26 | // ... 27 | 28 | @Override 29 | protected List getPackages() { 30 | return Arrays.asList( 31 | new MainReactPackage(), 32 | new RNFirebasePackage(), 33 | new RNFirebaseAdMobPackage() // <-- Add this line 34 | ); 35 | } 36 | }; 37 | // ... 38 | } 39 | ``` 40 | -------------------------------------------------------------------------------- /docs/admob/error-handling.md: -------------------------------------------------------------------------------- 1 | # Error Handling 2 | 3 | Errors returned from Admob are always returned as a JavaScript [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) containing a code and message. 4 | 5 | | code | message | 6 | | --------------------------------- | ------------------------------------------------------------------------------------------------------------ | 7 | | admob/error-code-internal-error | Something happened internally; for instance, an invalid response was received from the ad server. | 8 | | admob/error-code-invalid-request | The ad request was invalid; for instance, the ad unit ID was incorrect. | 9 | | admob/error-code-network-error | The ad request was unsuccessful due to network connectivity. | 10 | | admob/error-code-no-fill | The ad request was successful, but no ad was returned due to lack of ad inventory. | 11 | | admob/os-version-too-low | The current device’s OS is below the minimum required version. | 12 | -------------------------------------------------------------------------------- /docs/admob/ios.md: -------------------------------------------------------------------------------- 1 | # iOS Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup). 4 | 5 | ## Add the pod 6 | 7 | Add the following to your `Podfile`: 8 | 9 | ```ruby 10 | pod 'Firebase/AdMob', '~> {{ ios.firebase.ads }}' 11 | ``` 12 | 13 | Run `pod update`. 14 | -------------------------------------------------------------------------------- /docs/admob/reference/AdRequest.md: -------------------------------------------------------------------------------- 1 | # AdRequest 2 | 3 | ``` 4 | firebase.admob.AdRequest 5 | ``` 6 | 7 | The AdRequest class is used to create an object to be passed to each advert request. The request is handled on AdMob, and returns adverts tailored to the request options provided. 8 | 9 | If no AdRequest is sent, the default request calls addTestDevice. Therefore, ensure a custom AdRequest object is passed through in production. 10 | 11 | ## Methods 12 | 13 | ### build 14 | [method]build() returns object;[/method] 15 | 16 | Builds the current ad request for AdMob to handle. 17 | 18 | ### addTestDevice 19 | [method]addTestDevice(device) returns [ref admob.AdRequest];[/method] 20 | 21 | Sets a device ID as a test device. If no device string is passed, a default emulator id is passed. 22 | 23 | | Parameter | | 24 | | --------- | ------- | 25 | | device | **string** (optional)
Device ID.
If null, a default emulator id is passed. | 26 | 27 | ### addKeyword 28 | [method]addKeyword(keyword) returns [ref admob.AdRequest];[/method] 29 | 30 | Add a new keyword to relate the advert to. 31 | 32 | | Parameter | | 33 | | --------- | ------- | 34 | | keyword | **string** | 35 | 36 | ### setGender 37 | [method]setGender(gender) returns [ref admob.AdRequest];[/method] 38 | 39 | Sets the user's gender for targeting purposes. 40 | 41 | | Parameter | | 42 | | --------- | ------- | 43 | | gender | **string**
One of `male`, `female`, `unknown` | 44 | 45 | ### setRequestAgent 46 | [method]setRequestAgent(requestAgent) returns [ref admob.AdRequest];[/method] 47 | 48 | Sets the request agent string to identify the ad request's origin. Third party libraries that reference the Mobile Ads SDK should call this method to denote the platform from which the ad request originated. For example, if a third party ad network called "CoolAds network" mediates requests to the Mobile Ads SDK, it should call this method with "CoolAds" 49 | 50 | | Parameter | | 51 | | --------- | ------- | 52 | | requestAgent | **string** | 53 | 54 | ### setContentUrl 55 | [method]setContentUrl(url) returns [ref admob.AdRequest];[/method] 56 | 57 | Sets the content URL for targeting purposes. 58 | 59 | | Parameter | | 60 | | --------- | ------- | 61 | | url | **string** | 62 | 63 | ### tagForChildDirectedTreatment 64 | [method]tagForChildDirectedTreatment(forChildren) returns [ref admob.AdRequest];[/method] 65 | 66 | Sets whether the request will be shown to children. 67 | 68 | | Parameter | | 69 | | --------- | ------- | 70 | | forChildren | **boolean** | 71 | 72 | ## Unsupported Methods 73 | 74 | ### setBirthday 75 | 76 | ### setLocation 77 | 78 | ### setIsDesignedForFamilies 79 | -------------------------------------------------------------------------------- /docs/admob/reference/Banner.md: -------------------------------------------------------------------------------- 1 | # Banner 2 | 3 | ``` 4 | firebase.admob.Banner 5 | ``` 6 | 7 | AdMob Banners in RNFirebase are exported as a usable React component, allowing you to integrate it easily into your existing app. 8 | 9 | ## Props 10 | 11 | ### unitId (required) 12 | 13 | Your AdMob banner unit ID 14 | 15 | | Type | Default | 16 | | --------- | ------- | 17 | | **string** | | 18 | 19 | ### size 20 | 21 | Requests and shows the banner at a certain size. 22 | 23 | | Type | Default | 24 | | --------- | ------- | 25 | | [Size](version /admob/sizes) | SMART_BANNER | 26 | 27 | ### request 28 | 29 | An instance of [ref admob.AdRequest#build] to load with the Banner. 30 | 31 | | Type | Default | 32 | | --------- | ------- | 33 | | [ref admob.AdRequest#build] | `new AdRequest().addTestDevice().build()` | 34 | 35 | ### onAdLoaded 36 | 37 | Called when an ad is received/loaded. 38 | 39 | | Type | Default | 40 | | --------- | ------- | 41 | | function | | 42 | 43 | ### onAdOpened 44 | 45 | Called when an ad opens an overlay that covers the screen. 46 | 47 | | Type | Default | 48 | | --------- | ------- | 49 | | **function** | | 50 | 51 | ### onAdLeftApplication 52 | 53 | Called when an ad leaves the application (e.g. to go to the browser). 54 | 55 | | Type | Default | 56 | | --------- | ------- | 57 | | function | | 58 | 59 | ### onAdClosed 60 | 61 | Called when the user is about to return to the application after clicking on an ad. 62 | 63 | | Type | Default | 64 | | --------- | ------- | 65 | | function | | 66 | 67 | ### onAdFailedToLoad 68 | 69 | Called when an ad request failed. See [Error Handling](version /admob/error-handling). 70 | 71 | | Type | Default | 72 | | --------- | ------- | 73 | | function | | 74 | 75 | ## Additional Props 76 | 77 | Any additional props passed through to the component must be [ViewPropTypes](https://facebook.github.io/react-native/docs/viewproptypes.html). 78 | 79 | A common request is how to handle custom touch events of the Banner. We recommend wrapping the Banner component another component, such as a [`TouchableWithoutFeedback`](https://facebook.github.io/react-native/docs/touchablewithoutfeedback.html). 80 | 81 | ```js 82 | ... 83 | render() { 84 | return ( 85 | this.onBannerPress()} 87 | > 88 | 89 | 90 | ); 91 | } 92 | ``` 93 | 94 | ## Example 95 | 96 | ```js 97 | const Banner = firebase.admob.Banner; 98 | const AdRequest = firebase.admob.AdRequest; 99 | const request = new AdRequest(); 100 | request.addKeyword('foobar'); 101 | 102 | ... 103 | render() { 104 | return ( 105 | { 109 | console.log('Advert loaded'); 110 | }} 111 | /> 112 | ); 113 | } 114 | ``` 115 | -------------------------------------------------------------------------------- /docs/admob/reference/Interstitial.md: -------------------------------------------------------------------------------- 1 | # Interstitial 2 | 3 | ``` 4 | firebase.admob.interstitial 5 | ``` 6 | 7 | An interstitial is a full screen advert which creates a new activity on top of React. As they need to be controlled, allowing the developer to choose when to display them they're not available as a component. Instead they're controlled via method calls. A single interstitial instance can only be shown once. If you want to display another, create a new one. 8 | 9 | ## Methods 10 | 11 | ### loadAd 12 | [method]loadAd(request) returns void;[/method] 13 | 14 | Starting loading an interstial from the Firebase servers with a given [ref admob.AdRequest#build] payload. 15 | 16 | | Parameter | | 17 | | --------- | ------- | 18 | | request | **[ref admob.AdRequest#build]**
An AdRequest.build object | 19 | 20 | ### on 21 | [method]on(event, callback) returns void;[/method] 22 | 23 | Listens for advert events. See [EventTypes](version /admob/reference#eventtypes) for more information. 24 | 25 | | Parameter | | 26 | | --------- | ------- | 27 | | event | **[ref admob#EventTypes]**
A single event type | 28 | | callback | **function** | 29 | 30 | ### isLoaded 31 | [method]isLoaded() returns boolean;[/method] 32 | 33 | Returns whether the current requested advert has loaded from the Firebase servers. 34 | 35 | ### show 36 | [method]show() returns void;[/method] 37 | 38 | Shows the loaded advert on the device. 39 | 40 | ## Example 41 | 42 | ```javascript 43 | const advert = firebase.admob().interstitial('ca-app-pub-3940256099942544/1033173712'); 44 | 45 | const AdRequest = firebase.admob.AdRequest; 46 | const request = new AdRequest(); 47 | request.addKeyword('foo').addKeyword('bar'); 48 | 49 | // Load the advert with our AdRequest 50 | advert.loadAd(request.build()); 51 | 52 | advert.on('onAdLoaded', () => { 53 | console.log('Advert ready to show.'); 54 | }); 55 | 56 | // Simulate the interstitial being shown "sometime" later during the apps lifecycle 57 | setTimeout(() => { 58 | if (advert.isLoaded()) { 59 | advert.show(); 60 | } else { 61 | // Unable to show interstitial - not loaded yet. 62 | } 63 | }, 1000); 64 | ``` 65 | -------------------------------------------------------------------------------- /docs/admob/reference/RewardedVideo.md: -------------------------------------------------------------------------------- 1 | # Rewarded Video 2 | 3 | ``` 4 | firebase.admob.rewarded 5 | ``` 6 | 7 | A rewarded video allows you to display a video to a user, whereby they're able to watch it to gain "rewards", or skip it 8 | and receive nothing. For example, when a user completes a level on your gaming app, show them a video which will give them in-game 9 | credit. 10 | 11 | A single rewarded video instance can only be shown once. If you want to display another, create a new one. 12 | 13 | > It's recommended you begin loading the video as soon as possible. 14 | 15 | ## Methods 16 | 17 | ### loadAd 18 | [method]loadAd(request) returns void;[/method] 19 | 20 | Starting loading an interstial from the Firebase servers with a given [ref admob.AdRequest#build] payload. 21 | 22 | | Parameter | | 23 | | --------- | ------- | 24 | | request | **[ref admob.AdRequest#build]**
An AdRequest.build object | 25 | 26 | ### on 27 | [method]on(event, callback) returns void;[/method] 28 | 29 | Listens for advert events. See [EventTypes](version /admob/reference#eventtypes) for more information. 30 | 31 | | Parameter | | 32 | | --------- | ------- | 33 | | event | **[ref admob#EventTypes]** or **[ref admob#RewardedVideoEventTypes]**
A single event type | 34 | | callback | **function** | 35 | 36 | ### isLoaded 37 | [method]isLoaded() returns boolean;[/method] 38 | 39 | Returns whether the current requested advert has loaded from the Firebase servers. 40 | 41 | ### show 42 | [method]show() returns void;[/method] 43 | 44 | Shows the loaded advert on the device. 45 | 46 | ## Example 47 | 48 | ```js 49 | const advert = firebase.admob().rewarded('ca-app-pub-3940256099942544/1033173712'); 50 | 51 | const AdRequest = firebase.admob.AdRequest; 52 | const request = new AdRequest(); 53 | request.addKeyword('foo').addKeyword('bar'); 54 | 55 | // Load the advert with our AdRequest 56 | advert.loadAd(request.build()); 57 | 58 | advert.on('onAdLoaded', () => { 59 | console.log('Advert ready to show.'); 60 | }); 61 | 62 | advert.on('onRewarded', (event) => { 63 | console.log('The user watched the entire video and will now be rewarded!', event); 64 | }); 65 | 66 | ... 67 | 68 | onLevelComplete() 69 | .then(() => { 70 | if (advert.isLoaded()) { 71 | advert.show(); 72 | } else { 73 | // skip... 74 | } 75 | }); 76 | ``` 77 | -------------------------------------------------------------------------------- /docs/admob/reference/VideoOptions.md: -------------------------------------------------------------------------------- 1 | # Video Options 2 | 3 | ``` 4 | firebase.admob.VideoOptions 5 | ``` 6 | 7 | The VideoOptions class is used to create an object to be passed through to each advert request. If the advert returns a video, the options are used when displaying it on the application. 8 | 9 | ?> Currently `NativeExpress` only accepts VideoOptions. If no VideoOptions are sent, the default options call `setStartMuted(true)`. 10 | 11 | ## Methods 12 | 13 | ### build 14 | [method]build() returns object;[/method] 15 | 16 | Builds the current video options for AdMob to handle. 17 | 18 | ### setStartMuted 19 | [method]setStartMuted(muted) returns this;[/method] 20 | 21 | If true, any returned video will not play sound when it starts. The end user can manually enable sound on the advert interface. 22 | 23 | | Parameter | | 24 | | --------- | ------- | 25 | | muted | **boolean** | 26 | 27 | ## Example 28 | 29 | ```js 30 | const options = new firebase.admob.VideoOptions(); 31 | options.setStartMuted(false); 32 | ... 33 | 34 | Ad unitId | 35 | 36 | ### rewarded 37 | [method]rewarded(unitId) returns [ref admob.RewardedVideo];[/method] 38 | 39 | Returns a new [ref admob.RewardedVideo] to be loaded with a given unitId. 40 | 41 | | Parameter | | 42 | | --------- | ------- | 43 | | unitId | **string**
Ad unitId | 44 | 45 | ## Statics 46 | 47 | ### Banner 48 | [method]Banner returns [ref admob.Banner];[/method] 49 | 50 | Returns a [ref admob.Banner] component. 51 | 52 | ### NativeExpress 53 | [method]NativeExpress returns [ref admob.NativeExpress];[/method] 54 | 55 | Returns a [ref admob.NativeExpress] component. 56 | 57 | ### AdRequest 58 | [method]AdRequest returns [ref admob.AdRequest];[/method] 59 | 60 | Returns a [ref admob.AdRequest] class. 61 | 62 | ### VideoOptions 63 | [method]VideoOptions returns [ref admob.VideoOptions];[/method] 64 | 65 | Returns a [ref admob.VideoOptions] class. 66 | 67 | ## Types 68 | 69 | ### EventTypes 70 | [method]VideoOptions returns [EventTypes](https://github.com/invertase/react-native-firebase/blob/master/src/modules/admob/EventTypes.js#L2);[/method] 71 | 72 | Returns an `Object` containing Admob event types. 73 | 74 | ### RewardedVideoEventTypes 75 | [method]RewardedVideoEventTypes returns [RewardedVideoEventTypes](https://github.com/invertase/react-native-firebase/blob/master/src/modules/admob/EventTypes.js#L10);[/method] 76 | 77 | Returns an `Object` containing [RewardedVideo](#rewarded) event types. 78 | 79 | ### NativeExpressEventTypes 80 | [method]NativeExpressEventTypes returns [NativeExpressEventTypes](https://github.com/invertase/react-native-firebase/blob/master/src/modules/admob/EventTypes.js#L18);[/method] 81 | 82 | Returns an `Object` containing [NativeExpress](#NativeExpress) event types. 83 | -------------------------------------------------------------------------------- /docs/admob/sizes.md: -------------------------------------------------------------------------------- 1 | # Sizes 2 | 3 | Sets the size of an Advert. Can be one of the following or a custom size: 4 | 5 | | Size | Description | 6 | | ----------------- | ------------------------------------------------------------------------------------------------------ | 7 | | BANNER | Mobile Marketing Association (MMA) banner ad size (320x50 density-independent pixels). | 8 | | FULL_BANNER | Interactive Advertising Bureau (IAB) full banner ad size (468x60 density-independent pixels). | 9 | | LARGE_BANNER | Large banner ad size (320x100 density-independent pixels). | 10 | | LEADERBOARD | Interactive Advertising Bureau (IAB) leaderboard ad size (728x90 density-independent pixels). | 11 | | MEDIUM_RECTANGLE | Interactive Advertising Bureau (IAB) medium rectangle ad size (300x250 density-independent pixels). | 12 | | SMART_BANNER | A dynamically sized banner that is full-width and auto-height. | 13 | 14 | To specify a custom size, pass a string with the width and height split by an "x" (follows the Regex pattern `([0-9]+)x([0-9]+)`), e.g 320x150 15 | 16 | !> Requesting an advert with a size which does not exist on the AdMob servers will return `admob/error-code-internal-error`. 17 | -------------------------------------------------------------------------------- /docs/analytics/android.md: -------------------------------------------------------------------------------- 1 | # Android Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup). 4 | 5 | Analytics does not require any other dependencies to work. 6 | 7 | ## Install the RNFirebase Analytics package 8 | 9 | Add the `RNFirebaseAnalyticsPackage` to your `android/app/src/main/java/com/[app name]/MainApplication.java`: 10 | 11 | ```java 12 | // ... 13 | import io.invertase.firebase.RNFirebasePackage; 14 | import io.invertase.firebase.analytics.RNFirebaseAnalyticsPackage; // <-- Add this line 15 | 16 | public class MainApplication extends Application implements ReactApplication { 17 | // ... 18 | 19 | @Override 20 | protected List getPackages() { 21 | return Arrays.asList( 22 | new MainReactPackage(), 23 | new RNFirebasePackage(), 24 | new RNFirebaseAnalyticsPackage() // <-- Add this line 25 | ); 26 | } 27 | }; 28 | // ... 29 | } 30 | ``` 31 | -------------------------------------------------------------------------------- /docs/analytics/ios.md: -------------------------------------------------------------------------------- 1 | # iOS Installation 2 | 3 | Ensure you have followed the [initial setup guide](version /installation/initial-setup). 4 | 5 | That is it, Analytics doesn't need anything else to work. 6 | -------------------------------------------------------------------------------- /docs/analytics/reference/analytics.md: -------------------------------------------------------------------------------- 1 | # Analytics 2 | 3 | ``` 4 | firebase.analytics 5 | ``` 6 | 7 | ## Methods 8 | 9 | The following methods are accessed via the Analytics instance `firebase.analytics()`. 10 | 11 | ### logEvent 12 | [method]logEvent(event, params) returns void;[/method] 13 | 14 | Log a custom event with optional params. 15 | 16 | Note: up to 40 characters is the maximum character length supported for event parameter names, and up to 100 characters is the maximum character length supported for event parameter values. 17 | 18 | See [Collection and configuration limits](https://support.google.com/firebase/answer/9237506?hl=en) in Firebase Help for additional information. 19 | 20 | | Parameter | | 21 | | --------- | ------- | 22 | | event | **string** | 23 | | params | **object** | 24 | 25 | ### setAnalyticsCollectionEnabled 26 | [method]setAnalyticsCollectionEnabled(enabled) returns void;[/method] 27 | 28 | If true, allows the device to collect analytical data and send it to Firebase. 29 | 30 | | Parameter | | 31 | | --------- | ------- | 32 | | enabled | **boolean** | 33 | 34 | ### setCurrentScreen 35 | [method]setCurrentScreen(screenName, screenClassOverride) returns void;[/method] 36 | 37 | Sets the current screen name. 38 | 39 | ?> Whilst `screenClassOverride` is optional, it is recommended it is always sent as your current class name, for example on Android it will always show as 'MainActivity' if not specified. 40 | 41 | | Parameter | | 42 | | --------- | ------- | 43 | | screenName | **string** | 44 | | screenClassOverride | **string** (optional) | 45 | 46 | ### setMinimumSessionDuration 47 | [method]setMinimumSessionDuration(miliseconds) returns void;[/method] 48 | 49 | Sets the minimum engagement time required before starting a session. The default value is 10000 (10 seconds). 50 | 51 | | Parameter | | 52 | | --------- | ------- | 53 | | miliseconds | **number** | 54 | 55 | ### setSessionTimeoutDuration 56 | [method]setSessionTimeoutDuration(miliseconds) returns void;[/method] 57 | 58 | Sets the duration of inactivity that terminates the current session. The default value is 1800000 (30 minutes). 59 | 60 | | Parameter | | 61 | | --------- | ------- | 62 | | miliseconds | **number** | 63 | 64 | ### setUserId 65 | [method]setUserId(id) returns void;[/method] 66 | 67 | Gives a user a unique identification. 68 | 69 | | Parameter | | 70 | | --------- | ------- | 71 | | id | **string** | 72 | 73 | ### setUserProperty 74 | [method]setUserProperty(name, value) returns void;[/method] 75 | 76 | Sets a key/value pair of data on the current user. 77 | 78 | | Parameter | | 79 | | --------- | ------- | 80 | | name | **string** | 81 | | value | **string** | 82 | 83 | ### setUserProperties 84 | [method]setUserProperties(fieldMapping) returns void;[/method] 85 | 86 | Sets mutiple key/value pair of data on the current user. 87 | Param object's keys are property value and values are values. 88 | 89 | 90 | | Parameter | | 91 | | --------- | ------- | 92 | | fieldMapping | **object** | 93 | -------------------------------------------------------------------------------- /docs/analytics/reserved-events.md: -------------------------------------------------------------------------------- 1 | # Reserved Events 2 | 3 | A number of methods are provided to help tailor analytics specifically for your own app, however the Firebase SDK includes a number of pre-set events which are automatically handled and cannot be used with custom [logEvent](version /analytics/reference/analytics#logevent) events. 4 | 5 | !> Attempting to use one of these events will throw an exception. 6 | 7 | ```javascript 8 | const reserved = [ 9 | 'app_clear_data', 10 | 'app_uninstall', 11 | 'app_update', 12 | 'error', 13 | 'first_open', 14 | 'first_visit', 15 | 'first_open_time', 16 | 'first_visit_time', 17 | 'in_app_purchase', 18 | 'notification_dismiss', 19 | 'notification_foreground', 20 | 'notification_open', 21 | 'notification_receive', 22 | 'os_update', 23 | 'session_start', 24 | 'screen_view', 25 | 'user_engagement', 26 | 'ad_impression', 27 | 'ad_click', 28 | 'ad_query', 29 | 'ad_exposure', 30 | 'adunit_exposure', 31 | 'ad_activeiew', 32 | ]; 33 | ``` 34 | -------------------------------------------------------------------------------- /docs/auth/android.md: -------------------------------------------------------------------------------- 1 | # Android Installation 2 | 3 | ## Add the dependency 4 | 5 | Add the Firebase Authentication dependency to `android/app/build.gradle`: 6 | 7 | ```groovy 8 | dependencies { 9 | // ... 10 | implementation "com.google.firebase:firebase-auth:{{ android.firebase.auth }}" 11 | } 12 | ``` 13 | 14 | ?> If you plan to make use of Email sign-in links then you'll also need to follow the [Dynamic Links for Android installation guide](version /links/android). 15 | 16 | ## Install the RNFirebase Authentication package 17 | 18 | Add the `RNFirebaseAuthPackage` to your `android/app/src/main/java/com/[app name]/MainApplication.java`: 19 | 20 | ```java 21 | // ... 22 | import io.invertase.firebase.RNFirebasePackage; 23 | import io.invertase.firebase.auth.RNFirebaseAuthPackage; // <-- Add this line 24 | 25 | public class MainApplication extends Application implements ReactApplication { 26 | // ... 27 | 28 | @Override 29 | protected List getPackages() { 30 | return Arrays.asList( 31 | new MainReactPackage(), 32 | new RNFirebasePackage(), 33 | new RNFirebaseAuthPackage() // <-- Add this line 34 | ); 35 | } 36 | }; 37 | // ... 38 | } 39 | ``` 40 | -------------------------------------------------------------------------------- /docs/auth/ios.md: -------------------------------------------------------------------------------- 1 | # iOS Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup). 4 | 5 | ## Add the pod 6 | 7 | Add the following to your `Podfile`: 8 | 9 | ```ruby 10 | pod 'Firebase/Auth', '~> {{ ios.firebase.auth }}' 11 | ``` 12 | 13 | Run `pod update`. 14 | 15 | ## Optional: authenticate with phone number 16 | 17 | ### Enable Phone Number sign-in for your Firebase project 18 | 19 | To sign in users by SMS, you must first enable the Phone Number sign-in method for your Firebase project: 20 | 21 | - In the Firebase console, open the `Authentication` section. 22 | - On the `Sign-in` Method page, enable the `Phone Number` sign-in method. 23 | 24 | More details: [Firebase-phone-auth](https://firebase.google.com/docs/auth/ios/phone-auth) 25 | 26 | ### Enable app verification 27 | 28 | Phone authentication leaves you 2 choices: 29 | - Silent APNs notifications 30 | - reCAPTCHA verification 31 | 32 | Please read carefully and follow Firebase related documentation to complete this step [Firebase-phone-auth](https://firebase.google.com/docs/auth/ios/phone-auth) otherwise app verification will throw an error. 33 | 34 | ?> If you plan to make use of email sign-in links then you'll also need to follow the [Dynamic Links for iOS installation guide](version /links/ios). 35 | -------------------------------------------------------------------------------- /docs/auth/reference/ActionCodeInfo.md: -------------------------------------------------------------------------------- 1 | # ActionCodeInfo 2 | 3 | A response from [ref auth#checkActionCode]. 4 | 5 | ## Properties 6 | 7 | ### data 8 | [method]data returns Object;[/method] 9 | 10 | The data associated with the action code. 11 | 12 | For the `PASSWORD_RESET`, `EMAIL_SIGNIN`, `VERIFY_EMAIL`, and `RECOVER_EMAIL` actions, this object contains an `email` field with the address the email was sent to. 13 | 14 | For the `RECOVER_EMAIL` action, which allows a user to undo an email address change, this object also contains a `fromEmail` field with the user account's new email address. After the action completes, the user's email address will revert to the value in the `email` field from the value in `fromEmail` field. 15 | 16 | ```js 17 | { 18 | email: string, 19 | fromEmail: string, 20 | } 21 | ``` 22 | 23 | ### operation 24 | [method]operation returns string;[/method] 25 | 26 | The type of operation that generated the action code. This could be: 27 | 28 | - `PASSWORD_RESET`: password reset code generated via [ref auth.Auth#sendPasswordResetEmail]. 29 | - `VERIFY_EMAIL`: email verification code generated via [ref auth.User#sendEmailVerification]. 30 | - `RECOVER_EMAIL`: email change revocation code generated via [ref auth.User#updateEmail]. 31 | - `EMAIL_SIGNIN`: email sign-in code generated via [ref auth.Auth#sendSignInLinkToEmail]. 32 | -------------------------------------------------------------------------------- /docs/auth/reference/ActionCodeSettings.md: -------------------------------------------------------------------------------- 1 | # ActionCodeSettings 2 | 3 | This is the interface that defines the required continue/state URL with optional Android and iOS bundle identifiers. The action code setting fields are: 4 | 5 | - `url`: Sets the link continue/state URL, which has different meanings in different contexts: 6 | -- When the link is handled in the web action widgets, this is the deep link in the continueUrl query parameter. 7 | -- When the link is handled in the app directly, this is the continueUrl query parameter in the deep link of the Dynamic Link. 8 | - `iOS`: Sets the iOS bundle ID. This will try to open the link in an iOS app if it is installed. 9 | - `android`: Sets the Android package name. This will try to open the link in an android app if it is installed. If installApp is passed, it specifies whether to install the Android app if the device supports it and the app is not already installed. If this field is provided without a packageName, an error is thrown explaining that the packageName must be provided in conjunction with this field. If minimumVersion is specified, and an older version of the app is installed, the user is taken to the Play Store to upgrade the app. 10 | - `handleCodeInApp`: The default is false. When set to true, the action code link will be be sent as a Universal Link or Android App Link and will be opened by the app if installed. In the false case, the code will be sent to the web widget first and then on continue will redirect to the app if installed. 11 | 12 | ?> `handleCodeInApp` must always be `true` when being used for [ref auth.auth#fetchSignInMethodsForEmail] 13 | 14 | ## Structure 15 | 16 | ```js 17 | { 18 | android: ({ 19 | packageName: string, 20 | installApp: (boolean or undefined), 21 | minimumVersion: (string or undefined) 22 | } or undefined), 23 | handleCodeInApp: (boolean or undefined) 24 | iOS: ({ 25 | bundleId: string 26 | } or undefined), 27 | url: string, 28 | } 29 | ``` 30 | -------------------------------------------------------------------------------- /docs/auth/reference/AdditionalUserInfo.md: -------------------------------------------------------------------------------- 1 | # AdditionalUserInfo 2 | 3 | A structure containing additional user information from a federated identity provider. 4 | 5 | ## Properties 6 | 7 | ### isNewUser 8 | [method]isNewUser returns boolean;[/method] 9 | 10 | ### profile 11 | [method]profile returns nullable Object;[/method] 12 | 13 | ### providerId 14 | [method]providerId returns string;[/method] 15 | 16 | ### username 17 | [method]username returns nullable string or undefined;[/method] 18 | -------------------------------------------------------------------------------- /docs/auth/reference/AuthCredential.md: -------------------------------------------------------------------------------- 1 | # AuthCredential 2 | 3 | Interface that represents the credentials returned by an auth provider. Implementations specify the details about each auth provider's credential requirements. 4 | 5 | ## Properties 6 | 7 | ### providerId 8 | [method]providerId returns string;[/method] 9 | 10 | The authentication provider ID for the credential. For example, 'facebook.com', or 'google.com'. 11 | -------------------------------------------------------------------------------- /docs/auth/reference/AuthSettings.md: -------------------------------------------------------------------------------- 1 | # AuthSettings 2 | 3 | ```js 4 | firebase.auth().settings; 5 | ``` 6 | 7 | Interface representing an Auth instance's settings, currently used for enabling/disabling app verification for phone Auth testing. 8 | 9 | In order to use this feature, you will need to [whitelist your phone number](https://firebase.google.com/docs/auth/web/phone-auth#test-with-whitelisted-phone-numbers) via the Firebase Console. 10 | 11 | ?> These are for testing purposes, ensure you're not using them in the public release version of your app. 12 | 13 | An example use in e2e testing can be seen in our tests suite [here](https://github.com/invertase/react-native-firebase/blob/master/tests/e2e/auth/phone.e2e.js). 14 | 15 | ## Properties 16 | 17 | ### appVerificationDisabledForTesting 18 | [method]appVerificationDisabledForTesting returns boolean;[/method] 19 | 20 | > **iOS only** 21 | 22 | When set, this property disables app verification for the purpose of testing phone authentication. 23 | For this property to take effect, it needs to be set calling any phone auth methods. 24 | When this is disabled, a mock reCAPTCHA is rendered instead. This is useful for manual testing during development or for automated integration tests. 25 | 26 | The default value is false (app verification is enabled). 27 | 28 | ```js 29 | // example 30 | 31 | // disable verification 32 | firebase.auth().settings.appVerificationDisabledForTesting = true; 33 | // enable verification 34 | firebase.auth().settings.appVerificationDisabledForTesting = false; 35 | ``` 36 | 37 | ## Methods 38 | 39 | ### setAutoRetrievedSmsCodeForPhoneNumber 40 | [method]setAutoRetrievedSmsCodeForPhoneNumber(phoneNumber, smsCode) returns Promise;[/method] 41 | 42 | > **Android only** 43 | 44 | | Parameter | | 45 | | --------- | ------- | 46 | | phoneNumber | **string** | 47 | | smsCode | **string** | 48 | 49 | Once this has been called, every call to [ref auth.Auth#verifyPhoneNumber] or [ref auth.Auth#signInWithPhoneNumber] with the 50 | same phone number as the one that is configured here will automatically trigger verification (auto verify) without manual input of the code being required. 51 | 52 | 53 | > The phone number and SMS code here must have been configured in the Firebase Console (Authentication > Sign In Method > Phone). 54 | 55 | 56 | Calling this method a second time will overwrite the previously passed parameters. Only one number can be configured at a given time. 57 | 58 | 59 | Calling this method with either parameter set to null removes this functionality until valid parameters are passed. Verifying a phone number other than the one configured here will trigger normal behaviour. If the phone number is configured as a test phone number in the console, the regular testing flow occurs. Otherwise, normal phone number verification will take place. 60 | 61 | ```js 62 | // example 63 | await firebase 64 | .auth() 65 | .settings 66 | .setAutoRetrievedSmsCodeForPhoneNumber( 67 | TEST_PHONE_A, 68 | TEST_CODE_A 69 | ); 70 | ``` 71 | -------------------------------------------------------------------------------- /docs/auth/reference/ConfirmationResult.md: -------------------------------------------------------------------------------- 1 | # ConfirmationResult 2 | 3 | Returned as the result from [ref auth#signInWithPhoneNumber]. 4 | 5 | ## Properties 6 | 7 | ### verificationId 8 | [method]verificationId returns nullable string;[/method] 9 | 10 | Returns this confirmation results unique ID. 11 | 12 | ## Methods 13 | 14 | ### confirm 15 | [method]confirm(verificationCode) returns Promise containing [ref auth.User];[/method] 16 | 17 | Confirms a verification request by passing in the verification code sent with the SMS. 18 | 19 | | Parameter | | 20 | | --------- | ------- | 21 | | verificationCode | **string**
Code sent with the SMS verification message. | 22 | -------------------------------------------------------------------------------- /docs/auth/reference/EmailAuthProvider.md: -------------------------------------------------------------------------------- 1 | # EmailAuthProvider 2 | 3 | ``` 4 | firebase.auth.EmailAuthProvider 5 | ``` 6 | 7 | ## Properties 8 | 9 | ### EMAIL_LINK_SIGN_IN_METHOD 10 | [method]EMAIL_LINK_SIGN_IN_METHOD returns string;[/method] 11 | 12 | This corresponds to the sign-in method identifier as returned in [ref auth.auth#fetchSignInMethodsForEmail]. 13 | 14 | ### EMAIL_PASSWORD_SIGN_IN_METHOD 15 | [method]EMAIL_PASSWORD_SIGN_IN_METHOD returns string;[/method] 16 | 17 | This corresponds to the sign-in method identifier as returned in [ref auth.auth#fetchSignInMethodsForEmail]. 18 | 19 | ### PROVIDER_ID 20 | [method]PROVIDER_ID returns string;[/method] 21 | 22 | ### providerId 23 | [method]providerId returns string;[/method] 24 | 25 | ## Methods 26 | 27 | ### credential 28 | [method]credential(email, password) returns [ref auth.AuthCredential];[/method] 29 | 30 | | Parameter | | 31 | | --------- | ------- | 32 | | email | **string**
Email address. | 33 | | password | **string**
User account password. | 34 | 35 | #### Example 36 | 37 | ```js 38 | const credential = firebase.auth.EmailAuthProvider.credential( 39 | email, 40 | password 41 | ); 42 | ``` 43 | 44 | ### credentialWithLink 45 | [method]credentialWithLink(email, emailLink) returns [ref auth.AuthCredential];[/method] 46 | 47 | Initialize an EmailAuthProvider credential using an email and link. 48 | 49 | > Ensure your link is a valid email sign-in link by calling [ref auth.auth#isSignInWithEmailLink]. 50 | 51 | | Parameter | | 52 | | --------- | ------- | 53 | | email | **string**
Email address. | 54 | | emailLink | **string**
Sign-in email link. | 55 | 56 | #### Example 57 | 58 | ```js 59 | const credential = firebase.auth.EmailAuthProvider.credentialWithLink( 60 | email, 61 | emailLink 62 | ); 63 | ``` 64 | -------------------------------------------------------------------------------- /docs/auth/reference/Error.md: -------------------------------------------------------------------------------- 1 | # Error 2 | 3 | An authentication error. For method-specific error codes, refer to the specific methods in the documentation. For common error codes, check the reference below. Use [ref auth.Error#code] to get the specific error code. For a detailed message, use f[ref auth.Error#message]. 4 | 5 | ## Properties 6 | 7 | ### code 8 | [method]code returns string;[/method] 9 | 10 | Unique error code. 11 | 12 | ### message 13 | [method]message returns string;[/method] 14 | 15 | Complete error message. 16 | 17 | ## Common Error Codes 18 | 19 | - `auth/app-deleted`: Thrown if the instance of FirebaseApp has been deleted. 20 | - `auth/app-not-authorized`: Thrown if the app identified by the domain where it's hosted, is not authorized to use Firebase Authentication with the provided API key. Review your key configuration in the Google API console. 21 | - `auth/argument-error`: Thrown if a method is called with incorrect arguments. 22 | - `auth/invalid-api-key`: Thrown if the provided API key is invalid. Please check that you have copied it correctly from the Firebase Console. 23 | - `auth/invalid-user-token`: Thrown if the user's credential is no longer valid. The user must sign in again. 24 | - `auth/network-request-failed`: Thrown if a network error (such as timeout, interrupted connection or unreachable host) has occurred. 25 | - `auth/operation-not-allowed`: Thrown if you have not enabled the provider in the Firebase Console. Go to the Firebase Console for your project, in the Auth section and the Sign in Method tab and configure the provider. 26 | - `auth/requires-recent-login`: Thrown if the user's last sign-in time does not meet the security threshold. Use [ref auth.User#reauthenticateWithCredential] to resolve. This does not apply if the user is anonymous. 27 | - `auth/too-many-requests`: Thrown if requests are blocked from a device due to unusual activity. Trying again after some delay would unblock. 28 | - `auth/unauthorized-domain`: Thrown if the app domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console. 29 | - `auth/user-disabled`: Thrown if the user account has been disabled by an administrator. Accounts can be enabled or disabled in the Firebase Console, the Auth section and Users subsection. 30 | - `auth/user-token-expired`: Thrown if the user's credential has expired. This could also be thrown if a user has been deleted. Prompting the user to sign in again should resolve this for either case. 31 | - `auth/web-storage-unsupported`: Thrown if the browser does not support web storage or if the user disables them. 32 | -------------------------------------------------------------------------------- /docs/auth/reference/FacebookAuthProvider.md: -------------------------------------------------------------------------------- 1 | # FacebookAuthProvider 2 | 3 | ``` 4 | firebase.auth.FacebookAuthProvider 5 | ``` 6 | 7 | ## Properties 8 | 9 | ### PROVIDER_ID 10 | [method]PROVIDER_ID returns string;[/method] 11 | 12 | ### providerId 13 | [method]providerId returns string;[/method] 14 | 15 | ## Methods 16 | 17 | ### credential 18 | [method]credential(token) returns [ref auth.AuthCredential];[/method] 19 | 20 | | Parameter | | 21 | | --------- | ------- | 22 | | token | **string**
Facebook accessToken. | 23 | 24 | #### Example 25 | 26 | ```js 27 | const cred = firebase.auth.FacebookAuthProvider.credential( 28 | accessToken 29 | ); 30 | ``` 31 | -------------------------------------------------------------------------------- /docs/auth/reference/GithubAuthProvider.md: -------------------------------------------------------------------------------- 1 | # GithubAuthProvider 2 | 3 | ``` 4 | firebase.auth.GithubAuthProvider 5 | ``` 6 | 7 | ## Properties 8 | 9 | ### PROVIDER_ID 10 | [method]PROVIDER_ID returns string;[/method] 11 | 12 | ### providerId 13 | [method]providerId returns string;[/method] 14 | 15 | ## Methods 16 | 17 | ### credential 18 | [method]credential(token) returns [ref auth.AuthCredential];[/method] 19 | 20 | | Parameter | | 21 | | --------- | ------- | 22 | | token | **string**
Github accessToken. | 23 | 24 | #### Example 25 | 26 | ```js 27 | const cred = firebase.auth.GithubAuthProvider.credential( 28 | accessToken 29 | ); 30 | ``` 31 | -------------------------------------------------------------------------------- /docs/auth/reference/GoogleAuthProvider.md: -------------------------------------------------------------------------------- 1 | # GoogleAuthProvider 2 | 3 | ``` 4 | firebase.auth.GoogleAuthProvider 5 | ``` 6 | 7 | ## Properties 8 | 9 | ### PROVIDER_ID 10 | [method]PROVIDER_ID returns string;[/method] 11 | 12 | ### providerId 13 | [method]providerId returns string;[/method] 14 | 15 | ## Methods 16 | 17 | ### credential 18 | [method]credential(idToken, accessToken) returns [ref auth.AuthCredential];[/method] 19 | 20 | Creates a credential for Google. At least one of ID token and access token is required. 21 | 22 | | Parameter | | 23 | | --------- | ------- | 24 | | idToken | **string** (optional)
Google ID token.
Value may be null. | 25 | | accessToken | **string** (optional)
Google ID token.
Value may be null. | 26 | 27 | #### Example 28 | 29 | ```js 30 | const cred = firebase.auth.GoogleAuthProvider.credential( 31 | idToken, 32 | accessToken, 33 | ); 34 | ``` 35 | -------------------------------------------------------------------------------- /docs/auth/reference/IdTokenResult.md: -------------------------------------------------------------------------------- 1 | # IdTokenResult 2 | 3 | Interface representing an ID token result obtained from [ref auth.User#getIdTokenResult]. 4 | 5 | It contains the ID token JWT string and other helper properties for getting different data 6 | associated with the token as well as all the decoded payload claims. 7 | 8 | ?> Note that these claims are not to be trusted as they are parsed client side. Only server side verification can guarantee the integrity of the token claims. 9 | 10 | ## Properties 11 | 12 | ### authTime 13 | [method]authTime returns string;[/method] 14 | 15 | The authentication time as a ISO 8601 UTC Date string. This is the time the user authenticated (signed in) and not the time the token was refreshed. 16 | 17 | ### claims 18 | [method]claims returns non-null Object;[/method] 19 | 20 | The entire payload claims of the token including reserved claims and custom claims. 21 | 22 | ### expirationTime 23 | [method]expirationTime returns string;[/method] 24 | 25 | The token expiration time formatted as a ISO 8601 UTC Date string. 26 | 27 | ### issuedAtTime 28 | [method]issuedAtTime returns string;[/method] 29 | 30 | The token issued at time formatted as a ISO 8601 UTC Date string. 31 | 32 | ### signInProvider 33 | [method]signInProvider returns nullable string;[/method] 34 | 35 | The sign-in provider which the token was obtained with, e.g. anonymous, custom, phone, password, etc. 36 | 37 | > Note, this does not map to provider IDs. 38 | 39 | ### token 40 | [method]token returns string;[/method] 41 | 42 | The Firebase JWT string. 43 | 44 | ---- 45 | 46 | **Source**: https://firebase.google.com/docs/reference/js/firebase.auth.IdTokenResult 47 | -------------------------------------------------------------------------------- /docs/auth/reference/OAuthCredential.md: -------------------------------------------------------------------------------- 1 | # OAuthCredential 2 | 3 | Interface that represents the OAuth credentials returned by an OAuth provider. Implementations specify the details about each auth provider's credential requirements. 4 | 5 | ## Properties 6 | 7 | ### providerId 8 | [method]providerId returns string;[/method] 9 | 10 | The authentication provider ID for the credential. For example, 'facebook.com', or 'google.com'. 11 | -------------------------------------------------------------------------------- /docs/auth/reference/OAuthProvider.md: -------------------------------------------------------------------------------- 1 | # OAuthProvider 2 | 3 | ``` 4 | firebase.auth.OAuthProvider 5 | ``` 6 | 7 | ## Properties 8 | 9 | ### PROVIDER_ID 10 | [method]PROVIDER_ID returns string;[/method] 11 | 12 | ### providerId 13 | [method]providerId returns string;[/method] 14 | 15 | ## Methods 16 | 17 | ### credential 18 | [method]credential(idToken, accessToken) returns [ref auth.OAuthCredential][/method] 19 | 20 | | Parameter | | 21 | | --------- | ------- | 22 | | idToken | **string** | 23 | | accessToken | **string** | 24 | 25 | #### Example 26 | 27 | ```js 28 | const cred = firebase.auth.OAuthProvider.credential( 29 | idToken, 30 | accessToken 31 | ); 32 | ``` 33 | -------------------------------------------------------------------------------- /docs/auth/reference/PhoneAuthProvider.md: -------------------------------------------------------------------------------- 1 | # PhoneAuthProvider 2 | 3 | ``` 4 | firebase.auth.PhoneAuthProvider 5 | ``` 6 | 7 | ## Properties 8 | 9 | ### PROVIDER_ID 10 | [method]PROVIDER_ID returns string;[/method] 11 | 12 | ### providerId 13 | [method]providerId returns string;[/method] 14 | 15 | ## Methods 16 | 17 | ### credential 18 | [method]credential(verificationId, code) returns [ref auth.AuthCredential][/method] 19 | 20 | | Parameter | | 21 | | --------- | ------- | 22 | | verificationId | **string** | 23 | | code | **string** | 24 | 25 | #### Example 26 | 27 | ```js 28 | const cred = firebase.auth.PhoneAuthProvider.credential( 29 | verificationId, 30 | code 31 | ); 32 | ``` 33 | -------------------------------------------------------------------------------- /docs/auth/reference/TwitterAuthProvider.md: -------------------------------------------------------------------------------- 1 | # TwitterAuthProvider 2 | 3 | ``` 4 | firebase.auth.TwitterAuthProvider 5 | ``` 6 | 7 | ## Properties 8 | 9 | ### PROVIDER_ID 10 | [method]PROVIDER_ID returns string;[/method] 11 | 12 | ### providerId 13 | [method]providerId returns string;[/method] 14 | 15 | ## Methods 16 | 17 | ### credential 18 | [method]credential(token, secret) returns [ref auth.AuthCredential][/method] 19 | 20 | | Parameter | | 21 | | --------- | ------- | 22 | | token | **string**
Twitter accessToken. | 23 | | secret | **string**
Twitter secret. | 24 | 25 | #### Example 26 | 27 | ```js 28 | const cred = firebase.auth.TwitterAuthProvider.credential( 29 | token, 30 | secret 31 | ); 32 | ``` 33 | -------------------------------------------------------------------------------- /docs/auth/reference/UserCredential.md: -------------------------------------------------------------------------------- 1 | # UserCredential 2 | 3 | A structure containing a User, an AuthCredential, the operationType, and any additional user information that was returned from the identity provider. operationType could be 'signIn' for a sign-in operation, 'link' for a linking operation and 'reauthenticate' for a reauthentication operation. 4 | 5 | ## Properties 6 | 7 | ### user 8 | [method]user returns nullable [ref auth.User];[/method] 9 | 10 | ### additionalUserInfo 11 | [method]additionalUserInfo returns nullable [ref auth.AdditionalUserInfo] or undefined;[/method] 12 | 13 | ## Unsupported Methods 14 | 15 | The following methods are not supported in RNFirebase as they cannot work in the React Native environment or have a different implementation. 16 | 17 | ### credential 18 | 19 | 20 | ### operationType 21 | 22 | -------------------------------------------------------------------------------- /docs/auth/reference/UserInfo.md: -------------------------------------------------------------------------------- 1 | # UserInfo 2 | 3 | User profile information, visible only to the Firebase project's apps. 4 | 5 | ## Properties 6 | 7 | ### displayName 8 | [method]displayName returns nullable string;[/method] 9 | 10 | The user's display name (if available). 11 | 12 | ### email 13 | [method]email returns nullable string;[/method] 14 | 15 | The user's email address (if available). 16 | 17 | ### phoneNumber 18 | [method]phoneNumber returns nullable string;[/method] 19 | 20 | The user's E.164 formatted phone number (if available). 21 | 22 | ### photoURL 23 | [method]photoURL returns nullable string;[/method] 24 | 25 | The URL of the user's profile picture (if available). 26 | 27 | ### providerId 28 | [method]providerId returns string;[/method] 29 | 30 | The authentication provider ID for the current user. For example, 'facebook.com', or 'google.com'. 31 | 32 | ### uid 33 | [method]uid returns string;[/method] 34 | 35 | The user's unique ID. 36 | -------------------------------------------------------------------------------- /docs/auth/reference/UserMetadata.md: -------------------------------------------------------------------------------- 1 | # UserMetadata 2 | 3 | Interface representing a user's metadata. 4 | 5 | ## Properties 6 | 7 | ### creationTime 8 | [method]creationTime returns nullable string;[/method] 9 | 10 | The date the user was created, formatted as a UTC string. For example, 'Fri, 22 Sep 2017 01:49:58 GMT'. 11 | 12 | ### lastSignInTime 13 | [method]lastSignInTime returns nullable string;[/method] 14 | 15 | The date the user last signed in, formatted as a UTC string. For example, 'Fri, 22 Sep 2017 01:49:58 GMT'. 16 | -------------------------------------------------------------------------------- /docs/config/android.md: -------------------------------------------------------------------------------- 1 | # Android Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup). 4 | 5 | ## Add the dependency 6 | 7 | Add the Firebase Remote Config dependency to `android/app/build.gradle`: 8 | 9 | ```groovy 10 | dependencies { 11 | // ... 12 | implementation "com.google.firebase:firebase-config:{{ android.firebase.config }}" 13 | } 14 | ``` 15 | 16 | ## Install the RNFirebase Remote Config package 17 | 18 | Add the `RNFirebaseRemoteConfigPackage` to your `android/app/src/main/java/com/[app name]/MainApplication.java`: 19 | 20 | ```java 21 | // ... 22 | import io.invertase.firebase.RNFirebasePackage; 23 | import io.invertase.firebase.config.RNFirebaseRemoteConfigPackage; // <-- Add this line 24 | 25 | public class MainApplication extends Application implements ReactApplication { 26 | // ... 27 | 28 | @Override 29 | protected List getPackages() { 30 | return Arrays.asList( 31 | new MainReactPackage(), 32 | new RNFirebasePackage(), 33 | new RNFirebaseRemoteConfigPackage() // <-- Add this line 34 | ); 35 | } 36 | }; 37 | // ... 38 | } 39 | ``` 40 | -------------------------------------------------------------------------------- /docs/config/example.md: -------------------------------------------------------------------------------- 1 | # Remote Config Example 2 | 3 | The following example shows how you'd enable a feature in your app (`enableSuperCoolFeature`) if Remote Config returns `hasExperimentalFeature` being true. 4 | 5 | ```js 6 | if (__DEV__) { 7 | firebase.config().enableDeveloperMode(); 8 | } 9 | 10 | // Set default values 11 | firebase.config().setDefaults({ 12 | hasExperimentalFeature: false, 13 | }); 14 | 15 | firebase.config().fetch() 16 | .then(() => { 17 | return firebase.config().activateFetched(); 18 | }) 19 | .then((activated) => { 20 | if (!activated) console.log('Fetched data not activated'); 21 | return firebase.config().getValue('hasExperimentalFeature'); 22 | }) 23 | .then((snapshot) => { 24 | const hasExperimentalFeature = snapshot.val(); 25 | 26 | if(hasExperimentalFeature) { 27 | enableSuperCoolFeature(); 28 | } 29 | 30 | // continue booting app 31 | }) 32 | .catch(console.error); 33 | ``` 34 | -------------------------------------------------------------------------------- /docs/config/ios.md: -------------------------------------------------------------------------------- 1 | # iOS Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup). 4 | 5 | ## Add the pod 6 | 7 | Add the following to your `Podfile`: 8 | 9 | ```ruby 10 | pod 'Firebase/RemoteConfig', '~> {{ ios.firebase.config }}' 11 | ``` 12 | 13 | Run `pod update`. 14 | -------------------------------------------------------------------------------- /docs/core/default-app.md: -------------------------------------------------------------------------------- 1 | ## Default Firebase App 2 | 3 | After following the iOS & Android install guides and correctly setting up your google services plist/json files; the default app is automatically initialized and available for use in react-native-firebase. 4 | 5 | There's no need to call `initializeApp(opt)` in your JS code for the default app, import RNFirebase and use the default app straight away: 6 | 7 | ```javascript 8 | import firebase from 'react-native-firebase'; 9 | 10 | console.log(firebase.database().app.name); // '[DEFAULT]' 11 | ``` 12 | 13 | !> Calling `initializeApp()` for the default app will throw an 'app already initialized' error in a later release. 14 | 15 | ## Enable Database Persistence 16 | 17 | Enabling database persistence (setPersistence) via JS for the default app is no longer supported. This breaking change was made in v3.0.0 to avoid race condition issues. 18 | 19 | You can still however easily enable this natively for the default app instance: 20 | 21 | ### Android 22 | 23 | Add `FirebaseDatabase.getInstance().setPersistenceEnabled(true);` inside your `MainApplication.java` files `onCreate()` method. 24 | 25 | You also need to explicitly add the `FirebaseDatabase` import with the rest of the imports near the top of your `MainApplication.java` file: 26 | 27 | ```java 28 | import com.google.firebase.database.FirebaseDatabase; 29 | ``` 30 | 31 | ### iOS 32 | 33 | Add `[FIRDatabase database].persistenceEnabled = YES;` after the `[FIRApp configure];` line inside your `AppDelegate.m` files `didFinishLaunchingWithOptions` method. 34 | -------------------------------------------------------------------------------- /docs/core/initialize-apps.md: -------------------------------------------------------------------------------- 1 | # Initializing Apps 2 | 3 | !> The **default** firebase app instance can **not** be initialized via JS, please setup your google services plist/json files in your android studio / xcode projects. See [Default App](version /core/default-app) for more information. 4 | 5 | App initialization in RNFirebase is for the most part the same as the web sdk, with only a few minor differences. 6 | 7 | # Supported Modules 8 | 9 | Only 4 modules on the official firebase native SDK's support multiple apps, they are as follows: 10 | 11 | - Authentication 12 | - Database 13 | - Firestore 14 | - Storage 15 | 16 | # Initialize via JavaScript 17 | 18 | ## Cross Platform Example 19 | 20 | ```javascript 21 | import { Platform } from 'react-native'; 22 | import firebase from 'react-native-firebase'; 23 | 24 | // pluck values from your `GoogleService-Info.plist` you created on the firebase console 25 | const iosConfig = { 26 | clientId: 'x', 27 | appId: 'x', 28 | apiKey: 'x', 29 | databaseURL: 'x', 30 | storageBucket: 'x', 31 | messagingSenderId: 'x', 32 | projectId: 'x', 33 | 34 | // enable persistence by adding the below flag 35 | persistence: true, 36 | }; 37 | 38 | // pluck values from your `google-services.json` file you created on the firebase console 39 | const androidConfig = { 40 | clientId: 'x', 41 | appId: 'x', 42 | apiKey: 'x', 43 | databaseURL: 'x', 44 | storageBucket: 'x', 45 | messagingSenderId: 'x', 46 | projectId: 'x', 47 | 48 | // enable persistence by adding the below flag 49 | persistence: true, 50 | }; 51 | 52 | const kittensApp = firebase.initializeApp( 53 | // use platform specific firebase config 54 | Platform.OS === 'ios' ? iosConfig : androidConfig, 55 | // name of this app 56 | 'kittens', 57 | ); 58 | 59 | // dynamically created apps aren't available immediately due to the 60 | // asynchronous nature of react native bridging, therefore you must 61 | // wait for an `onReady` state before calling any modules/methods 62 | // otherwise you will most likely run into `app not initialized` exceptions 63 | kittensApp.onReady().then((app) => { 64 | // --- ready --- 65 | // use `app` arg, kittensApp var or `app('kittens')` to access modules 66 | // and their methods. e.g: 67 | firebase.app('kittens').auth().signInAnonymously().then((user) => { 68 | console.log('kittensApp user ->', user.toJSON()); 69 | }); 70 | }); 71 | ``` 72 | 73 | # Initialize via Android/iOS native code 74 | 75 | If you're familiar with native code you can create apps natively also (or if you are already initializing additional apps natively on app boot) - these apps automatically become available for use inside RNFirebase. 76 | 77 | For example, if you created an app natively called `dogs` then the following would work: 78 | 79 | ```javascript 80 | import firebase from 'react-native-firebase'; 81 | 82 | const dogsApp = firebase.app('dogs'); 83 | 84 | dogsApp.auth().signInAnonymously().then((user) => { 85 | console.log('dogsApp user ->', user.toJSON()); 86 | }); 87 | ``` 88 | 89 | 90 | # Deleting an app instance 91 | 92 | Currently it's not possible to provide cross platform 'delete app' functionality as the Firebase Android SDK is missing the app delete method, this has been flagged with firebase ([firebase/firebase-ios-sdk#140 (comment)](https://github.com/firebase/firebase-ios-sdk/issues/140#issuecomment-315953708)). 93 | 94 | -------------------------------------------------------------------------------- /docs/core/reference/App.md: -------------------------------------------------------------------------------- 1 | # App 2 | 3 | ## Methods 4 | 5 | ### extendApp 6 | [method]extendApp(props) returns void;[/method] 7 | 8 | Allows adding additional properties onto a firebase app instance. 9 | 10 | ?> This methods is undocumented on the web SDK. 11 | 12 | | Parameter | | 13 | | --------- | ------- | 14 | | props | **Object** | 15 | 16 | ### delete 17 | [method]delete() returns Promise;[/method] 18 | 19 | Renders this app instance unusable and frees the resources of all associated services. 20 | 21 | ?> Due to native sdk requirments; the default app can not be deleted and will throw an error if a delete is attempted. 22 | 23 | ### onReady 24 | [method]onReady() returns Promise containing [App](#methods);[/method] 25 | 26 | Resolves a promise once the App instance has been initilized. 27 | 28 | ## Properties 29 | 30 | ### name 31 | [method]name returns string;[/method] 32 | 33 | ### options 34 | [method]options returns Object;[/method] 35 | 36 | -------------------------------------------------------------------------------- /docs/core/reference/core.md: -------------------------------------------------------------------------------- 1 | # Core 2 | 3 | ## Methods 4 | 5 | ### initializeApp 6 | [method]initializeApp(options, name) returns [ref core.App];[/method] 7 | 8 | Initializes a new [ref core.App] instance. 9 | 10 | [collapse Parameters] 11 | 12 | | Parameter | | 13 | | --------- | ------- | 14 | | options | **Object** | 15 | | name | **string** | 16 | 17 | | Options | | 18 | | --------- | ------- | 19 | | apiKey | **string** | 20 | | appId | **string** | 21 | | databaseURL | **string** | 22 | | messagingSenderId | **string** | 23 | | projectId | **string** | 24 | | storageBucket | **string** | 25 | 26 | [/collapse] 27 | 28 | ### app 29 | [method]app(name) returns [ref core.App];[/method] 30 | 31 | Returns a [ref core.App] instance by name. 32 | 33 | [collapse Parameters] 34 | 35 | | Parameter | | 36 | | --------- | ------- | 37 | | name | **string** (optional)
Returns the default app instance if no value. | 38 | 39 | [/collapse] 40 | 41 | 42 | ### setLogLevel 43 | [method]setLogLevel(level) returns void;[/method] 44 | 45 | Set the global logging level for all logs. 46 | 47 | [collapse Parameters] 48 | 49 | | Parameter | | 50 | | --------- | ------- | 51 | | level | **string** or **boolean** | 52 | 53 | [/collapse] 54 | 55 | ## Properties 56 | 57 | ### apps 58 | 59 | [method]apps returns Array of [ref core.App];[/method] 60 | 61 | Returns all initilized apps. 62 | 63 | ### SDK_VERSION 64 | 65 | [method]SDK_VERSION returns string;[/method] 66 | 67 | The current SDK version. 68 | 69 | 70 | -------------------------------------------------------------------------------- /docs/crashlytics/android.md: -------------------------------------------------------------------------------- 1 | # Android Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup). 4 | 5 | ## Add the dependency 6 | 7 | Add the Firebase Crashlytics dependency to `android/app/build.gradle`: 8 | 9 | ```groovy 10 | dependencies { 11 | // ... 12 | implementation('com.crashlytics.sdk.android:crashlytics:{{ android.firebase.crashlytics }}@aar') { 13 | transitive = true 14 | } 15 | } 16 | ``` 17 | 18 | Crashlytics also requires the Fabric Gradle dependency. In your projects `android/build.gradle` file, add the plugin to your dependencies and also check that you have version {{ android.gms.google-services }} of the google-services plugin: 19 | 20 | ```groovy 21 | buildscript { 22 | // ... 23 | dependencies { 24 | // ... 25 | classpath 'com.google.gms:google-services:{{ android.gms.google-services }}' 26 | classpath 'io.fabric.tools:gradle:{{ android.fabric.tools }}' 27 | } 28 | } 29 | ``` 30 | 31 | You need to add `maven { url 'https://maven.fabric.io/public' }` to your `android/build.gradle` as follows: 32 | 33 | ```groovy 34 | buildscript { 35 | repositories { 36 | jcenter() 37 | maven { 38 | url 'https://maven.fabric.io/public' 39 | } 40 | } 41 | // ... 42 | } 43 | ``` 44 | 45 | At the top of your `android/app/build.gradle` file, below other plugins, apply the `io.fabric` plugin: 46 | 47 | ```groovy 48 | apply plugin: "com.android.application" 49 | apply plugin: "io.fabric" 50 | ``` 51 | 52 | ## Install the RNFirebase Crashlytics package 53 | 54 | Add the `RNFirebaseCrashlyticsPackage` to your `android/app/src/main/java/com/[app name]/MainApplication.java`: 55 | 56 | ```java 57 | // ... 58 | import io.invertase.firebase.RNFirebasePackage; 59 | import io.invertase.firebase.fabric.crashlytics.RNFirebaseCrashlyticsPackage; // <-- Add this line 60 | 61 | public class MainApplication extends Application implements ReactApplication { 62 | // ... 63 | 64 | @Override 65 | protected List getPackages() { 66 | return Arrays.asList( 67 | new MainReactPackage(), 68 | new RNFirebasePackage(), 69 | new RNFirebaseCrashlyticsPackage() // <-- Add this line 70 | ); 71 | } 72 | }; 73 | // ... 74 | } 75 | ``` 76 | -------------------------------------------------------------------------------- /docs/crashlytics/ios.md: -------------------------------------------------------------------------------- 1 | # iOS Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup). 4 | 5 | ## Pods (recommended) 6 | 7 | ### Add the pods 8 | 9 | Add the following to your `Podfile`: 10 | 11 | ```ruby 12 | pod 'Fabric', '~> {{ ios.fabric.tools }}' 13 | pod 'Crashlytics', '~> {{ ios.firebase.crashlytics }}' 14 | ``` 15 | 16 | Run `pod update`. 17 | 18 | ### Add the Crashlytics run script 19 | 20 | 1. Open your project in Xcode and select its project file in the Navigator 21 | 2. Open the **Build Phases** tab. 22 | 3. Click **+ Add a new build phase**, and select **New Run Script Phase**. 23 | 4. Add the following line to the **Type a script..** text box: 24 | 25 | ```groovy 26 | "${PODS_ROOT}/Fabric/run" 27 | ``` 28 | 29 | ## Manual 30 | 31 | ### Add to project 32 | 1. Go and download the [crashlytics iOS library](https://fabric.io/kits/ios/crashlytics/manual-install). 33 | 2. Add the `Crashytics.framework` and `Fabric.framework` to your iOS project. 34 | 3. Add both frameworks to "Link Binary With Libraries" in your Build Phases. 35 | 4. Add `$(PROJECT_DIR)/Firebase/Fabric` and `$(PROJECT_DIR)/Firebase/Crashlytics` to your "Header Search Paths" in Build Settings (Assuming Fabric and Crashlytics libraries are in a folder called `Firebase/Crashlytics`). 36 | 37 | ### Add the Crashlytics run script 38 | 39 | 1. Open your project in Xcode and select its project file in the Navigator 40 | 2. Open the **Build Phases** tab. 41 | 3. Click **+ Add a new build phase**, and select **New Run Script Phase**. 42 | 4. Add the following line to the **Type a script..** text box (Assuming the Fabric library is in `${SRCROOT}/Firebase/Fabric`): 43 | 44 | ```groovy 45 | "${SRCROOT}/Firebase/Fabric/Fabric.framework/run" 46 | ``` 47 | 48 | 5. **Xcode 10 only:** Add your app's built Info.plist location to the Build Phase's Input Files field: 49 | 50 | ```groovy 51 | $(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH) 52 | ``` 53 | 54 | 55 | ---- 56 | 57 | **Source:** [Firebase Crashlytics - Getting Started - iOS](https://firebase.google.com/docs/crashlytics/get-started#ios) 58 | -------------------------------------------------------------------------------- /docs/crashlytics/manual-initialization.md: -------------------------------------------------------------------------------- 1 | # Manual Initialization 2 | 3 | By default, Firebase Crashlytics automatically collects crash reports for all your app's users. To give users more control over the data they send, you can enable opt-in reporting instead. 4 | 5 | To do that, you have to disable automatic collection and initialize Crashlytics only for opt-in users. 6 | 7 | ## 1) Disable automatic initialization 8 | 9 | ### iOS: 10 | 11 | Turn off automatic collection with a new key to your `Info.plist` file: 12 | 13 | * Key: `firebase_crashlytics_collection_enabled` 14 | * Value: `false` 15 | 16 | ### Android: 17 | 18 | Turn off automatic collection with a meta-data tag in your `AndroidManifest.xml` file: 19 | 20 | ```xml 21 | 24 | ``` 25 | 26 | ## 2) Enable collection at runtime 27 | 28 | Initializing Crashlytics in your js code: 29 | 30 | ```js 31 | firebase.crashlytics().enableCrashlyticsCollection(); 32 | ``` 33 | -------------------------------------------------------------------------------- /docs/crashlytics/reference/crashlytics.md: -------------------------------------------------------------------------------- 1 | # Crashlytics 2 | 3 | ``` 4 | firebase.crashlytics 5 | ``` 6 | 7 | ?> **Upcoming Change:** Note that this API is likely to change in v5.1.0 to simplify setting values/multiple values as well as better JS Error reporting. The API implemented currently is an initial draft to allow early access. 8 | 9 | ## Methods 10 | 11 | The following methods are accessed via the Crashlytics instance `firebase.crashlytics()`. 12 | 13 | ### crash 14 | [method]crash() returns void;[/method] 15 | 16 | Forces a crash. Useful for testing your application is set up correctly. 17 | 18 | ### log 19 | [method]log(message) returns void;[/method] 20 | 21 | Logs a message that will be sent with any subsequent crash reports. 22 | 23 | | Parameter | | 24 | | --------- | ------- | 25 | | message | **string** | 26 | 27 | ### recordError 28 | [method]recordError(code, message) returns void;[/method] 29 | 30 | Logs a non fatal exception to Crashlytics. 31 | 32 | > Reports are not realtime. They can take a number of hours to appear in the Firebase console. 33 | 34 | | Parameter | | 35 | | --------- | --- | 36 | | code | **number**
The error code. | 37 | | message | **string**
The error message. | 38 | 39 | ### setBoolValue 40 | [method]setBoolValue(key, value) returns void;[/method] 41 | 42 | Set a boolean value to show alongside any subsequent crash reports. 43 | 44 | | Parameter | | 45 | | --------- | --- | 46 | | key | **string**
The name of the key. | 47 | | value | **boolean**
The value of the key. | 48 | 49 | ### setFloatValue 50 | [method]setFloatValue(key, value) returns void;[/method] 51 | 52 | Set a float value to show alongside any subsequent crash reports. 53 | 54 | | Parameter | | 55 | | --------- | --- | 56 | | key | **string**
The name of the key. | 57 | | value | **number**
The value of the key. | 58 | 59 | ### setIntValue 60 | [method]setIntValue(key, value) returns void;[/method] 61 | 62 | Set an integer value to show alongside any subsequent crash reports. 63 | 64 | | Parameter | | 65 | | --------- | --- | 66 | | key | **string**
The name of the key. | 67 | | value | **number**
The value of the key. | 68 | 69 | ### setStringValue 70 | [method]setStringValue(key, value) returns void;[/method] 71 | 72 | Set a string value to show alongside any subsequent crash reports. 73 | 74 | | Parameter | | 75 | | --------- | --- | 76 | | key | **string**
The name of the key. | 77 | | value | **number**
The value of the key. | 78 | 79 | ### setUserIdentifier 80 | [method]setUserIdentifier(userId) returns void;[/method] 81 | 82 | Set the user ID to show alongside any subsequent crash reports. 83 | 84 | | Parameter | | 85 | | --------- | --- | 86 | | userId | **string**
The user's ID. | 87 | 88 | ### enableCrashlyticsCollection 89 | [method]enableCrashlyticsCollection() returns void;[/method] 90 | 91 | Enable Crashlytics reporting. Only avaliable when [disabled automatic initialization](../manual-initialization). -------------------------------------------------------------------------------- /docs/database/android.md: -------------------------------------------------------------------------------- 1 | # Android Installation 2 | 3 | ## Add the dependency 4 | 5 | Add the Firebase Realtime Database dependency to `android/app/build.gradle`: 6 | 7 | ```groovy 8 | dependencies { 9 | // ... 10 | implementation "com.google.firebase:firebase-database:{{ android.firebase.database }}" 11 | } 12 | ``` 13 | 14 | ## Install the RNFirebase Database package 15 | 16 | Add the `RNFirebaseDatabasePackage` to your `android/app/src/main/java/com/[app name]/MainApplication.java`: 17 | 18 | ```java 19 | // ... 20 | import io.invertase.firebase.RNFirebasePackage; 21 | import io.invertase.firebase.database.RNFirebaseDatabasePackage; // <-- Add this line 22 | 23 | public class MainApplication extends Application implements ReactApplication { 24 | // ... 25 | 26 | @Override 27 | protected List getPackages() { 28 | return Arrays.asList( 29 | new MainReactPackage(), 30 | new RNFirebasePackage(), 31 | new RNFirebaseDatabasePackage() // <-- Add this line 32 | ); 33 | } 34 | }; 35 | // ... 36 | } 37 | ``` 38 | -------------------------------------------------------------------------------- /docs/database/ios.md: -------------------------------------------------------------------------------- 1 | # iOS Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup). 4 | 5 | ## Add the pod 6 | 7 | Add the following to your `Podfile`: 8 | 9 | ```ruby 10 | pod 'Firebase/Database', '~> {{ ios.firebase.database }}' 11 | ``` 12 | 13 | Run `pod update`. 14 | -------------------------------------------------------------------------------- /docs/database/reference/ServerValue.md: -------------------------------------------------------------------------------- 1 | # ServerValue 2 | 3 | ``` 4 | firebase.database.ServerValue 5 | ``` 6 | 7 | ## Properties 8 | 9 | ### TIMESTAMP 10 | [method]TIMESTAMP returns non-null Object[/method] 11 | 12 | A placeholder value for auto-populating the current timestamp (time since the Unix epoch, in milliseconds) as determined by the Firebase servers. 13 | 14 | > This adds the Object `{ '.sv': 'timestamp' }` which Firebase converts to the server timestamp. 15 | 16 | #### Example 17 | 18 | ```js 19 | var sessionsRef = firebase.database().ref("sessions"); 20 | 21 | sessionsRef.push({ 22 | startedAt: firebase.database.ServerValue.TIMESTAMP 23 | }); 24 | ``` 25 | -------------------------------------------------------------------------------- /docs/database/reference/database.md: -------------------------------------------------------------------------------- 1 | # Database 2 | 3 | ``` 4 | firebase.database 5 | ``` 6 | 7 | ## Methods 8 | 9 | The following methods are accessed via the Database instance `firebase.database()`. 10 | 11 | ### goOffline 12 | [method]goOffline() returns void;[/method] 13 | 14 | Disconnects from the server (all Database operations will be completed offline). 15 | 16 | The client automatically maintains a persistent connection to the Database server, which will remain active indefinitely and reconnect when disconnected. However, the goOffline() and goOnline() methods may be used to control the client connection in cases where a persistent connection is undesirable. 17 | 18 | While offline, the client will no longer receive data updates from the Database. However, all Database operations performed locally will continue to immediately fire events, allowing your application to continue behaving normally. Additionally, each operation performed locally will automatically be queued and retried upon reconnection to the Database server. 19 | 20 | To reconnect to the Database and begin receiving remote events, see [ref database.database#goOnline]. 21 | 22 | [collapse Example] 23 | ```js 24 | firebase.database().goOffline(); 25 | ``` 26 | [/collapse] 27 | 28 | ### goOnline 29 | [method]goOnline() returns void;[/method] 30 | 31 | Reconnects to the server and synchronizes the offline Database state with the server state. 32 | 33 | This method should be used after disabling the active connection with goOffline(). Once reconnected, the client will transmit the proper data and fire the appropriate events so that your client "catches up" automatically. 34 | 35 | 36 | [collapse Example] 37 | ```js 38 | firebase.database().goOnline(); 39 | ``` 40 | [/collapse] 41 | 42 | ### ref 43 | [method]ref(path) returns [ref database.Reference];[/method] 44 | 45 | Returns a Reference representing the location in the Database corresponding to the provided path. If no path is provided, the Reference will point to the root of the Database. 46 | 47 | [collapse Example] 48 | ```js 49 | const ref = firebase.database().ref('path'); 50 | ref.update({ foo: 'bar' }); 51 | ``` 52 | [/collapse] 53 | 54 | | Parameter | | 55 | | --------- | ------- | 56 | | path | **string** (optional)
Optional path representing the location the returned Reference will point. If not provided, the returned Reference will point to the root of the Database. | 57 | 58 | ### getServerTime 59 | [method]getServerTime() returns number;[/method] 60 | 61 | Gets the Firebase server current timestamp. 62 | 63 | [collapse Example] 64 | ```js 65 | const serverTime = firebase.database().getServerTime(); 66 | ``` 67 | [/collapse] 68 | 69 | ## Unsupported Methods 70 | 71 | ### refFromURL 72 | -------------------------------------------------------------------------------- /docs/faqs.md: -------------------------------------------------------------------------------- 1 | # Frequently Asked Questions 2 | 3 | ## Usage with Expo 4 | 5 | React Native Firebase relies heavily on the Firebase native SDKs which means that due to restrictions within Expo, there is no way to use React Native Firebase without ejecting your Expo app. 6 | 7 | TODO: Working Expo + RNFirebase link 8 | 9 | ## Should I use Redux with the Realtime Database / Cloud Firestore? 10 | 11 | TODO 12 | -------------------------------------------------------------------------------- /docs/firestore/android.md: -------------------------------------------------------------------------------- 1 | # Android Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup). 4 | 5 | ## Add the dependency 6 | 7 | Add the Firebase Firestore dependency to `android/app/build.gradle`: 8 | 9 | ```groovy 10 | dependencies { 11 | // ... 12 | implementation "com.google.firebase:firebase-firestore:{{ android.firebase.firestore }}" 13 | } 14 | ``` 15 | 16 | ## Install the RNFirebase Firestore package 17 | 18 | Add the `RNFirebaseFirestorePackage` to your `android/app/src/main/java/com/[app name]/MainApplication.java`: 19 | 20 | ```java 21 | // ... 22 | import io.invertase.firebase.RNFirebasePackage; 23 | import io.invertase.firebase.firestore.RNFirebaseFirestorePackage; // <-- Add this line 24 | 25 | public class MainApplication extends Application implements ReactApplication { 26 | // ... 27 | 28 | @Override 29 | protected List getPackages() { 30 | return Arrays.asList( 31 | new MainReactPackage(), 32 | new RNFirebasePackage(), 33 | new RNFirebaseFirestorePackage() // <-- Add this line 34 | ); 35 | } 36 | }; 37 | // ... 38 | } 39 | ``` 40 | 41 | ## Enable multidex 42 | 43 | Adding Firestore to your Android app requires [`multiDexEnabled` to be set to `true`](https://developer.android.com/studio/build/multidex) in `android/app/build.gradle`: 44 | 45 | ```java 46 | //.. 47 | android { 48 | //.. 49 | 50 | defaultConfig { 51 | //.. 52 | multiDexEnabled true // needed for firestore: 53 | } 54 | //.. 55 | } 56 | ``` 57 | -------------------------------------------------------------------------------- /docs/firestore/ios.md: -------------------------------------------------------------------------------- 1 | # iOS Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup). 4 | 5 | ## Add the pod 6 | 7 | Add the following to your `Podfile`: 8 | 9 | ```ruby 10 | pod 'Firebase/Firestore', '~> {{ ios.firebase.firestore }}' 11 | ``` 12 | 13 | Run `pod update`. 14 | 15 | ## Troubleshooting 16 | 17 | Your Xcode project may fail to build if you are including the Google Signin pod (`pod 'GoogleSignIn'`) in your project, this appears to be due to some extra search paths that need to be removed. 18 | 19 | Invertase has a fork of the project at https://github.com/invertase/react-native-google-signin, which you can add to your project using: 20 | 21 | ``` 22 | npm install --save https://github.com/invertase/react-native-google-signin.git#v0.12.1 23 | ``` 24 | 25 | You can see the relevant discussion on github issues [here](https://github.com/invertase/react-native-firebase/issues/758#issuecomment-358575691). 26 | -------------------------------------------------------------------------------- /docs/firestore/reference/Blob.md: -------------------------------------------------------------------------------- 1 | # Blob 2 | 3 | ``` 4 | firebase.firestore.Blob 5 | ``` 6 | 7 | ## Static Methods 8 | 9 | ### fromBase64String 10 | [method]fromBase64String(base64) returns [ref firestore.Blob];[/method] 11 | 12 | Creates a new Blob from the given Base64 string, converting it to bytes. 13 | 14 | | Parameter | | 15 | | --------- | ------- | 16 | | base64 | **string**
The Base64 string used to create the Blob object.| 17 | 18 | [collapse Example] 19 | ```js 20 | firebase.firestore.Blob.fromBase64String(base64string); 21 | ``` 22 | [/collapse] 23 | 24 | ### fromUint8Array 25 | [method]fromUint8Array(array) returns [ref firestore.Blob];[/method] 26 | 27 | Creates a new Blob from the given Uint8Array. 28 | 29 | | Parameter | | 30 | | --------- | ------- | 31 | | array | **Uint8Array**
The Uint8Array used to create the Blob object.
Value must not be null.| 32 | 33 | [collapse Example] 34 | ```js 35 | firebase.firestore.Blob.fromUint8Array(uint8Array); 36 | ``` 37 | [/collapse] 38 | 39 | ## Methods 40 | 41 | ### isEqual 42 | [methods]isEqual(other) returns [ref firestore.Blob];[/methods] 43 | 44 | Returns 'true' if this Blob is equal to the provided one. 45 | 46 | | Parameter | | 47 | | --------- | ------- | 48 | | other | **[ref firestore.Blob]**
The **Blob** to compare against.
Value must not be null.| 49 | 50 | ### toBase64 51 | [methods]toBase64() returns string;[/methods] 52 | 53 | Returns the bytes of a Blob as a Base64-encoded string. 54 | 55 | ### toUint8Array 56 | [methods]toBase64() returns Uint8Array;[/methods] 57 | 58 | Returns the bytes of a Blob in a new Uint8Array. 59 | -------------------------------------------------------------------------------- /docs/firestore/reference/DocumentChange.md: -------------------------------------------------------------------------------- 1 | # DocumentChange 2 | 3 | A DocumentChange represents a change to the documents matching a query. It contains the document affected and the type of change that occurred. 4 | 5 | ## Properties 6 | 7 | ### doc 8 | [method]doc returns [ref firestore.DocumentReference];[/method] 9 | 10 | The document affected by this change. 11 | 12 | ### newIndex 13 | [method]newIndex returns number;[/method] 14 | 15 | The index of the changed document in the result set immediately after this `DocumentChange` (i.e. supposing that all prior `DocumentChange` objects and the current `DocumentChange` object have been applied). Is -1 for 'removed' events. 16 | 17 | ### oldIndex 18 | [method]oldIndex returns number;[/method] 19 | 20 | The index of the changed document in the result set immediately prior to this `DocumentChange` (i.e. supposing that all prior `DocumentChange` objects have been applied). Is -1 for 'added' events. 21 | 22 | ### type 23 | [method]type returns string;[/method] 24 | 25 | The type of change that occurred. 26 | 27 | Possible values are 'added', 'modified', or 'removed'. 28 | -------------------------------------------------------------------------------- /docs/firestore/reference/DocumentSnapshot.md: -------------------------------------------------------------------------------- 1 | # DocumentSnapshot 2 | 3 | A DocumentSnapshot contains data read from a document in your Cloud Firestore database. The data can be extracted with `.data()` or `.get()` to get a specific field. 4 | 5 | ## Properties 6 | 7 | ### exists 8 | [method]exists returns boolean;[/method] 9 | 10 | Property of the DocumentSnapshot that signals whether or not the data exists. True if the document exists. 11 | 12 | ### id 13 | [method]id returns string;[/method] 14 | 15 | Property of the DocumentSnapshot that provides the document's ID. 16 | 17 | ### metadata 18 | [method]metadata returns [ref firestore.SnapshotMetadata];[/method] 19 | 20 | Metadata about the DocumentSnapshot, including information about its source and local modifications. 21 | 22 | ### ref 23 | [method]ref returns [ref firestore.DocumentReference];[/method] 24 | 25 | The DocumentReference for the document included in the DocumentSnapshot. 26 | 27 | ## Methods 28 | 29 | ### data 30 | [method]data() returns Object;[/method] 31 | 32 | Retrieves all fields in the document as an object. 33 | 34 | ### get 35 | [method]get(fieldPath) returns any type or undefined;[/method] 36 | 37 | | Parameter | | 38 | | --------- | ------- | 39 | | fieldPath | **string** or **[ref firestore.FieldPath]**
The path (e.g. 'foo' or 'foo.bar') to a specific field. | 40 | 41 | 42 | -------------------------------------------------------------------------------- /docs/firestore/reference/FieldPath.md: -------------------------------------------------------------------------------- 1 | # FieldPath 2 | 3 | ``` 4 | firebase.firestore.FieldPath 5 | ``` 6 | 7 | ### FieldPath 8 | [method]new FieldPath(...var_args);[/method] 9 | 10 | A FieldPath refers to a field in a document. The path may consist of a single field name (referring to a top-level field in the document), or a list of field names (referring to a nested field in the document). 11 | 12 | Create a FieldPath by providing field names. If more than one field name is provided, the path will point to a nested field in a document. 13 | 14 | | Parameter | | 15 | | --------- | ------- | 16 | | var_args | A list of field names.
Value may be repeated. | 17 | 18 | ## Methods 19 | 20 | ### documentId 21 | [methods]documentId() returns [ref firestore.FieldPath];[/methods] 22 | 23 | Returns a special sentinel `FieldPath` to refer to the ID of a document. It can be used in queries to sort or filter by the document ID. 24 | -------------------------------------------------------------------------------- /docs/firestore/reference/FieldValue.md: -------------------------------------------------------------------------------- 1 | # FieldValue 2 | 3 | ``` 4 | firebase.firestore.FieldValue 5 | ``` 6 | 7 | Sentinel values that can be used when writing document fields with set() or update(). 8 | 9 | ## Methods 10 | 11 | ### delete 12 | [methods]delete() returns [ref firestore.FieldValue];[/methods] 13 | 14 | Returns a sentinel for use with update() to mark a field for deletion. 15 | 16 | ### serverTimestamp 17 | [methods]serverTimestamp() returns [ref firestore.FieldValue];[/methods] 18 | 19 | Returns a sentinel used with set() or update() to include a server-generated timestamp in the written data. 20 | 21 | ### arrayUnion 22 | [methods]arrayUnion(...var_args) returns [ref firestore.FieldValue];[/methods] 23 | 24 | Returns a special value that can be used with set() or update() that tells the server to union the given elements with any array value that already exists on the server. 25 | 26 | ### arrayRemove 27 | [methods]arrayRemove(...var_args) returns [ref firestore.FieldValue];[/methods] 28 | 29 | Returns a special value that can be used with set() or update() that tells the server to remove the given elements from any array value that already exists on the server. 30 | -------------------------------------------------------------------------------- /docs/firestore/reference/FirestoreError.md: -------------------------------------------------------------------------------- 1 | # FirestoreError 2 | 3 | The set of Cloud Firestore status codes. 4 | 5 | Possible values: 6 | 7 | - `cancelled`: The operation was cancelled (typically by the caller). 8 | - `unknown`: Unknown error or an error from a different error domain. 9 | - `invalid-argument`: Client specified an invalid argument. Note that this differs from failed-precondition. invalid-argument indicates arguments that are problematic regardless of the state of the system (e.g. an invalid field name). 10 | - `deadline-exceeded`: Deadline expired before operation could complete. For operations that change the state of the system, this error may be returned even if the operation has completed successfully. For example, a successful response from a server could have been delayed long enough for the deadline to expire. 11 | - `not-found`: Some requested document was not found. 12 | - `already-exists`: Some document that we attempted to create already exists. 13 | - `permission-denied`: The caller does not have permission to execute the specified operation. 14 | - `resource-exhausted`: Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space. 15 | - `failed-precondition`: Operation was rejected because the system is not in a state required for the operation`s execution. 16 | - `aborted`: The operation was aborted, typically due to a concurrency issue like transaction aborts, etc. 17 | - `out-of-range`: Operation was attempted past the valid range. 18 | - `unimplemented`: Operation is not implemented or not supported/enabled. 19 | - `internal`: Internal errors. Means some invariants expected by underlying system has been broken. If you see one of these errors, something is very broken. 20 | - `unavailable`: The service is currently unavailable. This is most likely a transient condition and may be corrected by retrying with a backoff. 21 | - `data-loss`: Unrecoverable data loss or corruption. 22 | - `unauthenticated`: The request does not have valid authentication credentials for the operation. -------------------------------------------------------------------------------- /docs/firestore/reference/GeoPoint.md: -------------------------------------------------------------------------------- 1 | # GeoPoint 2 | 3 | ``` 4 | new firebase.firestore.GeoPoint 5 | ``` 6 | 7 | ### GeoPoint 8 | [method]new GeoPoint(latitude, longitude);[/method] 9 | 10 | An immutable object representing a geo point in Cloud Firestore. The geo point is represented as latitude/longitude pair. 11 | 12 | | Parameter | | 13 | | --------- | ------- | 14 | | latitude | **number**
Latitude values are in the range of -90 to 90. | 15 | | longitude | **number**
Longitude values are in the range of -180 to 180. | 16 | 17 | ## Properties 18 | 19 | ### latitude 20 | [method]latitude returns number;[/method] 21 | 22 | The latitude of this GeoPoint instance. 23 | 24 | ### longitude 25 | [method]longitude returns number;[/method] 26 | 27 | The longitude of this GeoPoint instance. 28 | -------------------------------------------------------------------------------- /docs/firestore/reference/MetadataChanges.md: -------------------------------------------------------------------------------- 1 | # MetadataChanges 2 | 3 | Options for use with `DocumentReference.onSnapshot()` and `CollectionReference.onSnapshot()` to control the behavior of the snapshot listener. 4 | 5 | ## Properties 6 | 7 | ### includeMetadataChanges 8 | [method]includeMetadataChanges returns boolean;[/method] 9 | 10 | Raise an event even if only metadata of the document or query changes. Default is false. 11 | -------------------------------------------------------------------------------- /docs/firestore/reference/QuerySnapshot.md: -------------------------------------------------------------------------------- 1 | # QuerySnapshot 2 | 3 | A QuerySnapshot contains zero or more DocumentSnapshot objects representing the results of a query. The documents can be accessed as an array via the docs property or enumerated using the forEach method. The number of documents can be determined via the empty and size properties. 4 | 5 | ## Properties 6 | 7 | ### docChanges 8 | [method]docChanges returns Array of [ref firestore.DocumentChange];[/method] 9 | 10 | An array of the documents that changed since the last snapshot. If this is the first snapshot, all documents will be in the list as added changes. 11 | 12 | ### docs 13 | [method]docs returns Array of [ref firestore.DocumentSnapshot];[/method] 14 | 15 | An array of all the documents in the QuerySnapshot. 16 | 17 | ### empty 18 | [method]empty returns boolean;[/method] 19 | 20 | True if there are no documents in the QuerySnapshot. 21 | 22 | ### metadata 23 | [method]metadata returns [ref firestore.SnapshotMetadata];[/method] 24 | 25 | Metadata about this snapshot, concerning its source and if it has local modifications. 26 | 27 | ### query 28 | [method]query returns [ref firestore.Query];[/method] 29 | 30 | The query you called get or onSnapshot on to get the QuerySnapshot. 31 | 32 | ### size 33 | [method]size returns number;[/method] 34 | 35 | The number of documents in the QuerySnapshot. 36 | 37 | ## Methods 38 | 39 | ### forEach 40 | [method]forEach(callback) returns void;[/method] 41 | 42 | Enumerates all of the documents in the QuerySnapshot. 43 | 44 | | Parameter | | 45 | | --------- | ------- | 46 | | callback | **function([ref firestore.DataSnapshot])** | 47 | -------------------------------------------------------------------------------- /docs/firestore/reference/SetOptions.md: -------------------------------------------------------------------------------- 1 | # SetOptions 2 | 3 | An options object that configures the behavior of `set()` calls in [ref firestore.DocumentReference], [ref firestore.WriteBatch] and [ref firestore.Transaction]. These calls can be configured to perform granular merges instead of overwriting the target documents in their entirety by providing a SetOptions with merge: true. 4 | 5 | ## Properties 6 | 7 | ### merge 8 | [method]merge returns boolean;[/method] 9 | 10 | Changes the behavior of a set() call to only replace the values specified in its data argument. Fields omitted from the set() call remain untouched. -------------------------------------------------------------------------------- /docs/firestore/reference/Settings.md: -------------------------------------------------------------------------------- 1 | # Settings 2 | 3 | Specifies custom configurations for your Cloud Firestore instance. You must set these before invoking any other methods. 4 | 5 | ## Properties 6 | 7 | ### host 8 | [method]host returns nullable boolean;[/method] 9 | 10 | The hostname to connect to. 11 | 12 | ### persistence 13 | [method]persistence returns nullable boolean;[/method] 14 | 15 | Whether to use persistence. 16 | 17 | ### ssl 18 | [method]ssl returns nullable boolean;[/method] 19 | 20 | Whether to use SSL when connecting. 21 | 22 | ## Unsupported Properties 23 | 24 | ### timestampsInSnapshots 25 | [method]timestampsInSnapshots returns nullable boolean;[/method] 26 | 27 | !> Currently will have no effect, as it is not supported on both iOS and Android. 28 | 29 | Enables the use of `Timestamp`s for timestamp fields in `DocumentSnapshot`s. 30 | 31 | Currently, Firestore returns timestamp fields as `Date` but `Date` only supports millisecond precision, which leads to truncation and causes unexpected behavior when using a timestamp from a snapshot as a part of a subsequent query. 32 | 33 | Setting `timestampsInSnapshots` to true will cause Firestore to return `Timestamp` values instead of `Date` avoiding this kind of problem. To make this work you must also change any code that uses `Date` to use `Timestamp` instead. 34 | 35 | NOTE: in the future `timestampsInSnapshots: true` will become the default and this option will be removed so you should change your code to use Timestamp now and opt-in to this new behavior as soon as you can. -------------------------------------------------------------------------------- /docs/firestore/reference/SnapshotError.md: -------------------------------------------------------------------------------- 1 | # SnapshotError 2 | 3 | SnapshotError represents an Error returned from either [ref firestore.DocumentReference#onSnapshot] or [ref firestore.CollectionReference#onSnapshot]. 4 | 5 | ```ts 6 | type SnapshotError implements NativeError extends Error { 7 | +code: string; 8 | +message: string; 9 | +path: string; 10 | +appName: string; 11 | +nativeErrorCode: string | number; 12 | +nativeErrorMessage: string; 13 | } 14 | ``` 15 | 16 | ---- 17 | 18 | ## Properties 19 | 20 | ### code 21 | [method]code returns string;[/method] 22 | 23 | A standard Firebase Web SDK Firestore error code. 24 | 25 | ### message 26 | [method]message returns string;[/method] 27 | 28 | A standard Firebase Web SDK Firestore error message. 29 | 30 | ### path 31 | [method]path returns string;[/method] 32 | 33 | The path to the collection or document the error occurred on. 34 | 35 | ### appName 36 | [method]appName returns string;[/method] 37 | 38 | The app name for the instance the error occurred on, e.g. `[DEFAULT]`. 39 | 40 | ### nativeErrorCode 41 | [method]path returns string | number;[/method] 42 | 43 | The native error code generated by the native Firebase SDK for Android or iOS. 44 | 45 | ### nativeErrorMessage 46 | [method]path returns string;[/method] 47 | 48 | The native error message generated by the native Firebase SDK for Android or iOS. 49 | -------------------------------------------------------------------------------- /docs/firestore/reference/SnapshotMetadata.md: -------------------------------------------------------------------------------- 1 | # SnapshotMetadata 2 | 3 | Metadata about a snapshot, describing the state of the snapshot. 4 | 5 | ## Properties 6 | 7 | ### fromCache 8 | [method]fromCache returns boolean;[/method] 9 | 10 | True if the snapshot was created from cached data rather than guaranteed up-to-date server data. If your listener has opted into metadata updates (via [ref firestore.MetadataChanges]) you will receive another snapshot with `fromCache` set to false once the client has received up-to-date data from the backend. 11 | 12 | ### hasPendingWrites 13 | [method]hasPendingWrites returns boolean;[/method] 14 | 15 | True if the snapshot includes local writes (`set()` or `update()` calls) that haven't been committed to the backend yet. 16 | 17 | If your listener has opted into metadata updates via [ref firestore.MetadataChanges], you receive another snapshot with `hasPendingWrites` set to false once the writes have been committed to the backend. -------------------------------------------------------------------------------- /docs/firestore/reference/Transaction.md: -------------------------------------------------------------------------------- 1 | # Transaction 2 | 3 | A reference to a transaction. 4 | 5 | The `Transaction` object passed to a transaction's updateFunction provides the methods to read and write data within the transaction context. See `Firestore.runTransaction()`. 6 | 7 | ## Methods 8 | 9 | ### delete 10 | [method]delete(documentRef) returns [ref firestore.Transaction];[/method] 11 | 12 | Deletes the document referred to by the provided `DocumentReference`. 13 | 14 | | Parameter | | 15 | | --------- | ------- | 16 | | documentRef | **[ref firestore.DocumentReference]**
A reference to the document to be deleted.
Value must not be null. | 17 | 18 | ### get 19 | [method]get(documentRef) returns Promise containing [ref firestore.DocumentSnapshot];[/method] 20 | 21 | Reads the document referenced by the provided `DocumentReference`. 22 | 23 | | Parameter | | 24 | | --------- | ------- | 25 | | documentRef | **[ref firestore.DocumentReference]**
A reference to the document to be retrieved.
Value must not be null. | 26 | 27 | ### set 28 | [method]set(documentRef, data, options) returns Promise containing [ref firestore.Transaction];[/method] 29 | 30 | Writes to the document referred to by the provided `DocumentReference`. If the document does not exist yet, it will be created. If you pass options, the provided data can be merged into the existing document. 31 | 32 | | Parameter | | 33 | | --------- | ------- | 34 | | documentRef | **[ref firestore.DocumentReference]**
A reference to the document to be created.
Value must not be null. | 35 | | data | **Object**
An object of the fields and values for the document.
Value must not be null. | 36 | | options | **[ref firestore.SetOptions]** (optional)
An object to configure the set behavior. Pass **{merge: true}** to only replace the values specified in the data argument. Fields omitted will remain untouched. | 37 | 38 | ### update 39 | [method]update(documentRef, ...var_args) returns [ref firestore.Transaction];[/method] 40 | 41 | Updates fields in the document referred to by this DocumentReference. The update will fail if applied to a document that does not exist. 42 | 43 | Nested fields can be updated by providing dot-separated field path strings or by providing FieldPath objects. 44 | 45 | | Parameter | | 46 | | --------- | ------- | 47 | | documentRef | **[ref firestore.DocumentReference]**
A reference to the document to be created.
Value must not be null. | 48 | | var_args | **any type**
Either an object containing all of the fields and values to update, or a series of arguments alternating between fields (as string or objects) and values.
Value may be repeated. | 49 | -------------------------------------------------------------------------------- /docs/firestore/reference/WriteBatch.md: -------------------------------------------------------------------------------- 1 | # WriteBatch 2 | 3 | A write batch, used to perform multiple writes as a single atomic unit. 4 | 5 | A WriteBatch object can be acquired by calling the Firestore.batch() function. It provides methods for adding writes to the write batch. None of the writes are committed (or visible locally) until WriteBatch.commit() is called. 6 | 7 | Unlike transactions, write batches are persisted offline and therefore are preferable when you don't need to condition your writes on read data. 8 | 9 | ## Methods 10 | 11 | ### commit 12 | [method]commit() returns Promise containing void;[/method] 13 | 14 | Commits all of the writes in this write batch as a single atomic unit. 15 | 16 | Returns a promise that resolves once all of the writes in the batch have been successfully written to the backend as an atomic unit. Note that it won't resolve while you're offline. 17 | 18 | ### delete 19 | [method]delete(documentRef) returns [ref firestore.WriteBatch];[/method] 20 | 21 | Deletes the document referred to by the provided DocumentReference. 22 | 23 | | Parameter | | 24 | | --------- | ------- | 25 | | documentRef | **[ref firestore.DocumentReference]**
A reference to the document to be deleted.
Value must not be null. | 26 | 27 | ### set 28 | [method]set(documentRef, data, options) returns [ref firestore.WriteBatch];[/method] 29 | 30 | Writes to the document referred to by the provided DocumentReference. If the document does not exist yet, it will be created. If you pass options, the provided data can be merged into the existing document. 31 | 32 | Returns this WriteBatch instance. Used for chaining method calls. 33 | 34 | | Parameter | | 35 | | --------- | ------- | 36 | | documentRef | **[ref firestore.DocumentReference]**
A reference to the document to be created.
Value must not be null. | 37 | | data | **Object**
An object of the fields and values for the document.
Value must not be null. | 38 | | options | **[ref firestore.SetOptions]** (optional)
An object to configure the set behavior. Pass `{merge: true}` to only replace the values specified in the data argument. Fields omitted will remain untouched.
Value must not be null. | 39 | 40 | ### update 41 | [method]update(documentRef, ...var_args) returns [ref firestore.WriteBatch];[/method] 42 | 43 | Updates fields in the document referred to by this DocumentReference. The update will fail if applied to a document that does not exist. 44 | 45 | Nested fields can be updated by providing dot-separated field path strings or by providing FieldPath objects. 46 | 47 | | Parameter | | 48 | | --------- | ------- | 49 | | documentRef | **[ref firestore.DocumentReference]**
A reference to the document to be created.
Value must not be null. | 50 | | var_args | **any type**
Either an object containing all of the fields and values to update, or a series of arguments alternating between fields (as string or objects) and values.
Value may be repeated. | 51 | -------------------------------------------------------------------------------- /docs/firestore/reference/firestore.md: -------------------------------------------------------------------------------- 1 | # Firestore 2 | 3 | The Firebase Firestore service interface. 4 | 5 | Do not call this constructor directly. Instead, use `firebase.firestore()`. 6 | 7 | > Please note that Persistence (offline support) is enabled by default with Firestore on iOS and Android. 8 | 9 | ## Properties 10 | 11 | ### app 12 | [method]app return [ref core.App];[/method] 13 | 14 | The app associated with this Firestore service instance. 15 | 16 | ## Methods 17 | 18 | ### batch 19 | [method]batch() returns [ref firestore.WriteBatch];[/method] 20 | 21 | Creates a write batch, used for performing multiple writes as a single atomic operation. 22 | 23 | ### collection 24 | [method]collection(collectionPath) returns [ref firestore.CollectionReference];[/method] 25 | 26 | Gets a slash-separated path to a collection. 27 | 28 | | Parameter | | 29 | | --------- | ------- | 30 | | collectionPath | **string**
A slash-separated path to a collection. | 31 | 32 | ### disableNetwork 33 | [method]disableNetwork() returns Promise containing void;[/method] 34 | 35 | Disables network usage for this instance. It can be re-enabled via `enableNetwork()`. While the network is disabled, any snapshot listeners or get() calls will return results from cache, and any write operations will be queued until the network is restored. 36 | 37 | ### doc 38 | [method]doc(documentPath) returns [ref firestore.DocumentReference];[/method] 39 | 40 | Gets a DocumentReference instance that refers to the document at the specified path. 41 | 42 | | Parameter | | 43 | | --------- | ------- | 44 | | documentPath | **string**
A slash-separated path to a document. | 45 | 46 | ### enableNetwork 47 | [method]enableNetwork() returns Promise containing void;[/method] 48 | 49 | Re-enables use of the network for this Firestore instance after a prior call to `disableNetwork()`. 50 | 51 | ### runTransaction 52 | [method]runTransaction(updateFunction) returns Promise;[/method] 53 | 54 | Executes the given updateFunction and then attempts to commit the changes applied within the transaction. If any document read within the transaction has changed, Cloud Firestore retries the updateFunction. If it fails to commit after 5 attempts, the transaction fails. 55 | 56 | > For more information on transactions and examples see our [transactions section](version /firestore/transactions) of the docs. 57 | 58 | | Parameter | | 59 | | --------- | ------- | 60 | | updateFunction | **function**(non-null [ref firestore.Transaction])
The function to execute within the transaction context. | 61 | 62 | 63 | ### settings 64 | 65 | [method]settings(settings) returns Promise containing void;[/method] 66 | 67 | Specifies custom settings to be used to configure the Firestore instance. Must be set before invoking any other methods. 68 | 69 | | Parameter | | 70 | | --------- | ------- | 71 | | settings | **[ref firestore.Settings]**
The settings for your Cloud Firestore instance.
Value must not be null. | 72 | 73 | ## Static Methods 74 | 75 | ### setLogLevel 76 | [method]setLogLevel(logLevel) returns void;[/method] 77 | 78 | Sets the verbosity of Cloud Firestore logs (debug, error, or silent). 79 | 80 | | Parameter | | 81 | | --------- | ------- | 82 | | logLevel | **string**
The verbosity you set for activity and error logging. Can be any of the following values:
- **debug** for the most verbose logging level, primarily for debugging.
- **error** to log errors only.
- **silent** to turn off logging.| 83 | 84 | [collapse Example] 85 | ```js 86 | firebase.firestore.setLogLevel('debug'); 87 | ``` 88 | [/collapse] 89 | 90 | ## Unsupported Methods 91 | 92 | ### enablePersistence 93 | 94 | Use `firebase.firestore().settings()` instead. 95 | -------------------------------------------------------------------------------- /docs/functions/android.md: -------------------------------------------------------------------------------- 1 | # Android Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup). 4 | 5 | ## Add the dependency 6 | 7 | Add the Firebase Functions dependency to `android/app/build.gradle`: 8 | 9 | ```groovy 10 | dependencies { 11 | // ... 12 | implementation "com.google.firebase:firebase-functions:{{ android.firebase.functions }}" 13 | } 14 | ``` 15 | 16 | ## Install the RNFirebase Functions package 17 | 18 | Add the `RNFirebaseFunctionsPackage` to your `android/app/src/main/java/com/[app name]/MainApplication.java`: 19 | 20 | ```java 21 | // ... 22 | import io.invertase.firebase.RNFirebasePackage; 23 | import io.invertase.firebase.functions.RNFirebaseFunctionsPackage; // <-- Add this line 24 | 25 | public class MainApplication extends Application implements ReactApplication { 26 | // ... 27 | 28 | @Override 29 | protected List getPackages() { 30 | return Arrays.asList( 31 | new MainReactPackage(), 32 | new RNFirebasePackage(), 33 | new RNFirebaseFunctionsPackage() // <-- Add this line 34 | ); 35 | } 36 | }; 37 | // ... 38 | } 39 | ``` 40 | -------------------------------------------------------------------------------- /docs/functions/ios.md: -------------------------------------------------------------------------------- 1 | # iOS Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup). 4 | 5 | ## Add the pod 6 | 7 | Add the following to your `Podfile`: 8 | 9 | ```ruby 10 | pod 'Firebase/Functions', '~> {{ ios.firebase.functions }}' 11 | ``` 12 | 13 | Run `pod update`. 14 | -------------------------------------------------------------------------------- /docs/functions/reference/HttpsError.md: -------------------------------------------------------------------------------- 1 | # HttpsError 2 | 3 | ```ts 4 | type HttpsError implements Error { 5 | +details: ?any; 6 | +code: FunctionsErrorCode; 7 | } 8 | ``` 9 | 10 | ---- 11 | 12 | ## Properties 13 | 14 | ### code 15 | [method]code returns [FunctionsErrorCode](#Types);[/method] 16 | 17 | A standard error code as returned by the first arg of your thrown error on cloud functions. 18 | 19 | [collapse Cloud Function Example] 20 | ```js 21 | // inside your cloud function 22 | throw new functions.https.HttpsError( 23 | 'cancelled', // <---- THIS 24 | 'Your error message goes here.', 25 | { foo: 'bar' }, 26 | ); 27 | ``` 28 | [/collapse] 29 | 30 | 31 | ---- 32 | 33 | ### message 34 | [method]message returns string;[/method] 35 | 36 | Your error message as thrown in your cloud function. 37 | 38 | [collapse Cloud Function Example] 39 | ```js 40 | // inside your cloud function 41 | throw new functions.https.HttpsError( 42 | 'cancelled', 43 | 'Your error message goes here.', // <---- THIS 44 | { foo: 'bar' }, 45 | ); 46 | ``` 47 | [/collapse] 48 | 49 | ---- 50 | 51 | ### details 52 | [method]details returns ?any;[/method] 53 | 54 | Extra data thrown with your error on your cloud function. 55 | 56 | [collapse Cloud Function Example] 57 | ```js 58 | // inside your cloud function 59 | throw new functions.https.HttpsError( 60 | 'cancelled', 61 | 'Your error message goes here.', 62 | { foo: 'bar' }, // <---- THIS 63 | ); 64 | ``` 65 | [/collapse] 66 | 67 | 68 | ---- 69 | 70 | ## Types 71 | 72 | ### FunctionsErrorCode 73 | 74 | Statics for these also exist for equality comparisons e.g. `firebase.functions.HttpsErrorCode.CANCELLED` outputs `cancelled`; 75 | 76 | ```ts 77 | type FunctionsErrorCode = 78 | | 'ok' 79 | | 'cancelled' 80 | | 'unknown' 81 | | 'invalid-argument' 82 | | 'deadline-exceeded' 83 | | 'not-found' 84 | | 'already-exists' 85 | | 'permission-denied' 86 | | 'resource-exhausted' 87 | | 'failed-precondition' 88 | | 'aborted' 89 | | 'out-of-range' 90 | | 'unimplemented' 91 | | 'internal' 92 | | 'unavailable' 93 | | 'data-loss' 94 | | 'unauthenticated'; 95 | ``` -------------------------------------------------------------------------------- /docs/functions/reference/functions.md: -------------------------------------------------------------------------------- 1 | # Functions 2 | 3 | ``` 4 | firebase.functions 5 | ``` 6 | 7 | ## Reference Material 8 | 9 | - [Official Firebase Functions Documentation](https://firebase.google.com/docs/functions/callable) 10 | - [RNFirebase - Functions Test Suite](https://github.com/invertase/react-native-firebase/blob/master/bridge/e2e/functions/functions.e2e.js) 11 | - [RNFirebase - Test Cloud Function](https://github.com/invertase/react-native-firebase/tree/master/bridge/functions) 12 | 13 | ## Properties 14 | 15 | ### app 16 | [method]app return [ref core.App];[/method] 17 | 18 | The app associated with this Firestore service instance. 19 | 20 | ## Methods 21 | 22 | The following methods are accessed via the Functions instance `firebase.functions()`. 23 | 24 | ### constructor 25 | [method]functions(appOrRegion?: [ref core.App] | string, region?: string) returns this;[/method] 26 | 27 | | Parameter | | 28 | | --------- | ------- | 29 | | appOrRegion | **[ref core.App] | string**
An App instance, ID or Firebase region name | 30 | | region | **string**
A Firebase region, defaults to us-central1 | 31 | 32 | ### httpsCallable 33 | [method]httpsCallable(name: string) returns (data?: any): [HttpsCallablePromise](#Types) => {};[/method] 34 | 35 | Gets an `HttpsCallable` instance that refers to the function with the given name. 36 | 37 | | Parameter | | 38 | | --------- | ------- | 39 | | name | **string**
The name of the https callable function. | 40 | 41 | 42 | [collapse RNFirebase Client SDK Example] 43 | ```js 44 | const httpsCallable = firebase.functions().httpsCallable('myFooBarFn'); 45 | 46 | httpsCallable({ some: 'args' }) 47 | .then(({ data }) => { 48 | console.log(data.someResponse); // hello world 49 | }) 50 | .catch(httpsError => { 51 | console.log(httpsError.code); // invalid-argument 52 | console.log(httpsError.message); // Your error message goes here 53 | console.log(httpsError.details.foo); // bar 54 | }) 55 | ``` 56 | [/collapse] 57 | 58 | [collapse Firebase Cloud Function Example] 59 | ```js 60 | const functions = require('firebase-functions'); 61 | 62 | exports.myFooBarFn = functions.https.onCall(data => { 63 | console.log(data.some); 64 | 65 | if (!data.some) { 66 | throw new functions.https.HttpsError( 67 | 'invalid-argument', // code 68 | 'Your error message goes here', // message 69 | { foo: 'bar' }, // details - optional and can be anything JSON serializable 70 | ); 71 | } 72 | 73 | return { someResponse: 'hello world' }; 74 | }); 75 | ``` 76 | [/collapse] 77 | 78 | ### useFunctionsEmulator 79 | [method]useFunctionsEmulator(origin: string) returns Promise;[/method] 80 | 81 | Changes this instance to point to a Cloud Functions emulator running locally. 82 | 83 | | Parameter | | 84 | | --------- | ------- | 85 | | origin | **string**
The origin string of the local emulator started via [firebase tools](https://firebase.google.com/docs/functions/local-emulator) | 86 | 87 | 88 | ## Types 89 | 90 | ### HttpsCallableResult 91 | 92 | ```ts 93 | type HttpsCallableResult = { 94 | data: Object, 95 | }; 96 | ``` 97 | 98 | ### HttpsCallablePromise 99 | 100 | [method] type HttpsCallablePromise = Promise| Promise<[ref functions.HttpsError]>; [/method] 101 | -------------------------------------------------------------------------------- /docs/iid/android.md: -------------------------------------------------------------------------------- 1 | # Android Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup). 4 | 5 | ## Install the RNFirebase Instance ID package 6 | 7 | Add the `RNFirebaseInstanceIdPackage` to your `android/app/src/main/java/com/[app name]/MainApplication.java`: 8 | 9 | ```java 10 | // ... 11 | import io.invertase.firebase.RNFirebasePackage; 12 | import io.invertase.firebase.instanceid.RNFirebaseInstanceIdPackage; // <-- Add this line 13 | 14 | public class MainApplication extends Application implements ReactApplication { 15 | // ... 16 | 17 | @Override 18 | protected List getPackages() { 19 | return Arrays.asList( 20 | new MainReactPackage(), 21 | new RNFirebasePackage(), 22 | new RNFirebaseInstanceIdPackage() // <-- Add this line 23 | ); 24 | } 25 | }; 26 | // ... 27 | } 28 | ``` 29 | -------------------------------------------------------------------------------- /docs/iid/ios.md: -------------------------------------------------------------------------------- 1 | # iOS Installation 2 | 3 | Ensure you have followed the [initial setup guide](version /installation/initial-setup). 4 | 5 | That is it, Instance ID doesn't need anything else to work. 6 | -------------------------------------------------------------------------------- /docs/iid/reference/iid.md: -------------------------------------------------------------------------------- 1 | # Instance ID 2 | 3 | ``` 4 | firebase.iid 5 | ``` 6 | 7 | ## Methods 8 | 9 | The following methods are accessed via the Instance ID instance: `firebase.iid()`. 10 | 11 | ### get 12 | [method]get() returns Promise containing string;[/method] 13 | 14 | Get the current Instance ID. 15 | 16 | ### delete 17 | [method]delete() returns Promise containing void;[/method] 18 | 19 | Delete the current Instance ID. 20 | 21 | ### getToken 22 | [method]getToken(authorizedEntity?: string, scope?: string) returns Promise containing string;[/method] 23 | 24 | Get a token that authorizes an Entity to perform an action on behalf of the application identified by Instance ID. 25 | 26 | Returns a promise that resolves with the token if successful, otherwise rejects with an error. 27 | 28 | | Parameter | | 29 | | --------- | ------- | 30 | | authorizedEntity | Entity authorized by the token.
**Defaults to:** `firebase.iid().app.options.messagingSenderId;` | 31 | | scope | Action authorized for authorizedEntity.
**Defaults to:** `*` | 32 | 33 | ### deleteToken 34 | [method]deleteToken(authorizedEntity?: string, scope?: string) returns Promise containing void;[/method] 35 | 36 | Revokes access to a scope (action) for an entity previously authorized by getToken(). 37 | 38 | Returns a promise that resolves with null if successful, otherwise rejects with an error. 39 | 40 | | Parameter | | 41 | | --------- | ------- | 42 | | authorizedEntity | Entity authorized by the token.
**Defaults to:** `firebase.iid().app.options.messagingSenderId;` | 43 | | scope | Action authorized for authorizedEntity.
**Defaults to:** `*` | 44 | -------------------------------------------------------------------------------- /docs/installation/basic-kit.md: -------------------------------------------------------------------------------- 1 | ## Basic Starter Kit 2 | 3 | A basic react native app with [`react-native-firebase`](https://github.com/invertase/react-native-firebase) pre-integrated to get you started quickly. 4 | 5 | ## Getting Started 6 | 7 | > If you're only developing for one platform you can ignore the steps below that are tagged with the platform you don't require. 8 | 9 | ### 1) Clone & Install Dependencies 10 | 11 | - 1.1) Clone the starter kit repo: 12 | 13 | ```bash 14 | git clone https://github.com/invertase/react-native-firebase-starter.git 15 | ``` 16 | 17 | - 1.2) `cd react-native-firebase-starter` - cd into your newly created project directory. 18 | - 1.3) Install packages with your package manager of choice - i.e run `yarn` or `npm install` 19 | - 1.4) **[iOS]** `cd ios` and run `pod install` - if you don't have CocoaPods you can follow [these instructions](https://guides.cocoapods.org/using/getting-started.html#getting-started) to install it. 20 | - 1.5) **[Android]** No additional steps for android here. 21 | 22 | ### 2) Rename Project 23 | 24 | ?> **You will need to be running Node verison 7.6 or greater for the rename functionality to work** 25 | 26 | - 2.0) **[iOS]** `cd ..` to return to the root directory of the project 27 | - 2.1) `npm run rename` - you'll be prompted to enter a project name and company name 28 | - 2.2) Note down the package name value - you'll need this when setting up your Firebase project 29 | 30 | ### 3) Add `Google Services` files (plist & JSON) 31 | 32 | - 3.1) **[iOS]** Follow the `add firebase to your app` instructions [here](https://firebase.google.com/docs/ios/setup#add_firebase_to_your_app) to generate your `GoogleService-Info.plist` file if you haven't done so already - use the package name generated previously as your `iOS bundle ID`. 33 | - 3.2) **[iOS]** Place this file in the `ios/` directory of your project. 34 | - 3.3) **[Android]** Follow the `manually add firebase` to your app instructions [here](https://firebase.google.com/docs/android/setup#manually_add_firebase) to generate your `google-services.json` file if you haven't done so already - use the package name generated previously as your `Android package name`. 35 | - 3.4) **[Android]** Place this file in the `android/app/` directory of your project. 36 | 37 | ### 4) Start your app 38 | 39 | - 4.1) Start the react native packager, run `yarn run start` or `npm start` from the root of your project. 40 | - 4.2) **[iOS]** Build and run the iOS app, run `npm run ios` or `yarn run ios` from the root of your project. The first build will take some time. This will automatically start up a simulator also for you on a successful build if one wasn't already started. 41 | - 4.3) **[Android]** If you haven't already got an android device attached/emulator running then you'll need to get one running (make sure the emulator is with Google Play / APIs). When ready run `npm run android` or `yarn run android` from the root of your project. 42 | 43 | If all has gone well you'll see an initial screen like the one below. 44 | 45 | ## Screenshots 46 | 47 | ![preview](https://i.imgur.com/4lG4HuS.png) 48 | 49 | ## Links 50 | 51 | - [Starter Kit - GitHub](https://github.com/invertase/react-native-firebase-starter) 52 | -------------------------------------------------------------------------------- /docs/installation/javascript.md: -------------------------------------------------------------------------------- 1 | # JavaScript Installation/Usage 2 | 3 | Once RNFirebase & Firebase has been setup, you can now use the library within your JavaScript like any other node module. 4 | 5 | ## Import the module 6 | 7 | ```javascript 8 | import firebase from 'react-native-firebase'; 9 | ``` 10 | 11 | As the default app is pre-initialized natively there is no need to call initializeApp for the default app instance. Just import and go: 12 | 13 | ```javascript 14 | import firebase from 'react-native-firebase'; 15 | 16 | firebase.auth().signInAnonymously() 17 | .then((user) => { 18 | console.log(user.isAnonymous); 19 | }); 20 | ``` 21 | 22 | ## Multiple app instances 23 | 24 | React Native Firebase supports multiple app instances. For more information see the [initializing multiple apps documentation](version /core/initialize-apps). 25 | -------------------------------------------------------------------------------- /docs/invites/android.md: -------------------------------------------------------------------------------- 1 | # Android Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup) and the [dynamic links setup guide](version /links/android). 4 | 5 | ### Find your SHA fingerprint 6 | Ensure you have SHA fingerprint added in your Firebase console, under the `General settings` tab otherwise you will a receive a `Message failed to send` error. 7 | 8 | E.g. for debug: run keytool command in your terminal 9 | 10 | ```bash 11 | $ keytool -exportcert -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore 12 | ``` 13 | 14 | ## Install the RNFirebase Invites package 15 | 16 | Add the `RNFirebaseInvitesPackage` to your `android/app/src/main/java/com/[app name]/MainApplication.java`: 17 | 18 | ```java 19 | // ... 20 | import io.invertase.firebase.RNFirebasePackage; 21 | import io.invertase.firebase.invites.RNFirebaseInvitesPackage; // <-- Add this line 22 | 23 | public class MainApplication extends Application implements ReactApplication { 24 | // ... 25 | 26 | @Override 27 | protected List getPackages() { 28 | return Arrays.asList( 29 | new MainReactPackage(), 30 | new RNFirebasePackage(), 31 | new RNFirebaseInvitesPackage() // <-- Add this line 32 | ); 33 | } 34 | }; 35 | // ... 36 | } 37 | ``` 38 | -------------------------------------------------------------------------------- /docs/invites/ios.md: -------------------------------------------------------------------------------- 1 | # iOS Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup) and the [dynamic links setup guide](version /links/ios). 4 | 5 | > On iOS, users must be signed in with their Google Accounts before they can send invitations. 6 | 7 | ## Add the pod 8 | 9 | Add the following to your `Podfile`: 10 | 11 | ```ruby 12 | pod 'Firebase/Invites', '~> {{ ios.firebase.invites }}' 13 | ``` 14 | 15 | Run `pod update`. 16 | 17 | ## Update `AppDelegate.m` 18 | 19 | Replace the `RNFirebaseLinks` import with `RNFirebaseInvites` at the top of your `ios/[App Name]/AppDelegate.m`: 20 | 21 | ```objectivec 22 | #import "RNFirebaseInvites.h" 23 | ``` 24 | 25 | Replace the `RNFirebaseLinks` methods with `RNFirebaseInvites` as follows: 26 | 27 | ```objectivec 28 | - (BOOL)application:(UIApplication *)application 29 | openURL:(NSURL *)url 30 | options:(NSDictionary *)options { 31 | return [[RNFirebaseInvites instance] application:application openURL:url options:options]; 32 | } 33 | 34 | - (BOOL)application:(UIApplication *)application 35 | continueUserActivity:(NSUserActivity *)userActivity 36 | restorationHandler:(void (^)(NSArray *))restorationHandler { 37 | return [[RNFirebaseInvites instance] application:application continueUserActivity:userActivity restorationHandler:restorationHandler]; 38 | } 39 | ``` 40 | 41 | ## Setup Google Sign-In 42 | 43 | > Take a look at our [social auth guide](version /auth/social-auth) for how to use Google Sign In with `react-native-firebase`. 44 | 45 | To add custom URL schemes to your Xcode project see [this quick tutorial](https://codorial.com/g/invertase/tutorials/ios-xcode-custom-url-scheme/) - the `URL Schemes` is usually your reversed client ID. To find this value, open your `GoogleService-Info.plist` configuration file, and look for the `REVERSED_CLIENT_ID` key. Copy the value of that key, and paste it into the URL Schemes box on the configuration page. 46 | -------------------------------------------------------------------------------- /docs/invites/reference/AndroidInvitation.md: -------------------------------------------------------------------------------- 1 | # Invitation 2 | 3 | Android specific invitation settings. 4 | 5 | ## Methods 6 | 7 | ### setAdditionalReferralParameters 8 | [method]setAdditionalReferralParameters(additionalReferralParameters) returns [ref invites.Invitation];[/method] 9 | 10 | Adds query parameters to the play store referral URL when the app needs additional referral parameters for other application component referrals. These parameters are added to the referral URL sent from the play store and are available to be processed by other application components, for example Google Analytics. The parameters are set as name, value pairs that will be set as query parameter name and value on the referral URL. 11 | 12 | | Parameter | | 13 | | --------- | ------- | 14 | | additionalReferralParameters | **Object**
Referral parameters defined as name value pairs. | 15 | 16 | ### setEmailHtmlContent 17 | [method]setEmailHtmlContent(emailHtmlContent) returns [ref invites.Invitation];[/method] 18 | 19 | Sets the HTML-formatted (UTF-8 encoded, no JavaScript) content for invites sent through email. If set, this will be sent instead of the default email. 20 | 21 | emailHtmlContent must be valid HTML for standard email processing. The pattern %%APPINVITE_LINK_PLACEHOLDER%% should be embedded in your htmlContent and will be replaced with the invitation URL. This url is a link that will launch the app if already installed or take the user to the appropriate app store if not. In both cases the deep link will be available if provided using setDeepLink(Uri). 22 | 23 | | Parameter | | 24 | | --------- | ------- | 25 | | emailHtmlContent | **number**
The html-formatted content for the email. | 26 | 27 | ### setEmailSubject 28 | [method]setEmailSubject(emailSubject) returns [ref invites.Invitation];[/method] 29 | 30 | Sets the subject for invites sent by email. 31 | 32 | | Parameter | | 33 | | --------- | ------- | 34 | | emailSubject | **string**
The subject for the email. | 35 | 36 | ### setGoogleAnalyticsTrackingId 37 | [method]setGoogleAnalyticsTrackingId(googleAnalyticsTrackingId) returns [ref invites.Invitation];[/method] 38 | 39 | Sets the Google Analytics Tracking id. The tracking id should be created for the calling application under Google Analytics. See more about how to get a tracking id . The tracking id is recommended so that invitations sent from the calling application are available in Google Analytics. 40 | 41 | | Parameter | | 42 | | --------- | ------- | 43 | | googleAnalyticsTrackingId | **string**
String of the form UA-xxxx-y | 44 | -------------------------------------------------------------------------------- /docs/invites/reference/Invitation.md: -------------------------------------------------------------------------------- 1 | # Invitation 2 | 3 | ``` 4 | firebase.invites.Invitation 5 | ``` 6 | 7 | ### Constructor 8 | [method]new firebase.invites.Invitation(title, message);[/method] 9 | 10 | Create an invitation. 11 | 12 | To send an Invitation, first populate it by using the `setX` methods described below, then pass it to `firebase.invites().sendInvitation(invitation)`; 13 | 14 | | Parameter | | 15 | | --------- | ------- | 16 | | title | **string** | 17 | | message | **string** | 18 | 19 | ## Properties 20 | 21 | ### android 22 | [method]android returns nullable [ref invites.AndroidInvitation];[/method] 23 | 24 | Access Android specific invitation methods. 25 | 26 | ## Methods 27 | 28 | ### setAndroidClientId 29 | [method]setAndroidClientId(androidClientId) returns [ref invites.Invitation];[/method] 30 | 31 | Set the Android target client ID for the invitation. 32 | 33 | | Parameter | | 34 | | --------- | ------- | 35 | | androidClientId | **string**
The android client ID. | 36 | 37 | ### setAndroidMinimumVersionCode 38 | [method]setAndroidMinimumVersionCode(androidMinimumVersionCode) returns [ref invites.Invitation];[/method] 39 | 40 | Sets the minimum version of the android app installed on the receiving device. If this minimum version is not installed then the install flow will be triggered. 41 | 42 | | Parameter | | 43 | | --------- | ------- | 44 | | androidMinimumVersionCode | **number**
Minimum version of the android app. | 45 | 46 | ### setCallToActionText 47 | [method]setCallToActionText(callToActionText) returns [ref invites.Invitation];[/method] 48 | 49 | Text shown on the email invitation for the user to accept the invitation. Default install text used if not set. 50 | 51 | | Parameter | | 52 | | --------- | ------- | 53 | | callToActionText | **string**
Text to use on the invitation button. | 54 | 55 | ### setCustomImage 56 | [method]setCustomImage(customImage) returns [ref invites.Invitation];[/method] 57 | 58 | Sets an image for invitations. 59 | 60 | | Parameter | | 61 | | --------- | ------- | 62 | | customImage | **string**
the image Uri. The Uri is required to be in absolute format. The supported image formats are "jpg", "jpeg" and "png". | 63 | 64 | ### setDeepLink 65 | [method]setDeepLink(deepLink) returns [ref invites.Invitation];[/method] 66 | 67 | Sets the deep link that is made available to the app when opened from the invitation. This deep link is made available both to a newly installed application and an already installed application. The deep link can be sent to Android and other platforms so should be formatted to support deep links across platforms. 68 | 69 | | Parameter | | 70 | | --------- | ------- | 71 | | deepLink | **string**
The app deep link. | 72 | 73 | ### setIOSClientId 74 | [method]setIOSClientId(iosClientId) returns [ref invites.Invitation];[/method] 75 | 76 | Set the iOS target client ID for the invitation. 77 | 78 | | Parameter | | 79 | | --------- | ------- | 80 | | iosClientId | **string**
The iOS client ID. | 81 | -------------------------------------------------------------------------------- /docs/invites/reference/InvitationOpen.md: -------------------------------------------------------------------------------- 1 | # InvitationOpen 2 | 3 | Object giving information about the invitation that was opened. 4 | 5 | ## Properties 6 | 7 | ### deepLink 8 | [method]deepLink returns string;[/method] 9 | 10 | The deepLink that should be opened within the application. 11 | 12 | ### invitationId 13 | [method]invitationId returns string;[/method] 14 | 15 | The ID of the invitation that was opened. 16 | -------------------------------------------------------------------------------- /docs/invites/reference/Invites.md: -------------------------------------------------------------------------------- 1 | # Dynamic Links 2 | 3 | [Firebase Invites](https://firebase.google.com/docs/invites/) are an out-of-the-box solution for app referrals and sharing via email or SMS. 4 | 5 | ## Methods 6 | 7 | The following methods are accessed via the default app's Invites instance `firebase.invites()`. 8 | 9 | ### getInitialInvitation 10 | [method]getInitialInvitation() returns Promise containing nullable [ref invites.InvitationOpen];[/method] 11 | 12 | Returns the Invitation that the app has been launched from. If the app was not launched from an Invitation the return value will be null. 13 | 14 | [collapse Example] 15 | ```javascript 16 | firebase.invites() 17 | .getInitialInvitation() 18 | .then((invitation) => { 19 | if (invitation) { 20 | // app opened from an Invitation 21 | } else { 22 | // app NOT opened from an invitation 23 | } 24 | }); 25 | ``` 26 | [/collapse] 27 | 28 | ### onInvitation 29 | [method]onInvitation(listener) returns Function;[/method] 30 | 31 | When an invitation is opened whilst the app is open, the listener is invoked with the invitation. 32 | 33 | Returns an unsubscribe function. 34 | 35 | Parameter | | 36 | | --------- | ------- | 37 | | listener | **function([ref invitations.InvitationOpen])**
This function is called when an invitation is opened. | 38 | 39 | [collapse Example] 40 | ```javascript 41 | // subscribe 42 | const unsubscribe = firebase.invites().onInvitation((invitation) => { 43 | // ... 44 | }); 45 | 46 | // unsubscribe 47 | unsubscribe(); 48 | ``` 49 | [/collapse] 50 | 51 | ### sendInvitation 52 | [method]sendInvitation(invitation) returns Promise containing Array of string;[/method] 53 | 54 | !> on iOS, the user must be signed in with their Google Account for this to work. 55 | 56 | Displays the invitation dialog which allows the user to select who received the invitation. 57 | 58 | Returns a promise that resolves with the created invitation IDs if the invitation is sent, otherwise it is rejected with an error. 59 | 60 | | Parameter | | 61 | | --------- | ------- | 62 | | invitation | **[ref invitations.Invitation]**
The invitation to send. | 63 | 64 | [collapse Example] 65 | ```javascript 66 | // create invitation 67 | const invitation = new firebase.invites.Invitation('Title', 'Message'); 68 | invitation.setDeepLink('https://je786.page.link/testing'); 69 | // send the invitation 70 | const invitationIds = await firebase.invites().sendInvitation(invitation); 71 | // use the invitationIds as you see fit 72 | ``` 73 | [/collapse] 74 | -------------------------------------------------------------------------------- /docs/links/android.md: -------------------------------------------------------------------------------- 1 | # Android Installation 2 | 3 | ## Add the dependency 4 | 5 | Add the Firebase Dynamic Links / Invites dependency to your `android/app/build.gradle` file: 6 | 7 | ```groovy 8 | dependencies { 9 | // ... 10 | implementation "com.google.firebase:firebase-invites:{{ android.firebase.invites }}" 11 | } 12 | ``` 13 | 14 | ## Install the RNFirebase Links package 15 | 16 | Add the `RNFirebaseLinksPackage` to your `android/app/src/main/java/com/[app name]/MainApplication.java`: 17 | 18 | ```java 19 | // ... 20 | import io.invertase.firebase.RNFirebasePackage; 21 | import io.invertase.firebase.links.RNFirebaseLinksPackage; // <-- Add this line 22 | 23 | public class MainApplication extends Application implements ReactApplication { 24 | // ... 25 | 26 | @Override 27 | protected List getPackages() { 28 | return Arrays.asList( 29 | new MainReactPackage(), 30 | new RNFirebasePackage(), 31 | new RNFirebaseLinksPackage() // <-- Add this line 32 | ); 33 | } 34 | }; 35 | // ... 36 | } 37 | ``` 38 | 39 | 40 | ## Configure Android Project 41 | 42 | 1. In your [Firebase console](https://console.firebase.google.com/), open the Dynamic Links section. 43 | 1. Accept the terms of service if you are prompted to do so. 44 | 2. Take note of your project's Dynamic Links domain, which is displayed at the top of the Dynamic Links page. You need your project's Dynamic Links domain to programmatically create Dynamic Links. A Dynamic Links domain looks like app_code.page.link. 45 | 46 | ![console](https://firebase.google.com/docs/dynamic-links/images/dynamic-links-domain.png) 47 | 48 | 2. In your `android/app/src/main/AndroidManifest.xml` file, add a new intent filter to the activity that handles deep links for your app (for react-native this is usually the MainActivity), and specify the host and the scheme: 49 | 50 | ```xml 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | ``` 59 | 60 | 3. If you wish to receive the intent in an existing instance of MainActivity, you may set the launchMode of MainActivity to singleTask in AndroidManifest.xml. See [](https://developer.android.com/guide/topics/manifest/activity-element.html) documentation for more information. 61 | 62 | ```xml 63 | 66 | ``` 67 | 68 | > For more information on Analytics for links or Handling Dynamic Links using App Links see the official [Firebase Android SDK docs](https://firebase.google.com/docs/dynamic-links/android/receive#record-analytics) 69 | -------------------------------------------------------------------------------- /docs/links/reference/AnalyticsParameters.md: -------------------------------------------------------------------------------- 1 | # AnalyticsParameters 2 | 3 | Google Analytics specific link settings. 4 | 5 | ## Methods 6 | 7 | ### setCampaign 8 | [method]setCampaign(campaign) returns [ref links.DynamicLink];[/method] 9 | 10 | Sets the campaign name. 11 | 12 | | Parameter | | 13 | | --------- | ------- | 14 | | campaign | **string**
The campaign name; The individual campaign name, slogan, promo code, etc. for a product. | 15 | 16 | ### setContent 17 | [method]setContent(content) returns [ref links.DynamicLink];[/method] 18 | 19 | Sets the campaign content. 20 | 21 | | Parameter | | 22 | | --------- | ------- | 23 | | content | **string**
The campaign content; used for A/B testing and content-targeted ads to differentiate ads or links that point to the same URL. | 24 | 25 | ### setMedium 26 | [method]setMedium(medium) returns [ref links.DynamicLink];[/method] 27 | 28 | Sets the campaign medium. 29 | 30 | | Parameter | | 31 | | --------- | ------- | 32 | | medium | **string**
The campaign medium; used to identify a medium such as email or cost-per-click (cpc). | 33 | 34 | ### setSource 35 | [method]setSource(source) returns [ref links.DynamicLink];[/method] 36 | 37 | Sets the campaign source. 38 | 39 | | Parameter | | 40 | | --------- | ------- | 41 | | source | **string**
The campaign source; used to identify a search engine, newsletter, or other source. | 42 | 43 | ### setTerm 44 | [method]setTerm(term) returns [ref links.DynamicLink];[/method] 45 | 46 | Sets the campaign term. 47 | 48 | | Parameter | | 49 | | --------- | ------- | 50 | | term | **string**
The campaign term; used with paid search to supply the keywords for ads. | 51 | -------------------------------------------------------------------------------- /docs/links/reference/AndroidParameters.md: -------------------------------------------------------------------------------- 1 | # AndroidParameters 2 | 3 | Android specific link settings. 4 | 5 | ## Methods 6 | 7 | ### setFallbackUrl 8 | [method]setFallbackUrl(fallbackUrl) returns [ref links.DynamicLink];[/method] 9 | 10 | Sets the link to open when the app isn't installed. Specify this to do something other than install your app from the Play Store when the app isn't installed, such as open the mobile web version of the content, or display a promotional page for your app. 11 | 12 | | Parameter | | 13 | | --------- | ------- | 14 | | fallbackUrl | **string**
The link to open on Android if the app is not installed. | 15 | 16 | ### setMinimumVersion 17 | [method]setMinimumVersion(minimumVersion) returns [ref links.DynamicLink];[/method] 18 | 19 | Sets the versionCode of the minimum version of your app that can open the link. 20 | 21 | | Parameter | | 22 | | --------- | ------- | 23 | | minimumVersion | **number**
The minimum version. | 24 | 25 | ### setPackageName 26 | [method]setPackageName(packageName) returns [ref links.DynamicLink];[/method] 27 | 28 | Sets the Android package name. 29 | 30 | | Parameter | | 31 | | --------- | ------- | 32 | | packageName | **string**
The package name of the Android app to use to open the link. The app must be connected to your project from the Overview page of the Firebase console. | 33 | -------------------------------------------------------------------------------- /docs/links/reference/DynamicLink.md: -------------------------------------------------------------------------------- 1 | # DynamicLink 2 | 3 | ``` 4 | firebase.links.DynamicLink 5 | ``` 6 | 7 | ### Constructor 8 | [method]new firebase.links.DynamicLink(link, dynamicLinkDomain);[/method] 9 | 10 | Builds a dynamic link. 11 | 12 | To create a DynamicLink, first populate it by using the `setX` methods available on the properties described below, then pass it to `firebase.links().createDynamicLink(link)` or `firebase.links().createShortDynamicLink(link)`; 13 | 14 | | Parameter | | 15 | | --------- | ------- | 16 | | link | **string**
The link the target app will open. You can specify any URL the app can handle, such as a link to the app’s content, or a URL that initiates some app-specific logic such as crediting the user with a coupon, or displaying a specific welcome screen. This link must be a well-formatted URL, be properly URL-encoded, and use the HTTP or HTTPS scheme. | 17 | | dynamicLinkDomain | **string**
The Firebase project’s Dynamic Links domain. You can find this value in the Dynamic Links section of the Firebase console. | 18 | 19 | ## Properties 20 | 21 | ### analytics 22 | [method]analytics returns nullable [ref links.AnalyticsParameters];[/method] 23 | 24 | Access Google Analytics specific link properties. 25 | 26 | ### android 27 | [method]android returns nullable [ref links.AndroidParameters];[/method] 28 | 29 | Access Android specific link properties. 30 | 31 | ### ios 32 | [method]ios returns nullable [ref links.IOSParameters];[/method] 33 | 34 | Access iOS specific link properties. 35 | 36 | ### itunes 37 | [method]itunes returns nullable [ref links.ITunesParameters];[/method] 38 | 39 | Access iTunes Connect specific link properties. 40 | 41 | ### navigation 42 | [method]navigation returns nullable [ref links.NavigationParameters];[/method] 43 | 44 | Access navigation specific link properties. 45 | 46 | ### social 47 | [method]social returns nullable [ref links.SocialParameters];[/method] 48 | 49 | Access social specific link properties. 50 | -------------------------------------------------------------------------------- /docs/links/reference/IOSParameters.md: -------------------------------------------------------------------------------- 1 | # IOSParameters 2 | 3 | Android specific link settings. 4 | 5 | ## Methods 6 | 7 | ### setAppStoreId 8 | [method]setAppStoreId(appStoreId) returns [ref links.DynamicLink];[/method] 9 | 10 | Sets the App Store ID, used to send users to the App Store when the app isn't installed. 11 | 12 | | Parameter | | 13 | | --------- | ------- | 14 | | appStoreId | **string**
The App Store ID. | 15 | 16 | ### setBundleId 17 | [method]setBundleId(bundleId) returns [ref links.DynamicLink];[/method] 18 | 19 | Sets the iOS bundle ID. 20 | 21 | | Parameter | | 22 | | --------- | ------- | 23 | | bundleId | **string**
The parameters ID of the iOS app to use to open the link. The app must be connected to your project from the Overview page of the Firebase console. | 24 | 25 | ### setCustomScheme 26 | [method]setCustomScheme(customScheme) returns [ref links.DynamicLink];[/method] 27 | 28 | Sets the app's custom URL scheme, if defined to be something other than your app's parameters ID. 29 | 30 | | Parameter | | 31 | | --------- | ------- | 32 | | customScheme | **string**
The app's custom URL scheme. | 33 | 34 | ### setFallbackUrl 35 | [method]setFallbackUrl(fallbackUrl) returns [ref links.DynamicLink];[/method] 36 | 37 | Sets the link to open when the app isn't installed. Specify this to do something other than install your app from the App Store when the app isn't installed, such as open the mobile web version of the content, or display a promotional page for your app. 38 | 39 | | Parameter | | 40 | | --------- | ------- | 41 | | fallbackUrl | **string**
The link to open on iOS if the app is not installed. | 42 | 43 | ### setIPadBundleId 44 | [method]setIPadBundleId(iPadBundleId) returns [ref links.DynamicLink];[/method] 45 | 46 | Sets the parameters ID of the iOS app to use on iPads to open the link. The app must be connected to your project from the Overview page of the Firebase console. 47 | 48 | | Parameter | | 49 | | --------- | ------- | 50 | | iPadBundleId | **string**
The iPad parameters ID of the app. | 51 | 52 | ### setIPadFallbackUrl 53 | [method]setIPadFallbackUrl(iPadFallbackUrl) returns [ref links.DynamicLink];[/method] 54 | 55 | Sets the link to open on iPads when the app isn't installed. Specify this to do something other than install your app from the App Store when the app isn't installed, such as open the web version of the content, or display a promotional page for your app. Overrides the fallback link set by `setFallbackUrl` on iPad. 56 | 57 | | Parameter | | 58 | | --------- | ------- | 59 | | iPadFallbackUrl | **string**
The link to open on iPad if the app is not installed. | 60 | 61 | ### setMinimumVersion 62 | [method]setMinimumVersion(minimumVersion) returns [ref links.DynamicLink];[/method] 63 | 64 | Sets the minimum version of your app that can open the link. 65 | 66 | | Parameter | | 67 | | --------- | ------- | 68 | | minimumVersion | **string**
The minimum version. | 69 | -------------------------------------------------------------------------------- /docs/links/reference/ITunesParameters.md: -------------------------------------------------------------------------------- 1 | # ITunesParameters 2 | 3 | iTunes Connect specific link settings. 4 | 5 | ## Methods 6 | 7 | ### setAffiliateToken 8 | [method]setAffiliateToken(affiliateToken) returns [ref links.DynamicLink];[/method] 9 | 10 | Sets the affiliate token. 11 | 12 | | Parameter | | 13 | | --------- | ------- | 14 | | affiliateToken | **string**
The affiliate token used to create affiliate-coded links. | 15 | 16 | ### setCampaignToken 17 | [method]setCampaignToken(campaignToken) returns [ref links.DynamicLink];[/method] 18 | 19 | Sets the campaign token. 20 | 21 | | Parameter | | 22 | | --------- | ------- | 23 | | content | **string**
The campaign token that developers can add to any link in order to track sales from a specific marketing campaign. | 24 | 25 | ### setProviderToken 26 | [method]setProviderToken(providerToken) returns [ref links.DynamicLink];[/method] 27 | 28 | Sets the provider token. 29 | 30 | | Parameter | | 31 | | --------- | ------- | 32 | | providerToken | **string**
The provider token that enables analytics for Dynamic Links from within iTunes Connect. | 33 | -------------------------------------------------------------------------------- /docs/links/reference/NavigationParameters.md: -------------------------------------------------------------------------------- 1 | # NavigationParameters 2 | 3 | Navigation specific link settings. 4 | 5 | ## Methods 6 | 7 | ### setForcedRedirectEnabled 8 | [method]setForcedRedirectEnabled(forcedRedirectEnabled) returns [ref links.DynamicLink];[/method] 9 | 10 | Sets whether to enable force redirecting or going to the app preview page. Defaults to false. 11 | 12 | | Parameter | | 13 | | --------- | ------- | 14 | | forcedRedirectEnabled | **boolean**
If true, app preview page will be disabled and there will be a redirect to the FDL. If false, go to the app preview page. | 15 | -------------------------------------------------------------------------------- /docs/links/reference/SocialParameters.md: -------------------------------------------------------------------------------- 1 | # SocialParameters 2 | 3 | Social specific link settings. 4 | 5 | ## Methods 6 | 7 | ### setDescriptionText 8 | [method]setDescriptionText(descriptionText) returns [ref links.DynamicLink];[/method] 9 | 10 | Sets the meta-tag description. 11 | 12 | | Parameter | | 13 | | --------- | ------- | 14 | | descriptionText | **string**
The description to use when the Dynamic Link is shared in a social post. | 15 | 16 | ### setImageUrl 17 | [method]setImageUrl(imageUrl) returns [ref links.DynamicLink];[/method] 18 | 19 | Sets the meta-tag image link. 20 | 21 | | Parameter | | 22 | | --------- | ------- | 23 | | imageUrl | **string**
The URL to an image related to this link. | 24 | 25 | ### setTitle 26 | [method]setTitle(title) returns [ref links.DynamicLink];[/method] 27 | 28 | Sets the meta-tag title. 29 | 30 | | Parameter | | 31 | | --------- | ------- | 32 | | title | **string**
The title to use when the Dynamic Link is shared in a social post. | 33 | -------------------------------------------------------------------------------- /docs/messaging/android.md: -------------------------------------------------------------------------------- 1 | # Android Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup). 4 | 5 | ## Add the dependency 6 | 7 | Add the Firebase Cloud Messaging dependency and optional ShortcutBadger dependency to `android/app/build.gradle`: 8 | 9 | ```groovy 10 | dependencies { 11 | // ... 12 | implementation "com.google.firebase:firebase-messaging:{{ android.firebase.messaging }}" 13 | implementation 'me.leolin:ShortcutBadger:1.1.21@aar' // <-- Add this line if you wish to use badge on Android 14 | } 15 | ``` 16 | 17 | ## Install the RNFirebase Messaging package 18 | 19 | Add the `RNFirebaseMessagingPackage` to your `android/app/src/main/java/com/[app name]/MainApplication.java`: 20 | 21 | ```java 22 | // ... 23 | import io.invertase.firebase.RNFirebasePackage; 24 | import io.invertase.firebase.messaging.RNFirebaseMessagingPackage; // <-- Add this line 25 | 26 | public class MainApplication extends Application implements ReactApplication { 27 | // ... 28 | 29 | @Override 30 | protected List getPackages() { 31 | return Arrays.asList( 32 | new MainReactPackage(), 33 | new RNFirebasePackage(), 34 | new RNFirebaseMessagingPackage() // <-- Add this line 35 | ); 36 | } 37 | }; 38 | // ... 39 | } 40 | ``` 41 | 42 | ## Update Android Manifest 43 | 44 | Add the following to `android/app/src/main/AndroidManifest.xml`: 45 | 46 | Within the application component, add the messaging service: 47 | ```xml 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | ``` 58 | 59 | **For RNFB versions less than 5.2.0 only**; add the instance ID service: 60 | ```xml 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | ``` 71 | 72 | ## (Optional) Background Messages 73 | 74 | If you want to be able to react to data-only messages when your app is in the background, e.g. to display a heads up notification, then you need to add the following to `android/app/src/main/AndroidManifest.xml`: 75 | 76 | ```xml 77 | 78 | 79 | 80 | ``` 81 | 82 | You'll also need to check out the optional steps as part of our [Receiving Messages guide](version /messaging/receiving-messages). 83 | -------------------------------------------------------------------------------- /docs/messaging/device-token.md: -------------------------------------------------------------------------------- 1 | # The Device Registration Token 2 | 3 | On initial startup of your app, the FCM SDK generates a registration token for the client app instance. This token is needed to be able to send FCM messages and notifications to the user's device. 4 | 5 | This section describes how to retrieve the token and how to monitor changes to the token. Because the token could be rotated after initial startup, you are strongly recommended to monitor for the latest updated registration token. 6 | 7 | The registration token may change when: 8 | 9 | - The app deletes Instance ID 10 | - The app is restored on a new device 11 | - The user uninstalls/reinstall the app 12 | - The user clears app data. 13 | 14 | ## 1) Retrieve the current registration token 15 | 16 | ```js 17 | const fcmToken = await firebase.messaging().getToken(); 18 | if (fcmToken) { 19 | // user has a device token 20 | } else { 21 | // user doesn't have a device token yet 22 | } 23 | ``` 24 | 25 | or: 26 | 27 | ```js 28 | firebase.messaging().getToken() 29 | .then(fcmToken => { 30 | if (fcmToken) { 31 | // user has a device token 32 | } else { 33 | // user doesn't have a device token yet 34 | } 35 | }); 36 | ``` 37 | 38 | ## 2) Monitor token generation 39 | 40 | The `onTokenRefresh` callback fires with the latest registration token whenever a new token is generated. 41 | 42 | ```js 43 | componentDidMount() { 44 | this.onTokenRefreshListener = firebase.messaging().onTokenRefresh(fcmToken => { 45 | // Process your token as required 46 | }); 47 | } 48 | 49 | componentWillUnmount() { 50 | this.onTokenRefreshListener(); 51 | } 52 | ``` 53 | -------------------------------------------------------------------------------- /docs/messaging/ios.md: -------------------------------------------------------------------------------- 1 | # iOS Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup). 4 | 5 | ?> FCM does not work on the iOS simulator, you must test them using a real device. This is a restriction enforced by Apple. 6 | 7 | ## Add the pod 8 | 9 | Add the following to your `Podfile`: 10 | 11 | ```ruby 12 | pod 'Firebase/Messaging', '~> {{ ios.firebase.messaging }}' 13 | ``` 14 | 15 | Run `pod update`. 16 | 17 | ## Setup Certificates 18 | 19 | Please follow the instructions on the [Firebase docs](https://firebase.google.com/docs/cloud-messaging/ios/certs) on how to setup your APN certificates with FCM. 20 | 21 | ## Enable Capabilities 22 | 23 | In Xcode, enable the following capabilities: 24 | 25 | 1) Push Notifications 26 | 2) Background modes > Remote notifications 27 | 28 | ## Debugging 29 | 30 | If you're having problems with messages not being received, check out the following blog post for help: 31 | 32 | https://firebase.googleblog.com/2017/01/debugging-firebase-cloud-messaging-on.html 33 | -------------------------------------------------------------------------------- /docs/messaging/reference/IOSMessaging.md: -------------------------------------------------------------------------------- 1 | # IOSMessaging 2 | 3 | iOS specific messaging / APNS properties. 4 | 5 | ## Methods 6 | 7 | ### registerForRemoteNotifications 8 | [method]registerForRemoteNotifications() returns Promise containing void;[/method] 9 | 10 | Register for iOS remote notifications(APNS). 11 | 12 | ### getAPNSToken 13 | [method]getAPNSToken() returns Promise containing nullable string;[/method] 14 | 15 | Get current APNS token linked with firebase. 16 | 17 | Returns a promise that resolves with the token string if APNS is registered. Otherwise it resolves with null. 18 | -------------------------------------------------------------------------------- /docs/messaging/reference/RemoteMessage.md: -------------------------------------------------------------------------------- 1 | # RemoteMessage 2 | 3 | ``` 4 | firebase.messaging.RemoteMessage 5 | ``` 6 | 7 | ### RemoteMessage 8 | [method]new RemoteMessage();[/method] 9 | 10 | A RemoteMessage can be sent and received through FCM. 11 | 12 | To send a RemoteMessage, first populate it by using the `setX` methods described below, then pass it to `firebase.messaging().sendMessage(message)`; 13 | 14 | ## Properties 15 | 16 | ### collapseKey 17 | [method]collapseKey returns nullable string;[/method] 18 | 19 | Gets the collapse key of the message. 20 | 21 | ### data 22 | [method]data returns Object;[/method] 23 | 24 | Gets the message payload data. 25 | 26 | ### from 27 | [method]from returns nullable string;[/method] 28 | 29 | Gets the send of the message. 30 | 31 | This will be the sender ID or the topic for topic messages. 32 | 33 | ### messageId 34 | [method]messageId returns string;[/method] 35 | 36 | Gets the message's ID. 37 | 38 | This will be the message ID set when sending the message or automatically generated by the server. 39 | 40 | ### messageType 41 | [method]messageType returns nullable string;[/method] 42 | 43 | Gets the type of the message. 44 | 45 | ### sentTime 46 | [method]sentTime returns nullable number;[/method] 47 | 48 | Gets the time in milliseconds from the Epoch that the message was sent. 49 | 50 | ### to 51 | [method]to returns string;[/method] 52 | 53 | Get the message destination. 54 | 55 | ### ttl 56 | [method]ttl returns number;[/method] 57 | 58 | Gets the message time to live (TTL) in seconds. 59 | 60 | ## Methods 61 | 62 | ### setCollapseKey 63 | [method]setCollapseKey(collapseKey) returns [ref messaging.RemoteMessage];[/method] 64 | 65 | Sets the collapseKey for the message. 66 | 67 | | Parameter | | 68 | | --------- | ------- | 69 | | collapseKey | **string**
The collapse key. | 70 | 71 | ### setData 72 | [method]setData(data) returns [ref messaging.RemoteMessage];[/method] 73 | 74 | Sets the payload for the message. 75 | 76 | | Parameter | | 77 | | --------- | ------- | 78 | | payload | **Object**
The message payload. | 79 | 80 | ### setMessageId 81 | [method]setMessageId(messageId) returns [ref messaging.RemoteMessage];[/method] 82 | 83 | Sets the messageId for the message. 84 | 85 | | Parameter | | 86 | | --------- | ------- | 87 | | messageId | **string**
The message ID. | 88 | 89 | ### setMessageType 90 | [method]setMessageType(messageId) returns [ref messaging.RemoteMessage];[/method] 91 | 92 | Sets the messageId for the message. 93 | 94 | | Parameter | | 95 | | --------- | ------- | 96 | | messageId | **string**
The message ID. | 97 | 98 | ### setTo 99 | [method]setTo(to) returns [ref messaging.RemoteMessage];[/method] 100 | 101 | Sets the destination for the message. 102 | 103 | | Parameter | | 104 | | --------- | ------- | 105 | | to | **string**
The message destination. | 106 | 107 | ### setTtl 108 | [method]setTtl(ttl) returns [ref messaging.RemoteMessage];[/method] 109 | 110 | Sets the time to live (TTL) for the message. 111 | 112 | | Parameter | | 113 | | --------- | ------- | 114 | | ttl | **number**
The message time to live (TTL) in seconds. | 115 | -------------------------------------------------------------------------------- /docs/messaging/topics.md: -------------------------------------------------------------------------------- 1 | # Topic Messaging 2 | 3 | Based on the publish/subscribe model, FCM topic messaging allows you to send a message to multiple devices that have opted in to a particular topic. You compose topic messages as needed, and FCM handles routing and delivering the message reliably to the right devices. 4 | 5 | For example, users of a local weather forecasting app could opt in to a "severe weather alerts" topic and receive notifications of storms threatening specified areas. Users of a sports app could subscribe to automatic updates in live game scores for their favourite teams. 6 | 7 | Some things to keep in mind about topics: 8 | 9 | - Topic messaging supports unlimited topics and subscriptions for each app. 10 | - Topic messaging is best suited for content such as news, weather, or other publicly available information. 11 | - Topic messages are optimized for throughput rather than latency. For fast, secure delivery to single devices or small groups of devices, target messages to registration tokens, not topics. 12 | - If you need to send messages to multiple devices per user, consider device group messaging for those use cases. 13 | 14 | ## 1) Subscribe the client app to a topic 15 | 16 | Client apps can subscribe to any existing topic, or they can create a new topic. When a client app subscribes to a new topic name (one that does not already exist for your Firebase project), a new topic of that name is created in FCM and any client can subsequently subscribe to it. 17 | 18 | To subscribe to a topic: 19 | 20 | ```js 21 | firebase.messaging().subscribeToTopic(topicName); 22 | ``` 23 | 24 | To unsubscribe from a topic: 25 | 26 | ```js 27 | firebase.messaging().unsubscribeFromTopic(topicName); 28 | ``` 29 | 30 | ## 2) Receive and handle topic messages 31 | 32 | FCM delivers topic messages in the same way as other downstream messages. 33 | 34 | To receive messages, make use of the `onMessage` method described in [Receiving Messages](version /messaging/receiving-messages). 35 | -------------------------------------------------------------------------------- /docs/messaging/upstream-messages.md: -------------------------------------------------------------------------------- 1 | # Sending Upstream Messages 2 | 3 | If your app server implements the XMPP Connection Server protocol, it can receive upstream messages from a user's device to the cloud. To initiate an upstream message, the client app sends a request containing the following: 4 | 5 | - The address of the receiving app server in the format SENDER_ID@gcm.googleapis.com. 6 | - A message ID that should be unique for each sender ID. 7 | - The message data comprising the key-value pairs of the message's payload. 8 | 9 | When it receives this data, FCM builds an XMPP stanza to send to the app server, adding some additional information about the sending device and app. 10 | 11 | ## Send an upstream message 12 | 13 | Your app can send an upstream message using `sendMessage`: 14 | 15 | ```js 16 | // Create a RemoteMessage 17 | const message = new firebase.messaging.RemoteMessage() 18 | .setMessageId('unique id') 19 | .setTo('senderId@gcm.googleapis.com') 20 | .setData({ 21 | key1: 'value1', 22 | key2: 'value2', 23 | }); 24 | // Send the message 25 | firebase.messaging().sendMessage(message); 26 | ``` -------------------------------------------------------------------------------- /docs/notifications/android-channels.md: -------------------------------------------------------------------------------- 1 | # Android Notification Channels 2 | 3 | As of Android 8.0 (API Level 26), notifications must specify a [Notification Channel](https://developer.android.com/guide/topics/ui/notifiers/notifications.html#ManageChannels) or they will not appear. 4 | 5 | To allow React Native Firebase to work seamlessly across all versions of Android, you will need to create a channel before you can display a notification. This block of code can be re-run multiple times, so it is safe to do it each time your application starts. 6 | 7 | ## Creating a Notification Channel 8 | 9 | ```js 10 | // Build a channel 11 | const channel = new firebase.notifications.Android.Channel('test-channel', 'Test Channel', firebase.notifications.Android.Importance.Max) 12 | .setDescription('My apps test channel'); 13 | 14 | // Create the channel 15 | firebase.notifications().android.createChannel(channel); 16 | ``` 17 | 18 | For full reference documentation, please see [ref notifications.AndroidChannel] and [ref notifications.AndroidNotifications]. 19 | 20 | ## Creating a Notification Channel Group 21 | 22 | React Native Firebase also supports the concept of [Notification Channel Groups](https://developer.android.com/training/notify-user/channels.html#CreateChannelGroup). 23 | 24 | ```js 25 | // Build a channel group 26 | const channelGroup = new firebase.notifications.Android.ChannelGroup('test-group', 'Test Channel Group'); 27 | 28 | // Create the channel group 29 | firebase.notifications().android.createChannelGroup(channelGroup); 30 | ``` 31 | 32 | For full reference documentation, please see [ref notifications.AndroidChannelGroup] and [ref notifications.AndroidNotifications]. -------------------------------------------------------------------------------- /docs/notifications/displaying-notifications.md: -------------------------------------------------------------------------------- 1 | # Displaying Notifications 2 | 3 | When your app is in the foreground, you can choose to present a notification to the user. 4 | 5 | > iOS 9 does not support displaying a notification whilst the app is in the foreground 6 | 7 | ---- 8 | 9 | ?> For Android notifications it is highly recommended that you read through the official [Android Notifications Overview](https://developer.android.com/guide/topics/ui/notifiers/notifications) page and also use it as a reference during development; e.g. if your Heads-up notification is not showing then see the `Heads-up notification` section which explains the conditions and versions that will trigger a notification to display in Heads-up form. 10 | 11 | 12 | ## 1) Building a notification 13 | 14 | React Native Firebase provides a [ref notifications.Notification] class which works as a builder to allow you to construct a notification. This [ref notifications.Notification] class contains all the generic notification functionality that is shared between Android and iOS. 15 | 16 | ```js 17 | const notification = new firebase.notifications.Notification() 18 | .setNotificationId('notificationId') 19 | .setTitle('My notification title') 20 | .setBody('My notification body') 21 | .setData({ 22 | key1: 'value1', 23 | key2: 'value2', 24 | }); 25 | ``` 26 | 27 | For the full set of shared parameters that can be set, please see the [ref notifications.Notification] reference docs. 28 | 29 | ### Android specific functionality 30 | 31 | As Android provides some bespoke notification functionality, we have segregated this into an [ref notifications.AndroidNotification] class. This is accessible on the notification you created above, as follows: 32 | 33 | ```js 34 | notification 35 | .android.setChannelId('channelId') 36 | .android.setSmallIcon('ic_launcher'); 37 | ``` 38 | 39 | For the full set of Android-specific parameters that can be set, please see the [ref notifications.AndroidNotification] reference docs. 40 | 41 | ### iOS specific functionality 42 | 43 | As iOS provides some bespoke notification functionality, we have segregated this into an [ref notifications.IOSNotification] class. This is accessible on the notification you created above, as follows: 44 | 45 | ```js 46 | notification 47 | .ios.setBadge(2); 48 | ``` 49 | 50 | For the full set of iOS-specific parameters that can be set, please see the [ref notifications.IOSNotification] reference docs. 51 | 52 | ## 2) Display the notification 53 | 54 | ### (Android) Set up a notification channel 55 | 56 | Before you can display a notification on Android, you must ensure you have created a Notification Channel, as explained [here](version /notifications/android-channels). 57 | 58 | ### Display the notification 59 | 60 | ```js 61 | // Build notification as above 62 | const notification = ...; 63 | // Display the notification 64 | firebase.notifications().displayNotification(notification) 65 | ``` 66 | -------------------------------------------------------------------------------- /docs/notifications/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction to Notifications 2 | 3 | React Native Firebase's Notifications module has support for both remote (FCM) and local notifications. 4 | 5 | ## Remote Notifications 6 | 7 | Firebase Cloud Messaging (FCM) allows notifications to be displayed by your application remotely. To try and keep things simple and easier to understand, we have divided the React Native Firebase functionality clearly between data-only and notification messages. 8 | 9 | Remote notifications: 10 | 11 | - Used to display a visible notification on devices. 12 | - Contain an optional data payload (map of key / value pairs) for consumption by the app if it is in the foreground, or if the notification is subsequently opened. **If the notification is not opened, this data will never become available to the app.** 13 | - Intercepted by the Mobile Device's OS. 14 | - Delivered to the notification tray when the app is in the background or closed. 15 | 16 | > The React Native Firebase Notifications Module deals with notification-only and notification + data FCM remote messages.
For data-only FCM messages please see the [Messaging module](version /messaging/introduction). 17 | 18 | Remote notifications behave as follows: 19 | 20 | | | App in foreground | App in background | App closed | 21 | | ------- | --------------------------- | ---------------------------- | -----------| 22 | | Android | `onNotification` triggered | `onNotificationOpened` triggered if the notification is tapped | `getInitialNotification` is populated if the notification is tapped and opens the app | 23 | | iOS | `onNotification` triggered | `onNotificationDisplayed` triggered if `content_available` set to `true`

`onNotificationOpened` triggered if the notification is tapped | `getInitialNotification` is populated if the notification is tapped and opens the app | 24 | | Notes | No visible notification is shown to the user, it is up to you to display notifications manually | The notification is presented to the user by the Mobile Device's OS | The notification is presented to the user by the Mobile Device's OS | 25 | 26 | ## Local Notifications 27 | 28 | Both Android and IOS support the ability to trigger notifications from your application locally. These can either be displayed immediately, or scheduled to be displayed at a later date. 29 | 30 | The notifications module handles all local notifications. 31 | 32 | Scheduled notifications behave as follows: 33 | 34 | | | App in foreground | App in background | App closed | 35 | | ------- | --------------------------- | ---------------------------- | -----------| 36 | | Android | `onNotification` triggered | `onNotificationOpened` triggered if the notification is tapped | `getInitialNotification` is populated if the notification is tapped and opens the app | 37 | | iOS | `onNotification` triggered | `onNotificationOpened` triggered if the notification is tapped | `getInitialNotification` is populated if the notification is tapped and opens the app | 38 | | Notes | No visible notification is shown to the user, it is up to you to display notifications manually | The notification is presented to the user by the Mobile Device's OS | The notification is presented to the user by the Mobile Device's OS | 39 | 40 | 41 | ---- 42 | 43 | ?> For Android notifications it is highly recommended that you read through the official [Android Notifications Overview](https://developer.android.com/guide/topics/ui/notifiers/notifications) page and also use it as a reference during development; e.g. if your Heads-up notification is not showing then see the `Heads-up notification` section which explains the conditions and versions that will trigger a notification to display in Heads-up form. 44 | 45 | -------------------------------------------------------------------------------- /docs/notifications/ios.md: -------------------------------------------------------------------------------- 1 | # iOS Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup) and the [messaging setup guide](version /messaging/ios). 4 | 5 | ?> Remote notifications do not work on the iOS simulator, you must test them using a real device. This is a restriction enforced by Apple. 6 | 7 | ## Update `AppDelegate.m` 8 | 9 | Add the following import to the top of your `ios/[App Name]/AppDelegate.m`: 10 | 11 | ```objectivec 12 | #import "RNFirebaseNotifications.h" 13 | ``` 14 | 15 | Add the following to the `didFinishLaunchingWithOptions:(NSDictionary *)launchOptions` method, right after `[FIRApp Configure]`: 16 | 17 | ```objectivec 18 | [FIRApp Configure] // after this line 19 | [RNFirebaseNotifications configure]; 20 | ``` 21 | 22 | ?> It is recommended to add the line within the method **BETWEEN** the statement **[FIRApp Configure]** and the creation of **RCTRootView**. Otherwise the initialization can occur after already being required in your JavaScript code - leading to `app not initialised` exceptions. 23 | 24 | Add the following method: 25 | 26 | ```objectivec 27 | - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { 28 | [[RNFirebaseNotifications instance] didReceiveLocalNotification:notification]; 29 | } 30 | ``` 31 | 32 | ## Remote Notifications (Optional) 33 | 34 | If you would like to support Remote Notifications via FCM, also add the following import to the top of your `ios/[App Name]/AppDelegate.m`: 35 | 36 | ```objectivec 37 | #import "RNFirebaseMessaging.h" 38 | ``` 39 | 40 | Then add the following methods to your `ios/[App Name]/AppDelegate.m`: 41 | 42 | ```objectivec 43 | - (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo 44 | fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{ 45 | [[RNFirebaseNotifications instance] didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler]; 46 | } 47 | 48 | - (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings { 49 | [[RNFirebaseMessaging instance] didRegisterUserNotificationSettings:notificationSettings]; 50 | } 51 | ``` 52 | 53 | ## Debugging 54 | 55 | If you're having problems with messages not being received, check out the following blog post for help: 56 | 57 | https://firebase.googleblog.com/2017/01/debugging-firebase-cloud-messaging-on.html 58 | -------------------------------------------------------------------------------- /docs/notifications/reference/AndroidAction.md: -------------------------------------------------------------------------------- 1 | # AndroidAction 2 | 3 | ``` 4 | firebase.notifications.Android.Action 5 | ``` 6 | 7 | See the official [Android docs](https://developer.android.com/training/notify-user/build-notification.html#Actions) for more information about Actions. 8 | 9 | ### Constructor 10 | [method]new firebase.notifications.Android.Action(action, icon, title);[/method] 11 | 12 | Structure to encapsulate a named action that can be shown as part of this notification. It must include an icon, a label, and a PendingIntent to be fired when the action is selected by the user. Action buttons won't appear on platforms prior to Android 4.1. 13 | 14 | | Parameter | | 15 | | --------- | ------- | 16 | | action | **string** | 17 | | icon | **string** | 18 | | title | **string** | 19 | 20 | ## Properties 21 | 22 | ### action 23 | [method]action returns string;[/method] 24 | 25 | The name of the action. 26 | 27 | ### allowGeneratedReplies 28 | [method]allowGeneratedReplies returns nullable boolean;[/method] 29 | 30 | Return whether the platform should automatically generate possible replies for this action. 31 | 32 | ### icon 33 | [method]icon returns string;[/method] 34 | 35 | The icon to use for this action. 36 | 37 | ### remoteInputs 38 | [method]remoteInputs returns Array of [ref notifications.AndroidRemoteInput];[/method] 39 | 40 | Get the list of inputs to be collected from the user when this action is sent. 41 | 42 | ### semanticAction 43 | [method]icon returns nullable [ref notifications.AndroidSemanticAction];[/method] 44 | 45 | Returns the semantic action associated with this action. 46 | 47 | ### showUserInterface 48 | [method]showUserInterface returns nullable boolean;[/method] 49 | 50 | Return whether or not triggering this action will open a user interface. 51 | 52 | ### title 53 | [method]title returns string;[/method] 54 | 55 | The title for this action. 56 | 57 | ## Methods 58 | 59 | ### addRemoteInput 60 | [method]addRemoteInput(remoteInput) returns [ref notifications.AndroidAction];[/method] 61 | 62 | | Parameter | | 63 | | --------- | ------- | 64 | | remoteInput | **[ref notifications.AndroidRemoteInput]** | 65 | 66 | Add an input to be collected from the user when this action is sent. 67 | 68 | ### setAllowGenerateReplies 69 | [method]setAllowGenerateReplies(allowGeneratedReplies) returns [ref notifications.AndroidAction];[/method] 70 | 71 | | Parameter | | 72 | | --------- | ------- | 73 | | allowGeneratedReplies | **boolean** | 74 | 75 | Set whether the platform should automatically generate possible replies to add to getChoices(). 76 | 77 | ### setSemanticAction 78 | [method]setSemanticAction(semanticAction) returns [ref notifications.AndroidAction];[/method] 79 | 80 | | Parameter | | 81 | | --------- | ------- | 82 | | semanticAction | **[ref notifications.AndroidSemanticAction]** | 83 | 84 | Sets the SemanticAction for this action. 85 | 86 | ### setShowUserInterface 87 | [method]setShowUserInterface(showUserInterface) returns [ref notifications.AndroidAction];[/method] 88 | 89 | | Parameter | | 90 | | --------- | ------- | 91 | | showUserInterface | **boolean** | 92 | 93 | Set whether or not this action will open the user interface. Defaults to true. 94 | -------------------------------------------------------------------------------- /docs/notifications/reference/AndroidBadgeIconType.md: -------------------------------------------------------------------------------- 1 | # AndroidBadgeIconType 2 | 3 | ``` 4 | firebase.notifications.Android.BadgeIconType 5 | ``` 6 | 7 | ## Constants 8 | 9 | ### None 10 | 11 | If this notification is being shown as a badge, always show as a number. 12 | 13 | ``` 14 | firebase.notifications.Android.BadgeIconType.None 15 | ``` 16 | 17 | ### Small 18 | 19 | If this notification is being shown as a badge, use the icon provided to setSmallIcon(int) to represent this notification. 20 | 21 | ``` 22 | firebase.notifications.Android.BadgeIconType.Small 23 | ``` 24 | 25 | ### Large 26 | 27 | If this notification is being shown as a badge, use the icon provided to {@link Builder#setLargeIcon(Bitmap) to represent this notification. 28 | 29 | ``` 30 | firebase.notifications.Android.BadgeIconType.Large 31 | ``` -------------------------------------------------------------------------------- /docs/notifications/reference/AndroidCategory.md: -------------------------------------------------------------------------------- 1 | # AndroidCategory 2 | 3 | ``` 4 | firebase.notifications.Android.Category 5 | ``` 6 | 7 | ## Constants 8 | 9 | ### Alarm 10 | 11 | Alarm or timer. 12 | 13 | ``` 14 | firebase.notifications.Android.Category.Alarm 15 | ``` 16 | 17 | ### Call 18 | 19 | Incoming call (voice or video) or similar synchronous communication request. 20 | 21 | ``` 22 | firebase.notifications.Android.Category.Call 23 | ``` 24 | 25 | ### Email 26 | 27 | Asynchronous bulk message (email). 28 | 29 | ``` 30 | firebase.notifications.Android.Category.Email 31 | ``` 32 | 33 | ### Error 34 | 35 | Error in background operation or authentication status. 36 | 37 | ``` 38 | firebase.notifications.Android.Category.Error 39 | ``` 40 | 41 | ### Event 42 | 43 | Calendar event. 44 | 45 | ``` 46 | firebase.notifications.Android.Category.Event 47 | ``` 48 | 49 | ### Message 50 | 51 | Incoming direct message (SMS, instant message, etc.). 52 | 53 | ``` 54 | firebase.notifications.Android.Category.Message 55 | ``` 56 | 57 | ### Progress 58 | 59 | Progress of a long-running background operation. 60 | 61 | ``` 62 | firebase.notifications.Android.Category.Progress 63 | ``` 64 | 65 | ### Promo 66 | 67 | Promotion or advertisement. 68 | 69 | ``` 70 | firebase.notifications.Android.Category.Promo 71 | ``` 72 | 73 | ### Recommendation 74 | 75 | A specific, timely recommendation for a single thing. For example, a news app might want to recommend a news story it believes the user will want to read next. 76 | 77 | ``` 78 | firebase.notifications.Android.Category.Recommendation 79 | ``` 80 | 81 | ### Reminder 82 | 83 | User-scheduled reminder. 84 | 85 | ``` 86 | firebase.notifications.Android.Category.Reminder 87 | ``` 88 | 89 | ### Service 90 | 91 | Indication of running background service. 92 | 93 | ``` 94 | firebase.notifications.Android.Category.Service 95 | ``` 96 | 97 | ### Social 98 | 99 | Social network or sharing update. 100 | 101 | ``` 102 | firebase.notifications.Android.Category.Social 103 | ``` 104 | 105 | ### Status 106 | 107 | Ongoing information about device or contextual status. 108 | 109 | ``` 110 | firebase.notifications.Android.Category.Status 111 | ``` 112 | 113 | ### System 114 | 115 | System or device status update. Reserved for system use. 116 | 117 | ``` 118 | firebase.notifications.Android.Category.System 119 | ``` 120 | 121 | ### Transport 122 | 123 | Media transport control for playback. 124 | 125 | ``` 126 | firebase.notifications.Android.Category.Transport 127 | ``` -------------------------------------------------------------------------------- /docs/notifications/reference/AndroidChannelGroup.md: -------------------------------------------------------------------------------- 1 | # AndroidChannelGroup 2 | 3 | ``` 4 | firebase.notifications.Android.ChannelGroup 5 | ``` 6 | 7 | ### Constructor 8 | [method]new firebase.notifications.Android.ChannelGroup(groupId, name);[/method] 9 | 10 | A grouping of related notification channels. e.g., channels that all belong to a single account. 11 | 12 | | Parameter | | 13 | | --------- | ------- | 14 | | groupId | **string** | 15 | | name | **string** | 16 | 17 | ## Properties 18 | 19 | ### groupId 20 | [method]groupId returns nullable string;[/method] 21 | 22 | Returns the id of this channel group. 23 | 24 | ### name 25 | [method]name returns string;[/method] 26 | 27 | The user visible name of this channel group. 28 | -------------------------------------------------------------------------------- /docs/notifications/reference/AndroidDefaults.md: -------------------------------------------------------------------------------- 1 | # AndroidDefaults 2 | 3 | ``` 4 | firebase.notifications.Android.Defaults 5 | ``` 6 | 7 | ## Constants 8 | 9 | ### All 10 | 11 | Use all default values (where applicable). 12 | 13 | ``` 14 | firebase.notifications.Android.Defaults.All 15 | ``` 16 | 17 | ### Lights 18 | 19 | Use the default notification lights. This will ignore any given `lights` options. 20 | 21 | ``` 22 | firebase.notifications.Android.Defaults.Lights 23 | ``` 24 | 25 | ### Sound 26 | 27 | Use the default notification sound. This will ignore any given `sound`. 28 | 29 | A notification that is noisy is more likely to be presented as a heads-up notification. 30 | 31 | ``` 32 | firebase.notifications.Android.Defaults.Sound 33 | ``` 34 | 35 | ### Vibrate 36 | 37 | Use the default notification vibrate. This will ignore any given `vibrate`. Using phone vibration requires the VIBRATE permission. 38 | 39 | A notification that vibrates is more likely to be presented as a heads-up notification. 40 | 41 | ``` 42 | firebase.notifications.Android.Defaults.Vibrate 43 | ``` -------------------------------------------------------------------------------- /docs/notifications/reference/AndroidGroupAlert.md: -------------------------------------------------------------------------------- 1 | # AndroidGroupAlert 2 | 3 | ``` 4 | firebase.notifications.Android.GroupAlert 5 | ``` 6 | 7 | ## Constants 8 | 9 | ### All 10 | 11 | Constant for `setGroupAlertBehaviour`, meaning that all notifications in a group with sound or vibration ought to make sound or vibrate (respectively), so this notification will not be muted when it is in a group. 12 | 13 | ``` 14 | firebase.notifications.Android.GroupAlert.All 15 | ``` 16 | 17 | ### Children 18 | 19 | Constant for `setGroupAlertBehaviour`, meaning that the summary notification in a group should be silenced (no sound or vibration) even if they would otherwise make sound or vibrate. Use this constant to mute this notification if this notification is a group summary. 20 | 21 | For example, you might want to use this constant if only the children notifications in your group have content and the summary is only used to visually group notifications rather than to alert the user that new information is available. 22 | 23 | ``` 24 | firebase.notifications.Android.GroupAlert.Children 25 | ``` 26 | 27 | ### Summary 28 | 29 | Constant for `setGroupAlertBehaviour`, meaning that all children notification in a group should be silenced (no sound or vibration) even if they would otherwise make sound or vibrate. Use this constant to mute this notification if this notification is a group child. This must be applied to all children notifications you want to mute. 30 | 31 | For example, you might want to use this constant if you post a number of children notifications at once (say, after a periodic sync), and only need to notify the user audibly once. 32 | 33 | ``` 34 | firebase.notifications.Android.GroupAlert.Summary 35 | ``` -------------------------------------------------------------------------------- /docs/notifications/reference/AndroidImportance.md: -------------------------------------------------------------------------------- 1 | # AndroidImportance 2 | 3 | ``` 4 | firebase.notifications.Android.Importance 5 | ``` 6 | 7 | ## Constants 8 | 9 | ### Default 10 | 11 | Default notification importance: shows everywhere, makes noise, but does not visually intrude. 12 | 13 | ``` 14 | firebase.notifications.Android.Importance.Default 15 | ``` 16 | 17 | ### High 18 | 19 | Higher notification importance: shows everywhere, makes noise and peeks. May use full screen intents. 20 | 21 | ``` 22 | firebase.notifications.Android.Importance.High 23 | ``` 24 | 25 | ### Low 26 | 27 | Low notification importance: shows everywhere, but is not intrusive. 28 | 29 | ``` 30 | firebase.notifications.Android.Importance.Low 31 | ``` 32 | 33 | ### Max 34 | 35 | Unused. 36 | 37 | ``` 38 | firebase.notifications.Android.Importance.Max 39 | ``` 40 | 41 | ### Min 42 | 43 | Min notification importance: only shows in the shade, below the fold. 44 | 45 | ``` 46 | firebase.notifications.Android.Importance.Min 47 | ``` 48 | 49 | ### None 50 | 51 | A notification with no importance: does not show in the shade. 52 | 53 | ``` 54 | firebase.notifications.Android.Importance.None 55 | ``` 56 | 57 | ### Unspecified 58 | 59 | Value signifying that the user has not expressed an importance. This value is for persisting preferences, and should never be associated with an actual notification. 60 | 61 | ``` 62 | firebase.notifications.Android.Importance.Unspecified 63 | ``` -------------------------------------------------------------------------------- /docs/notifications/reference/AndroidLights.md: -------------------------------------------------------------------------------- 1 | # AndroidLights 2 | 3 | ## Properties 4 | 5 | ### argb 6 | [method]argb returns number;[/method] 7 | 8 | ### offMs 9 | [method]offMs returns number;[/method] 10 | 11 | ### onMs 12 | [method]onMs returns number;[/method] 13 | -------------------------------------------------------------------------------- /docs/notifications/reference/AndroidNotifications.md: -------------------------------------------------------------------------------- 1 | # AndroidNotifications 2 | 3 | This deals with Android-specific Notification functionality. 4 | 5 | ## Methods 6 | 7 | The following methods are accessed via the AndroidNotifications instance `firebase.notifications().android` 8 | 9 | 10 | ### createChannel 11 | [method]createChannel(channel) returns Promise;[/method] 12 | 13 | Creates a new channel. 14 | 15 | Returns a promise that resolves if the channel is created, otherwise it is rejected with an error. 16 | 17 | | Parameter | | 18 | | --------- | ------- | 19 | | channel | **[ref notifications.AndroidChannel]**
The channel to create. | 20 | 21 | ### createChannelGroup 22 | [method]createChannelGroup(channelGroup) returns Promise;[/method] 23 | 24 | Creates a new channel group. 25 | 26 | Returns a promise that resolves if the channel group is created, otherwise it is rejected with an error. 27 | 28 | | Parameter | | 29 | | --------- | ------- | 30 | | channelGroup | **[ref notifications.AndroidChannelGroup]**
The channel group to create. | 31 | 32 | ### createChannelGroups 33 | [method]createChannelGroups(channelGroups) returns Promise;[/method] 34 | 35 | Creates multiple new channel grousps 36 | 37 | Returns a promise that resolves if the channel groups are created, otherwise it is rejected with an error. 38 | 39 | | Parameter | | 40 | | --------- | ------- | 41 | | channelGroups | **Array<[ref notifications.AndroidChannelGroup]>**
The channel groups to create. | 42 | 43 | ### createChannels 44 | [method]createChannels(channels) returns Promise;[/method] 45 | 46 | Creates multiple new channels. 47 | 48 | Returns a promise that resolves if the channels are created, otherwise it is rejected with an error. 49 | 50 | | Parameter | | 51 | | --------- | ------- | 52 | | channels | **Array<[ref notifications.AndroidChannel]>**
The channels to create. | 53 | 54 | ### deleteChannel 55 | [method]deleteChannel(channelId) returns Promise;[/method] 56 | 57 | Deletes a channel. 58 | 59 | Returns a promise that resolves if the channel is deleted, otherwise it is rejected with an error. 60 | 61 | | Parameter | | 62 | | --------- | ------- | 63 | | channelId | **string**
The channel to delete. | 64 | 65 | ### deleteChannelGroup 66 | [method]deleteChannelGroup(channelGroupId) returns Promise;[/method] 67 | 68 | Deletes a channel group. 69 | 70 | Returns a promise that resolves if the channel group is deleted, otherwise it is rejected with an error. 71 | 72 | | Parameter | | 73 | | --------- | ------- | 74 | | channelGroupId | **string**
The channel group to delete. | 75 | -------------------------------------------------------------------------------- /docs/notifications/reference/AndroidPriority.md: -------------------------------------------------------------------------------- 1 | # AndroidPriority 2 | 3 | ``` 4 | firebase.notifications.Android.Priority 5 | ``` 6 | 7 | ## Constants 8 | 9 | ### Default 10 | 11 | Default notification priority for `setPriority`. If your application does not prioritise its own notifications, use this value for all notifications. 12 | 13 | ``` 14 | firebase.notifications.Android.Priority.Default 15 | ``` 16 | 17 | ### High 18 | 19 | Higher notification priority for `setPriority`, for more important notifications or alerts. The UI may choose to show these items larger, or at a different position in notification lists, compared with your app's `Priority.Default` items. 20 | 21 | ``` 22 | firebase.notifications.Android.Priority.High 23 | ``` 24 | 25 | ### Low 26 | 27 | Lower notification priority for `setPriority`, for items that are less important. The UI may choose to show these items smaller, or at a different position in the list, compared with your app's `Priority.Default` items. 28 | 29 | ``` 30 | firebase.notifications.Android.Priority.Low 31 | ``` 32 | 33 | ### Max 34 | 35 | Highest notification priority for `setPriority`, for your application's most important items that require the user's prompt attention or input. 36 | 37 | ``` 38 | firebase.notifications.Android.Priority.Max 39 | ``` 40 | 41 | ### Min 42 | 43 | Lowest notification priority for `setPriority`; these items might not be shown to the user except under special circumstances, such as detailed notification logs. 44 | 45 | ``` 46 | firebase.notifications.Android.Priority.Min 47 | ``` -------------------------------------------------------------------------------- /docs/notifications/reference/AndroidProgress.md: -------------------------------------------------------------------------------- 1 | # AndroidProgress 2 | 3 | ## Properties 4 | 5 | ### indeterminate 6 | [method]indeterminate returns boolean;[/method] 7 | 8 | ### max 9 | [method]max returns number;[/method] 10 | 11 | ### progress 12 | [method]progress returns number;[/method] -------------------------------------------------------------------------------- /docs/notifications/reference/AndroidRemoteInput.md: -------------------------------------------------------------------------------- 1 | # AndroidRemoteInput 2 | 3 | ``` 4 | firebase.notifications.Android.RemoteInput 5 | ``` 6 | 7 | See the official [Android docs](https://developer.android.com/training/notify-user/build-notification.html#reply-action) for more information about Remote Input. 8 | 9 | ### Constructor 10 | [method]new firebase.notifications.Android.RemoteInput(resultKey);[/method] 11 | 12 | A RemoteInput object specifies input to be collected from a user to be passed along with an intent inside a PendingIntent that is sent. 13 | 14 | | Parameter | | 15 | | --------- | ------- | 16 | | resultKey | **string** | 17 | 18 | ## Properties 19 | 20 | ### allowedDataTypes 21 | [method]allowedDataTypes returns Array of Object;[/method] 22 | 23 | The data types this remote input supports. 24 | 25 | ### allowFreeFormInput 26 | [method]allowFreeFormInput returns nullable boolean;[/method] 27 | 28 | Get whether or not users can provide an arbitrary value for input. 29 | 30 | ### choices 31 | [method]choices returns Array of string;[/method] 32 | 33 | Get possible input choices. 34 | 35 | ### label 36 | [method]choices returns nullable string;[/method] 37 | 38 | Get the label to display to users when collecting this input. 39 | 40 | ### resultKey 41 | [method]resultKey returns string;[/method] 42 | 43 | Get the key that the result of this input will be set in the [ref notifications.NotificationOpened] `results` object. 44 | 45 | ## Methods 46 | 47 | ### setAllowDataType 48 | [method]setAllowDataType(mimeType, allow) returns [ref notifications.AndroidRemoteInput];[/method] 49 | 50 | | Parameter | | 51 | | --------- | ------- | 52 | | mimeType | **string** | 53 | | allow | **boolean** | 54 | 55 | Specifies whether the user can provide arbitrary values. 56 | 57 | ### setAllowFreeFormInput 58 | [method]setAllowFreeFormInput(allowFreeFormInput) returns [ref notifications.AndroidRemoteInput];[/method] 59 | 60 | | Parameter | | 61 | | --------- | ------- | 62 | | allowFreeFormInput | **boolean** | 63 | 64 | Specifies whether the user can provide arbitrary text values. 65 | 66 | ### setChoices 67 | [method]setChoices(choices) returns [ref notifications.AndroidRemoteInput];[/method] 68 | 69 | | Parameter | | 70 | | --------- | ------- | 71 | | choices | **Array** | 72 | 73 | Specifies choices available to the user to satisfy this input. 74 | 75 | ### setLabel 76 | [method]setLabel(label) returns [ref notifications.AndroidRemoteInput];[/method] 77 | 78 | | Parameter | | 79 | | --------- | ------- | 80 | | label | **string** | 81 | 82 | Set a label to be displayed to the user when collecting this input. 83 | -------------------------------------------------------------------------------- /docs/notifications/reference/AndroidSemanticAction.md: -------------------------------------------------------------------------------- 1 | # AndroidSemanticAction 2 | 3 | ``` 4 | firebase.notifications.Android.SemanticAction 5 | ``` 6 | 7 | ## Constants 8 | 9 | ### Archive 10 | 11 | Archive the content associated with the notification. This could mean archiving an email, message, etc. 12 | 13 | ``` 14 | firebase.notifications.Android.SemanticAction.Archive 15 | ``` 16 | 17 | ### Call 18 | 19 | Call a contact, group, etc. 20 | 21 | ``` 22 | firebase.notifications.Android.SemanticAction.Call 23 | ``` 24 | 25 | ### Delete 26 | 27 | Delete the content associated with the notification. This could mean deleting an email, message, etc. 28 | 29 | ``` 30 | firebase.notifications.Android.SemanticAction.Delete 31 | ``` 32 | 33 | ### MarkAsRead 34 | 35 | Mark content as read. 36 | 37 | ``` 38 | firebase.notifications.Android.SemanticAction.MarkAsRead 39 | ``` 40 | 41 | ### MarkAsUnread 42 | 43 | Mark content as unread. 44 | 45 | ``` 46 | firebase.notifications.Android.SemanticAction.MarkAsUnread 47 | ``` 48 | 49 | ### Mute 50 | 51 | Mute the content associated with the notification. This could mean silencing a conversation or currently playing media. 52 | 53 | ``` 54 | firebase.notifications.Android.SemanticAction.Mute 55 | ``` 56 | 57 | ### None 58 | 59 | No semantic action defined. 60 | 61 | ``` 62 | firebase.notifications.Android.SemanticAction.None 63 | ``` 64 | 65 | ### Reply 66 | 67 | Reply to a conversation, chat, group, or wherever replies may be appropriate. 68 | 69 | ``` 70 | firebase.notifications.Android.SemanticAction.Reply 71 | ``` 72 | 73 | ### ThumbsDown 74 | 75 | Mark content with a thumbs down. 76 | 77 | ``` 78 | firebase.notifications.Android.SemanticAction.ThumbsDown 79 | ``` 80 | 81 | ### ThumbsUp 82 | 83 | Mark content with a thumbs up. 84 | 85 | ``` 86 | firebase.notifications.Android.SemanticAction.ThumbsUp 87 | ``` 88 | 89 | ### Unmute 90 | 91 | Unmute the content associated with the notification. This could mean un-silencing a conversation or currently playing media. 92 | 93 | ``` 94 | firebase.notifications.Android.SemanticAction.Unmute 95 | ``` -------------------------------------------------------------------------------- /docs/notifications/reference/AndroidVisibility.md: -------------------------------------------------------------------------------- 1 | # AndroidVisibility 2 | 3 | ``` 4 | firebase.notifications.Android.Visibility 5 | ``` 6 | 7 | ## Constants 8 | 9 | ### Private 10 | 11 | Show this notification on all lockscreens, but conceal sensitive or private information on secure lockscreens. 12 | 13 | ``` 14 | firebase.notifications.Android.Visibility.Private 15 | ``` 16 | 17 | ### Public 18 | 19 | Show this notification in its entirety on all lockscreens. 20 | 21 | ``` 22 | firebase.notifications.Android.Visibility.Public 23 | ``` 24 | 25 | ### Secret 26 | 27 | Do not reveal any part of this notification on a secure lockscreen. 28 | 29 | ``` 30 | firebase.notifications.Android.Visibility.Secret 31 | ``` 32 | -------------------------------------------------------------------------------- /docs/notifications/reference/IOSAttachment.md: -------------------------------------------------------------------------------- 1 | # IOSAttachment 2 | 3 | Information about an attachment displayed as part of an IOS Notification. 4 | 5 | ## Properties 6 | 7 | ### identifier 8 | [method]identifier returns string;[/method] 9 | 10 | The ID of the attachment. 11 | 12 | ### options 13 | [method]options returns optional [ref notifications.IOSAttachmentOptions];[/method] 14 | 15 | The optional options object defining the behaviour of the attachment. 16 | 17 | ### url 18 | [method]url returns string;[/method] 19 | 20 | The URL of the attachment. 21 | -------------------------------------------------------------------------------- /docs/notifications/reference/IOSAttachmentOptions.md: -------------------------------------------------------------------------------- 1 | # IOSAttachmentOptions 2 | 3 | Controls how an attachment is displayed as part of an IOS Notification. 4 | 5 | ## Properties 6 | 7 | ### typeHint 8 | [method]typeHint returns string;[/method] 9 | 10 | A hint about an attachment’s file type. 11 | 12 | ### thumbnailHidden 13 | [method]thumbnailHidden returns boolean;[/method] 14 | 15 | A Boolean value indicating whether the attachment’s thumbnail is hidden. 16 | 17 | ### thumbnailClippingRect 18 | [method]thumbnailClippingRect returns Object;[/method] 19 | 20 | The clipping rectangle for a thumbnail image defined as an Object with `height`, `width`, `x` and `y` properties. 21 | 22 | ### typeHint 23 | [method]thumbnailTime returns string;[/method] 24 | 25 | The frame number of an animation to use as a thumbnail image. 26 | -------------------------------------------------------------------------------- /docs/notifications/reference/IOSNotifications.md: -------------------------------------------------------------------------------- 1 | # IOSNotifications 2 | 3 | This deals with iOS-specific Notification functionality. 4 | 5 | 6 | ## Properties 7 | 8 | ### shouldAutoComplete 9 | [method]shouldAutoComplete returns boolean;[/method] 10 | 11 | Controls whether notifications are automatically completed. 12 | 13 | If `true` then the notification is immediately completed with the assumed value of `backgroundFetchResult.noData` and [ref notifications.IOSNofication]'s `complete` function is `undefined`. 14 | 15 | If `false` then you must handle notification completion manually via [ref notifications.IOSNotification]'s `complete` function. 16 | 17 | > See the native [application:didReceiveRemoteNotification:fetchCompletionHandler:](https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623013-application?language=objc) method for more details on iOS notification completion. 18 | 19 | ### backgroundFetchResult 20 | [method]backgroundFetchResult returns Object;[/method] 21 | 22 | Returns an object with keys `noData`, `newData` and `failure`. The value for one of these keys should be used when calling [ref notifications.IOSNotification#complete]. 23 | 24 | [example Example] 25 | ```javascript 26 | const newDataResult = firebase.notifications().ios.backgroundFetchResult.newData; 27 | notification.ios.complete(newDataResult); 28 | ``` 29 | [/example] 30 | 31 | > See the native [application:didReceiveRemoteNotification:fetchCompletionHandler:](https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623013-application?language=objc) method for more details on iOS notification completion. -------------------------------------------------------------------------------- /docs/notifications/reference/Notification.md: -------------------------------------------------------------------------------- 1 | # Notification 2 | 3 | ``` 4 | firebase.notifications.Notification 5 | ``` 6 | 7 | ### Notification 8 | [method]new Notification();[/method] 9 | 10 | A Notification can be displayed instantly or scheduled to be displayed at some point in the future. 11 | 12 | To display a Notification, first populate it by using the `setX` methods described below, then pass it to `firebase.notifications().displayNotification(notification)` or `firebase.notifications().scheduleNotification(notification, schedule)`; 13 | 14 | ## Properties 15 | 16 | ### android 17 | [method]android returns [ref notifications.AndroidNotification];[/method] 18 | 19 | Gets the Android specific properties of the notification. 20 | 21 | ### body 22 | [method]body returns string;[/method] 23 | 24 | Gets the body of the notification. 25 | 26 | ### data 27 | [method]data returns Object;[/method] 28 | 29 | Gets the custom data associated with the notification. 30 | 31 | ### ios 32 | [method]ios returns [ref notifications.IOSNotification];[/method] 33 | 34 | Gets the iOS specific properties of the notification. 35 | 36 | ### notificationId 37 | [method]notificationId returns string;[/method] 38 | 39 | Gets the ID of the notification. 40 | 41 | ### sound 42 | [method]sound returns nullable string;[/method] 43 | 44 | Gets the optional sound of the notification. 45 | 46 | ### subtitle 47 | [method]subtitle returns nullable string;[/method] 48 | 49 | Gets the optional subtitle of the notification. 50 | 51 | ### title 52 | [method]title returns string;[/method] 53 | 54 | Gets the title of the notification. 55 | 56 | ## Methods 57 | 58 | ### setBody 59 | [method]setBody(body) returns [ref notifications.Notification];[/method] 60 | 61 | Sets the body for the notification. 62 | 63 | | Parameter | | 64 | | --------- | ------- | 65 | | body | **string**
The body. | 66 | 67 | ### setData 68 | [method]setData(data) returns [ref notifications.Notification];[/method] 69 | 70 | Sets the custom data for the notification. 71 | 72 | | Parameter | | 73 | | --------- | ------- | 74 | | data | **Object**
The custom data. | 75 | 76 | ### setNotificationId 77 | [method]setNotificationId(notificationId) returns [ref notifications.Notification];[/method] 78 | 79 | Sets the ID for the notification. 80 | 81 | | Parameter | | 82 | | --------- | ------- | 83 | | notificationId | **string**
The notification's ID. | 84 | 85 | ### setSound 86 | [method]setSound(sound) returns [ref notifications.Notification];[/method] 87 | 88 | Sets the sound for the notification. 89 | 90 | | Parameter | | 91 | | --------- | ------- | 92 | | sound | **string**
The sound. | 93 | 94 | ### setSubtitle 95 | [method]setSubtitle(subtitle) returns [ref notifications.Notification];[/method] 96 | 97 | Sets the subtitle for the notification. 98 | 99 | | Parameter | | 100 | | --------- | ------- | 101 | | subtitle | **string**
The subtitle. | 102 | -------------------------------------------------------------------------------- /docs/notifications/reference/NotificationOpen.md: -------------------------------------------------------------------------------- 1 | # NotificationOpen 2 | 3 | Object giving information about the action that was taken when a specific notification was opened. 4 | 5 | ## Properties 6 | 7 | ### action 8 | [method]action returns string;[/method] 9 | 10 | The action that was used when the notification was opened. 11 | 12 | ### notification 13 | [method]notification returns [ref notifications.Notification];[/method] 14 | 15 | Information about the notification that was opened. 16 | 17 | ### results 18 | [method]results returns nullable Object;[/method] 19 | 20 | If the notification contains a [ref notifications.AndroidRemoteInput] then this object will be populated with the user's input. 21 | 22 | > Android only 23 | -------------------------------------------------------------------------------- /docs/notifications/reference/Schedule.md: -------------------------------------------------------------------------------- 1 | # Schedule 2 | 3 | Object giving information about the schedule to use for a notification. 4 | 5 | ## Properties 6 | 7 | ### exact 8 | [method]exact returns nullable boolean;[/method] 9 | 10 | > Android only 11 | 12 | If the fireDate should be respected exactly, i.e. for reminders, or if it can deviate slightly to save battery. 13 | 14 | ### fireDate 15 | [method]fireDate returns number;[/method] 16 | 17 | The date when the notification should first be shown, in milliseconds since 1970. 18 | 19 | ### repeatInterval 20 | [method]repeatInterval returns nullable string;[/method] 21 | 22 | How frequently the notification should be repeated. One of `minute`, `hour`, `day` or `week`. 23 | 24 | If not present, the notification will be displayed once. -------------------------------------------------------------------------------- /docs/notifications/scheduling-notifications.md: -------------------------------------------------------------------------------- 1 | # Scheduling Notifications 2 | 3 | Both Android and iOS allow notifications to be scheduled to display at some point in the future. 4 | 5 | ## 1) Building a notification 6 | 7 | To build a notification, follow the [Displaying Notifications Guide](version /notifications/displaying-notifications). 8 | 9 | ## 2) Scheduling the notification 10 | 11 | ### (Android) Set up a notification channel 12 | 13 | Before you can schedule a notification on Android, you must ensure you have created a Notification Channel, as explained [here](version /notifications/android-channels). 14 | 15 | ### Schedule the notification 16 | 17 | ```js 18 | // Build notification 19 | const notification = new firebase.notifications.Notification()...; 20 | 21 | // Schedule the notification for 1 minute in the future 22 | const date = new Date(); 23 | date.setMinutes(date.getMinutes() + 1); 24 | 25 | firebase.notifications().scheduleNotification(notification, { 26 | fireDate: date.getTime(), 27 | }) 28 | ``` 29 | 30 | For full reference documentation, please see [ref notifications.Notifications#scheduleNotification]. -------------------------------------------------------------------------------- /docs/perf-mon/android.md: -------------------------------------------------------------------------------- 1 | # Android Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup). 4 | 5 | ## Add the dependency 6 | 7 | Add the Firebase Performance Monitoring dependency to `android/app/build.gradle`: 8 | 9 | ```groovy 10 | dependencies { 11 | // ... 12 | implementation "com.google.firebase:firebase-perf:{{ android.firebase.perf }}" 13 | } 14 | ``` 15 | 16 | Performance Monitoring also requires the Firebase Plugins dependency. In your projects `android/build.gradle` file, add the plugin to your dependencies: 17 | 18 | ```groovy 19 | dependencies { 20 | // ... 21 | classpath 'com.google.firebase:firebase-plugins:{{ android.firebase.plugins }}' 22 | } 23 | ``` 24 | 25 | At the top of your `android/app/build.gradle` file, below other plugins, apply the `firebase-perf` plugin: 26 | 27 | ```groovy 28 | apply plugin: "com.android.application" 29 | apply plugin: "com.google.firebase.firebase-perf" 30 | ``` 31 | 32 | ## Install the RNFirebase Performance package 33 | 34 | Add the `RNFirebasePerformancePackage` to your `android/app/src/main/java/com/[app name]/MainApplication.java`: 35 | 36 | ```java 37 | // ... 38 | import io.invertase.firebase.RNFirebasePackage; 39 | import io.invertase.firebase.perf.RNFirebasePerformancePackage; // <-- Add this line 40 | 41 | public class MainApplication extends Application implements ReactApplication { 42 | // ... 43 | 44 | @Override 45 | protected List getPackages() { 46 | return Arrays.asList( 47 | new MainReactPackage(), 48 | new RNFirebasePackage(), 49 | new RNFirebasePerformancePackage() // <-- Add this line 50 | ); 51 | } 52 | }; 53 | // ... 54 | } 55 | ``` 56 | -------------------------------------------------------------------------------- /docs/perf-mon/ios.md: -------------------------------------------------------------------------------- 1 | # iOS Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup). 4 | 5 | ## Add the pod 6 | 7 | Add the following to your `Podfile`: 8 | 9 | ```ruby 10 | pod 'Firebase/Performance', '~> {{ ios.firebase.perf }}' 11 | ``` 12 | 13 | Run `pod update`. 14 | -------------------------------------------------------------------------------- /docs/perf-mon/reference/HttpMetric.md: -------------------------------------------------------------------------------- 1 | # HttpMetric 2 | 3 | ?> **Upcoming Change Notification:** Note that this API is likely to change in v6.0.0 to convert all Trace / HttpMetric methods (except start & stop) to be synchronous JS side methods. The API implemented currently is an initial draft to allow early access. 4 | 5 | > Once a trace has been started and stopped, you cannot re-start it in the same app lifecycle. 6 | 7 | ## start 8 | [method]httpMetric.start() returns Promise;[/method] 9 | 10 | Initializes the http metric to start. 11 | 12 | ## stop 13 | [method]httpMetric.stop() returns Promise;[/method] 14 | 15 | Stops performance tracing. The completed trace stats are now sent to Firebase. 16 | 17 | > Results are not realtime. They can take a number of hours to appear in the Firebase console. 18 | 19 | ## getAttribute 20 | [method]httpMetric.getAttribute(attribute) returns Promise;[/method] 21 | 22 | Returns an attribute value, or null if it does not exist. 23 | 24 | | Parameter | | 25 | | --------- | ------- | 26 | | attribute | **string** | 27 | 28 | ## getAttributes 29 | [method]httpMetric.getAttributes() returns Promise;[/method] 30 | 31 | Returns an object of key (attribite) value pairs, or an empty object if no attributes exist. 32 | 33 | ## putAttribute 34 | [method]httpMetric.putAttribute(attribute, value) returns Promise;[/method] 35 | 36 | Creates or updates an attribute by name. 37 | 38 | Returns true if attributes was added, false otherwise. 39 | 40 | | Parameter | | 41 | | --------- | ------- | 42 | | attribute | **string** | 43 | | value | **string** | 44 | 45 | ## removeAttribute 46 | [method]httpMetric.removeAttribute(attribute) returns Promise;[/method] 47 | 48 | Returns an attribute value, or null if it does not exist. 49 | 50 | | Parameter | | 51 | | --------- | ------- | 52 | | attribute | **string** | 53 | 54 | ## setHttpResponseCode 55 | [method]httpMetric.setHttpResponseCode(code) returns Promise;[/method] 56 | 57 | | Parameter | | 58 | | --------- | ------- | 59 | | code | **number**
HTTP response code, e.g. 200, 404, 500 | 60 | 61 | ## setRequestPayloadSize 62 | [method]httpMetric.setRequestPayloadSize(bytes) returns Promise;[/method] 63 | 64 | | Parameter | | 65 | | --------- | ------- | 66 | | bytes | **number**
Request payload size in bytes | 67 | 68 | ## setResponseContentType 69 | [method]httpMetric.setResponseContentType(type) returns Promise;[/method] 70 | 71 | | Parameter | | 72 | | --------- | ------- | 73 | | type | **string**
HTTP response content-type, e.g. application/json | 74 | 75 | ## setResponsePayloadSize 76 | [method]httpMetric.setResponsePayloadSize(bytes) returns Promise;[/method] 77 | 78 | | Parameter | | 79 | | --------- | ------- | 80 | | bytes | **number**
Response payload size in bytes | 81 | -------------------------------------------------------------------------------- /docs/perf-mon/reference/Trace.md: -------------------------------------------------------------------------------- 1 | # Trace 2 | 3 | ?> **Upcoming Change Notification:** This implementations API is likely to change in `v6.0.0` to convert all Trace / HttpMetric methods (except start & stop) to be synchronous JS side methods. The API implemented currently is an initial draft to allow early access. 4 | 5 | > Once a trace has been started and stopped, you cannot re-start it in the same app lifecycle. 6 | 7 | ## start 8 | [method]trace.start() returns void;[/method] 9 | 10 | Initializes the trace to start tracing performance to relay back to Firebase. 11 | 12 | ## stop 13 | [method]trace.stop() returns void;[/method] 14 | 15 | Stops performance tracing. The completed trace stats are now sent to Firebase. 16 | 17 | > Results are not realtime. They can take a number of hours to appear in the Firebase console. 18 | 19 | ## getAttribute 20 | [method]trace.getAttribute(attribute) returns Promise;[/method] 21 | 22 | Gets a trace attribute, or null if it does not exist. 23 | 24 | | Parameter | | 25 | | --------- | ------- | 26 | | attribute | **string**
Attribute name | 27 | 28 | ## getAttributes 29 | [method]trace.getAttributes() returns Promise;[/method] 30 | 31 | Returns an object of key (attribite) value pairs, or an empty object if no attributes exist. 32 | 33 | ## putAttribute 34 | [method]trace.putAttribute(attribute, value) returns Promise;[/method] 35 | 36 | Gets a trace attribute, or null if it does not exist. 37 | 38 | | Parameter | | 39 | | --------- | ------- | 40 | | attribute | **string** | 41 | | value | **string** | 42 | 43 | ## removeAttribute 44 | [method]httpMetric.removeAttribute(attribute) returns Promise;[/method] 45 | 46 | Returns an attribute value, or null if it does not exist. 47 | 48 | | Parameter | | 49 | | --------- | ------- | 50 | | attribute | **string** | 51 | 52 | ## getMetric 53 | [method]trace.getMetric(metricName) returns Promise;[/method] 54 | 55 | Gets a trace metric value. Returns zero if metric has not been set. 56 | 57 | | Parameter | | 58 | | --------- | ------- | 59 | | metricName | **string**
Metric name | 60 | 61 | ## putMetric 62 | [method]trace.putMetric(metricName, value) returns Promise;[/method] 63 | 64 | Gets a trace metric value. Returns zero if metric has not been set. 65 | 66 | | Parameter | | 67 | | --------- | ------- | 68 | | metricName | **string**
Metric name | 69 | | value | **number**
Initial metric value | 70 | 71 | ## incrementMetric 72 | [method]trace.incrementMetric(metricName, incrementBy) returns Promise;[/method] 73 | 74 | Increments a metric value by a given amount. If metric has not been set, a new one is created. 75 | 76 | | Parameter | | 77 | | --------- | ------- | 78 | | metricName | **string**
Metric name | 79 | | incrementBy | **number**
Number to increment metric by | 80 | 81 | -------------------------------------------------------------------------------- /docs/perf-mon/reference/perf-mon.md: -------------------------------------------------------------------------------- 1 | # Performance Monitoring 2 | 3 | ``` 4 | firebase.perf 5 | ``` 6 | 7 | ?> **Upcoming Change:** Note that this API is likely to change in v5.1.0 to convert all Trace / HttpMetric methods (except start & stop) to be synchronous JS side methods. The API implemented currently is an initial draft to allow early access. 8 | 9 | Firebase Performance Monitoring captures a number of traces automatically, such as all outbound HTTP requests, app boot time and more. 10 | 11 | ## Methods 12 | 13 | The following methods are accessed via the Performance Monitoring instance `firebase.perf()`. 14 | 15 | ### setPerformanceCollectionEnabled 16 | [method]setPerformanceCollectionEnabled(enabled) returns void;[/method] 17 | 18 | Enables or disables performance monitoring. 19 | 20 | | Parameter | | 21 | | --------- | ------- | 22 | | enabled | **boolean**
Whether monitoring is enabled or disabled | 23 | 24 | ### newTrace 25 | [method]newTrace(id) returns [ref perf-mon.Trace];[/method] 26 | 27 | Returns a new instance of Trace. The id is the unique name of something you'd like to run performance monitoring against. 28 | 29 | | Parameter | | 30 | | --------- | ------- | 31 | | id | **string**
The unique name of the trace to monitor | 32 | 33 | ### newHttpMetric 34 | [method]newHttpMetric(url, method) returns [ref perf-mon.HttpMetric];[/method] 35 | 36 | Returns a new instance of HttpMetric. 37 | 38 | | Parameter | | 39 | | --------- | ------- | 40 | | url | **string**
The full URL of the new request | 41 | | method | **string**
The HTTP method of the request. One of: GET, PUT, POST, DELETE, HEAD, PATCH, OPTIONS, TRACE, CONNECT | 42 | 43 | ## Classes 44 | 45 | ### Trace 46 | 47 | [ref perf-mon.Trace] 48 | 49 | ### HttpMetric 50 | 51 | [ref perf-mon.HttpMetric] 52 | -------------------------------------------------------------------------------- /docs/reference.md: -------------------------------------------------------------------------------- 1 | # Storage 2 | 3 | -------------------------------------------------------------------------------- /docs/release-notes.md: -------------------------------------------------------------------------------- 1 | ## Latest Version 2 | 3 | The latest version is `v5.2.1`; 4 | 5 | [➡️ View the Release Notes](/docs/v5.x.x/releases/v5.2.0) 6 | 7 | ## Older Versions 8 | 9 | - [v5.1.1](/docs/v5.x.x/releases/v5.1.1) 10 | - [v5.1.0](/docs/v5.x.x/releases/v5.1.0) 11 | - [v5.0.0](/docs/v5.x.x/releases/v5.0.0) 12 | -------------------------------------------------------------------------------- /docs/releases/v5.1.1.md: -------------------------------------------------------------------------------- 1 | ## 5.1.1 2 | 3 | This patch release is mainly to fix several minor typings issues (TS & Flow). 4 | 5 | Thanks to all our [contributors](https://github.com/invertase/react-native-firebase/compare/v5.1.0...v5.1.1). 💛 6 | 7 | You can compare all changes between v5.1.0 and v5.1.1 [here](https://github.com/invertase/react-native-firebase/compare/v5.1.0...v5.1.1). 8 | 9 | ### Upgrade from v5.1.0 10 | 11 | No native code or dependency version changes required. Install the latest version via NPM: 12 | 13 | ```bash 14 | npm install --save react-native-firebase@5.1.1 15 | ``` 16 | 17 | ---- 18 | 19 | ### General 20 | 21 | - [TYPESCRIPT] [ENHANCEMENT] [ANALYTICS] Add `setUserProperties` type definition 22 | - [TYPESCRIPT] [ENHANCEMENT] [AUTHENTICATION] Improve TS types for auth listeners 23 | - [TYPESCRIPT] [ENHANCEMENT] [STORAGE] Export storage statics (`.Native`, `.TaskState` and `.TaskEvent`) - fixes #1706 24 | - [TYPESCRIPT] [ENHANCEMENT] [FIRESTORE] Improve `onSnapshot` error type definitions - fixes #1708 25 | - [FLOW] [BUGFIX] [LINKS] Change return type to `string` literal instead of incorrect usage of `String` 26 | - [TESTS] [ENHANCEMENT] [DATABASE] Improve query test coverage 27 | 28 | ---- 29 | 30 | ### Android 31 | 32 | - [ANDROID] [BUGFIX] [NOTIFICATIONS] Added missing input text result field to `notificationOpen` object 33 | - [ANDROID] [ENHANCEMENT] [BUILD] Update build script to also read Android sources from `react-native` root directory - fixes #1697 34 | 35 | ---- 36 | 37 | ### iOS 38 | 39 | - [IOS] [BUGFIX] [AUTHENTICATION] `authStateChanged` listeners now correctly torn down between RN reloads - fixes #1677 40 | 41 | ---- 42 | 43 | ## Feedback 44 | 45 | We want your feedback! 46 | 47 | If you have any comments and suggestions or want to report an issue, come find us on [Discord](https://discord.gg/C9aK28N), [Twitter](https://twitter.com/rnfirebase) or [GitHub](https://github.com/invertase/react-native-firebase). 48 | 49 | ## Contributing 50 | 51 | Thank to [all the contributors](https://github.com/invertase/react-native-firebase/graphs/contributors?from=2018-06-28&to=2020-01-01&type=c) that made this release happen 💛. 52 | 53 | If you'd like to contribute please check out our new [testing](https://rnfirebase.io/docs/v5.x.x/testing) and [contributing](https://rnfirebase.io/docs/v5.x.x/contributing) guides. 54 | 55 | ## Other Releases 56 | 57 | [View other releases.](/docs/v5.x.x/release-notes) 58 | -------------------------------------------------------------------------------- /docs/storage/android.md: -------------------------------------------------------------------------------- 1 | # Android Installation 2 | 3 | ## Add the dependency 4 | 5 | Add the Firebase Storage dependency to `android/app/build.gradle`: 6 | 7 | ```groovy 8 | dependencies { 9 | // ... 10 | implementation "com.google.firebase:firebase-storage:{{ android.firebase.storage }}" 11 | } 12 | ``` 13 | 14 | ## Install the RNFirebase Storage package 15 | 16 | Add the `RNFirebaseStoragePackage` to your `android/app/src/main/java/com/[app name]/MainApplication.java`: 17 | 18 | ```java 19 | // ... 20 | import io.invertase.firebase.RNFirebasePackage; 21 | import io.invertase.firebase.storage.RNFirebaseStoragePackage; // <-- Add this line 22 | 23 | public class MainApplication extends Application implements ReactApplication { 24 | // ... 25 | 26 | @Override 27 | protected List getPackages() { 28 | return Arrays.asList( 29 | new MainReactPackage(), 30 | new RNFirebasePackage(), 31 | new RNFirebaseStoragePackage() // <-- Add this line 32 | ); 33 | } 34 | }; 35 | // ... 36 | } 37 | ``` 38 | -------------------------------------------------------------------------------- /docs/storage/ios.md: -------------------------------------------------------------------------------- 1 | # iOS Installation 2 | 3 | First ensure you have followed the [initial setup guide](version /installation/initial-setup). 4 | 5 | ## Add the pod 6 | 7 | Add the following to your `Podfile`: 8 | 9 | ```ruby 10 | pod 'Firebase/Storage', '~> {{ ios.firebase.storage }}' 11 | ``` 12 | 13 | Run `pod update`. 14 | -------------------------------------------------------------------------------- /docs/storage/reference/StorageTask.md: -------------------------------------------------------------------------------- 1 | ## TODO 2 | 3 | These docs are still WIP. Please see the below links as reference for the time being: 4 | 5 | https://github.com/invertase/react-native-firebase/blob/docs_old/docs/modules/storage.md 6 | https://github.com/invertase/react-native-firebase/blob/master/tests/src/tests/storage/storageTests.js 7 | 8 | https://github.com/invertase/react-native-firebase/blob/master/lib/modules/storage/reference.js 9 | https://github.com/invertase/react-native-firebase/blob/master/lib/modules/storage/task.js 10 | 11 | PR's to contribute to docs are welcome. 12 | -------------------------------------------------------------------------------- /docs/troubleshooting/ios.md: -------------------------------------------------------------------------------- 1 | # iOS Troubleshooting 2 | 3 | ## Failing to recognize the GoogleService-Info.plist 4 | 5 | If the `GoogleService-Info.plist` is not registered with XCode, your app will crash right after starting. You can verify the file is not registered if you open your project in Xcode and don't see the file in your app's directory listing. 6 | 7 | To fix this, first make sure your `GoogleService-Info.plist` from google is present in the `YOUR_APP/ios` directory. Next open Xcode and open the folder tab and then open your project. You should see the `AppDelegate.h` file and other important files. Right click on your project and click on the option that says "Add Files to YOUR_APP". Select `GoogleService-Info.plist`. You should now see it in your project. Finally, rebuild your app. 8 | 9 | 10 | ## Duplicate Symbols / Undefined Symbols (build time error) 11 | 12 | Unfortunately, XCode can get in a bit of a mess every now and again, particularly when updating to new versions of `react-native-firebase` or the Firebase pods. If you get a Duplicate Symbols or Undefined Symbols error then you're likely to need to do a proper clean of your workspace. 13 | 14 | To do this, try the following in xcode: 15 | 16 | ```javascript 17 | 1) Do product > clean 18 | 2) Close Xcode 19 | 3) Re-run pod install (from the command line) 20 | 4) Re-open the .xcworkspace 21 | 5) Do product > clean 22 | 6) Try a build 23 | ``` 24 | -------------------------------------------------------------------------------- /ios-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/invertase/react-native-firebase-docs/cb0330930f057f2c2aaef1dddd72d98fc7a33e70/ios-logo.png --------------------------------------------------------------------------------