Skip to content

Commit

Permalink
example of linking android
Browse files Browse the repository at this point in the history
  • Loading branch information
besarthoxhaj committed Sep 20, 2016
1 parent 9f73cf0 commit 4586e11
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ android {
}

dependencies {
compile project(':react-native-fcm')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
Expand Down
4 changes: 3 additions & 1 deletion android/app/src/main/java/com/android/MainApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.util.Log;

import com.facebook.react.ReactApplication;
import com.evollu.react.fcm.FIRMessagingPackage;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
Expand All @@ -23,7 +24,8 @@ protected boolean getUseDeveloperSupport() {
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
new MainReactPackage(),
new FIRMessagingPackage()
);
}
};
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<resources>

<string name="app_name">Android</string>
</resources>
2 changes: 2 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
rootProject.name = 'Android'

include ':app'
include ':react-native-fcm'
project(':react-native-fcm').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fcm/android')
8 changes: 7 additions & 1 deletion app/main.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ import FCM from 'react-native-fcm';
class Main extends Component {

componentDidMount() {
// FCM.getFCMToken().then(console.log);
console.log('FCM',FCM);
// FCM.getFCMToken()

if (FCM.getBadgeNumber) {
FCM.getBadgeNumber()
} else {
console.log('noop');
}
}

render() {
Expand Down

0 comments on commit 4586e11

Please sign in to comment.