This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Firebase.h> | |
#import "RNFirebaseNotifications.h" | |
#import "RNFirebaseMessaging.h" | |
//... | |
@implementation AppDelegate | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
platform :ios, '9.0' | |
target 'yourapp' do | |
# ... | |
pod 'Firebase/Core', '~> 6.2.0' | |
pod 'Firebase/Messaging', '~> 6.2.0' | |
# ... | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//... | |
import io.invertase.firebase.messaging.RNFirebaseMessagingPackage; | |
import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage; | |
//... | |
protected List<ReactPackage> getPackages() { | |
@SuppressWarnings("UnnecessaryLocalVariable") | |
List<ReactPackage> packages = new PackageList(this).getPackages(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
//... | |
dependencies { | |
//... | |
classpath 'com.google.gms:google-services:4.2.0' | |
//... | |
} | |
} | |
//... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//... | |
dependencies { | |
//... | |
implementation "com.google.android.gms:play-services-base:17.0.0" | |
implementation "com.google.firebase:firebase-core:17.0.1" | |
implementation "com.google.firebase:firebase-messaging:19.0.0" | |
implementation 'me.leolin:ShortcutBadger:1.1.21@aar' <-- Add this line if you wish to use badge on Android | |
//... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<uses-permission android:name="android.permission.INTERNET" /> | |
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | |
<uses-permission android:name="android.permission.VIBRATE" /> | |
... | |
<service android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService"> | |
<intent-filter> | |
<action android:name="com.google.firebase.MESSAGING_EVENT" /> | |
</intent-filter> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//... | |
async getToken() { | |
let fcmToken = await AsyncStorage.getItem('fcmToken'); | |
if (!fcmToken) { | |
fcmToken = await firebase.messaging().getToken(); | |
if (fcmToken) { | |
await AsyncStorage.setItem('fcmToken', fcmToken); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Donwload ESLint and Prettier extensions from VSCode store | |
Place the code bellow in your Settings.json | |
{ | |
"emmet.includeLanguages": { | |
"javascript": "javascriptreact" | |
}, | |
"[javascript]": { | |
"editor.formatOnSave": false | |
}, |