Skip to content

Commit

Permalink
Merge pull request #684 from superandrew213/add-gradle-configuration-…
Browse files Browse the repository at this point in the history
…property

Add gradle configuration property
  • Loading branch information
zo0r authored Mar 27, 2018
2 parents 7f0344b + 7d8f298 commit b7befef
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,18 @@ The component uses PushNotificationIOS for the iOS part.

## Android manual Installation

**NOTE: To use a specific `play-service-gcm` version, use in your `android/app/build.gradle` (change `8.1.0` for your version):**
```gradle
...
dependencies {
...
**NOTE: To use a specific `play-service-gcm` version:**

compile project(':react-native-push-notification')
compile ('com.google.android.gms:play-services-gcm:8.1.0') {
force = true;
}
In your `android/build.gradle`
```gradle
ext {
googlePlayServicesVersion = "<Your play services version>" // default: "+"
// Other settings
compileSdkVersion = "<Your compile SDK version>" // default: 23
buildToolsVersion = "<Your build tools version>" // default: "23.0.1"
targetSdkVersion = "<Your target SDK version>" // default: 23
supportLibVersion = "<Your support lib version>" // default: 23.1.1
}
```

Expand Down Expand Up @@ -141,7 +142,7 @@ PushNotification.configure({
console.log( 'NOTIFICATION:', notification );

// process the notification

// required on iOS only (see fetchCompletionHandler docs: https://facebook.github.io/react-native/docs/pushnotificationios.html)
notification.finish(PushNotificationIOS.FetchResult.NoData);
},
Expand Down
19 changes: 14 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,19 @@ allprojects {

apply plugin: 'com.android.library'

def DEFAULT_COMPILE_SDK_VERSION = 23
def DEFAULT_BUILD_TOOLS_VERSION = "23.0.1"
def DEFAULT_TARGET_SDK_VERSION = 23
def DEFAULT_SUPPORT_LIB_VERSION = "23.1.1"
def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION = "+"

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
compileSdkVersion project.hasProperty('compileSdkVersion') ? project.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
buildToolsVersion project.hasProperty('buildToolsVersion') ? project.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION

defaultConfig {
minSdkVersion 16
targetSdkVersion 23
targetSdkVersion project.hasProperty('targetSdkVersion') ? project.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
versionCode 1
versionName "1.0"
ndk {
Expand All @@ -37,10 +43,13 @@ android {
}

dependencies {
def supportLibVersion = project.hasProperty('supportLibVersion') ? project.supportLibVersion : DEFAULT_SUPPORT_LIB_VERSION
def googlePlayServicesVersion = project.hasProperty('googlePlayServicesVersion') ? project.googlePlayServicesVersion : DEFAULT_GOOGLE_PLAY_SERVICES_VERSION

compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile "com.android.support:appcompat-v7:$supportLibVersion"
compile 'com.facebook.react:react-native:+'
compile 'com.google.android.gms:play-services-gcm:+'
compile "com.google.android.gms:play-services-gcm:$googlePlayServicesVersion"
compile 'me.leolin:ShortcutBadger:1.1.8@aar'
}

0 comments on commit b7befef

Please sign in to comment.