diff --git a/README.md b/README.md index 814d898b2..1c62c37aa 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Linphone is a free VoIP and video softphone based on the SIP protocol. ## To build liblinphone for Android, you must: -1. Download the Android sdk (API 23 at least) with platform-tools and tools updated to latest revision, then add both 'tools' and 'platform-tools' folders in your path. +1. Download the Android sdk (API 25 at least) with platform-tools and tools updated to latest revision, then add both 'tools' and 'platform-tools' folders in your path. 2. Download the Android ndk (version r11c or 13b) from google and add it to your path (no symlink !!!). @@ -60,7 +60,11 @@ You can speed up the compilation by using ccache (compiler cache, see [ccache.sa ## Firebase -To enable firebase in Linphone, just add your 'google-service.json' in project root and you key in 'res/values/non_localizable_custom.xml' +To enable firebase in Linphone, just add your 'google-service.json' in project root, add your key at 'push_sender_id' and add 'firebase' at 'push_type' in 'res/values/non_localizable_custom.xml' + +## Google + +To enable google push in Linphone, remove 'google-service.json' file if it exist, add your key at 'push_sender_id' and add 'google' at 'push_type' in 'res/values/non_localizable_custom.xml' # TROUBLESHOOTING diff --git a/build.gradle b/build.gradle index fa2e7df2c..f38675ccc 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,14 @@ // Project information buildDir = 'bin' -ext.linphonePackageName = "org.linphone" -File googleFile2 = new File('google-services.json') + +def getPackageName() { + return "org.linphone" +} + +def firebaseEnable() { + File googleFile = new File('google-services.json') + return googleFile.exists() +} buildscript { File googleFile = new File('google-services.json') @@ -19,15 +26,14 @@ buildscript { } apply plugin: 'com.android.application' -if (googleFile2.exists()) { +if (firebaseEnable()) { apply plugin: 'com.google.gms.google-services' } dependencies { - File googleFile = new File('google-services.json') compile fileTree(dir: 'libs', include: '*.jar') - if (googleFile.exists()) { + if (firebaseEnable()) { compile 'com.google.firebase:firebase-messaging:9.0.0' } else { compile 'com.android.support:support-v4:+' @@ -38,7 +44,7 @@ android { defaultConfig { compileSdkVersion 23 buildToolsVersion "25.0.2" - applicationId "org.linphone" + applicationId getPackageName() multiDexEnabled true } @@ -67,10 +73,13 @@ android { sourceSets { main { - File googleFile = new File('google-services.json') String firebase = '' - if (!googleFile.exists()) { + // Exclude firebase file if not enable + if (!firebaseEnable()) { firebase = '**/Firebase*' + println '[Push Notification] Firebase disabled' + } else { + println '[Push Notification] Firebase enabled' } manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['submodules/linphone/mediastreamer2/java/src','submodules/linphone/java/j2se','submodules/linphone/java/common','submodules/linphone/java/impl','submodules/externals/axmlrpc/src/main/java','submodules/linphone/coreapi/help/java','src'] @@ -83,7 +92,6 @@ android { java.exclude '**/mediastream/MediastreamerActivity.java' java.exclude firebase - println firebase } // Move the tests to tests/java, tests/res, etc...