summaryrefslogtreecommitdiff
path: root/StoneIsland/plugins/phonegap-plugin-push/docs/INSTALLATION.md
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/plugins/phonegap-plugin-push/docs/INSTALLATION.md')
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/docs/INSTALLATION.md166
1 files changed, 64 insertions, 102 deletions
diff --git a/StoneIsland/plugins/phonegap-plugin-push/docs/INSTALLATION.md b/StoneIsland/plugins/phonegap-plugin-push/docs/INSTALLATION.md
index ea8f6918..830bbdd7 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/docs/INSTALLATION.md
+++ b/StoneIsland/plugins/phonegap-plugin-push/docs/INSTALLATION.md
@@ -4,7 +4,6 @@
- [Android details](#android-details)
- [Compilation](#compilation)
- [Co-existing with Facebook Plugin](#co-existing-with-facebook-plugin)
- - [Co-existing with plugins that use Firebase](#co-existing-with-plugins-that-use-firebase)
- [Common errors](#common-errors)
- [minSdkVersion === 14](#minsdkversion--14)
- [Multidex](#multidex)
@@ -17,65 +16,52 @@
- [Bitcode](#bitcode)
- [CocoaPods](#cocoapods)
- [Common CocoaPod Installation issues](#common-cocoapod-installation-issues)
- - [CocoaPod Disk Space](#cocoapod-disk-space)
- - [Library not found for -lPods-Appname](#library-not-found-for--lPods-Appname)
- - [Library not found for -lGoogleToolboxForMac](#library-not-found-for--lPods-Appname)
- [Additional Resources](#additional-resources)
## Installation Requirements
Plugin version | Cordova CLI | Cordova Android | Cordova iOS | CocoaPods
---- | ---- | ---- | ---- | ----
-2.0.0 | 7.0.0 | 6.2.1 | 4.4.0 | 1.1.1
1.9.0 | 6.4.0 | 6.0.0 | 4.3.0 | 1.1.1
1.8.0 | 3.6.3 | 4.0.0 | 4.1.0 | N/A
To install from the command line:
```
-phonegap plugin add phonegap-plugin-push
+phonegap plugin add phonegap-plugin-push --variable SENDER_ID="XXXXXXX"
```
or
```
-cordova plugin add phonegap-plugin-push
+cordova plugin add phonegap-plugin-push --variable SENDER_ID="XXXXXXX"
```
It is also possible to install via repo url directly ( unstable )
```
-phonegap plugin add https://github.com/phonegap/phonegap-plugin-push
+phonegap plugin add https://github.com/phonegap/phonegap-plugin-push --variable SENDER_ID="XXXXXXX"
```
or
```
-cordova plugin add https://github.com/phonegap/phonegap-plugin-push
+cordova plugin add https://github.com/phonegap/phonegap-plugin-push --variable SENDER_ID="XXXXXXX"
```
-As of version 2.0.0 the SENDER_ID parameter has been removed at install time. Instead you put your google-services.json (Android) and/or GoogleService-Info.plist in the root folder of your project and then add the following lines into your config.xml.
+Where the `XXXXXXX` in `SENDER_ID="XXXXXXX"` maps to the project number in the [Google Developer Console](https://www.google.ca/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwikqt3nyPjMAhXJ5iYKHR0qDcsQFggbMAA&url=https%3A%2F%2Fconsole.developers.google.com%2F&usg=AFQjCNF0eH059mv86nMIlRmfsf42kde-wA&sig2=BQ2BJpchw1CpGt87sk5p6w&bvm=bv.122852650,d.eWE). To find the project number login to the Google Developer Console, select your project and click the menu item in the screen shot below to display your project number.
-In the platform tag for Android add the resource-file tag:
+![zzns8](https://cloud.githubusercontent.com/assets/353180/15588897/2fc14db2-235e-11e6-9326-f97fe0ec15ab.png)
-```
-<platform name="android">
- <resource-file src="google-services.json" target="google-services.json" />
-</platform>
-```
-
-In the platform tag for iOS add the resource-file tag:
-
-```
-<platform name="ios">
- <resource-file src="GoogleService-Info.plist" />
-</platform>
-```
+If you are not creating an Android application you can put in anything for this value.
> Note: if you are using Ionic you may need to specify the SENDER_ID variable in your package.json.
```
"cordovaPlugins": [
{
+ "variables": {
+ "SENDER_ID": "XXXXXXX"
+ },
"locator": "phonegap-plugin-push"
}
]
@@ -84,17 +70,23 @@ In the platform tag for iOS add the resource-file tag:
> Note: You need to specify the SENDER_ID variable in your config.xml if you plan on installing/restoring plugins using the prepare method. The prepare method will skip installing the plugin otherwise.
```
-<plugin name="phonegap-plugin-push" spec="2.0.0" />
+<plugin name="phonegap-plugin-push" spec="1.6.0">
+ <param name="SENDER_ID" value="XXXXXXX" />
+</plugin>
```
## Android details
### Compilation
-As of version 2.0.0 the plugin has been switched to using pinned version of Gradle libraries. You will need to ensure that you have installed the following items through the Android SDK Manager:
+As of version 1.3.0 the plugin has been switched to using Gradle/Maven for building.
+
+You will need to ensure that you have installed the following items through the Android SDK Manager:
-- Android Support Library version 25.1.0
-- FirebaseMessaging Library version 9.8.0
+- Android Support Library version 23 or greater
+- Local Maven repository for Support Libraries (formerly Android Support Repository) version 20 or greater
+- Google Play Services version 27 or greater
+- Google Repository version 22 or greater
![android support library](https://cloud.githubusercontent.com/assets/353180/10230226/0627931e-684a-11e5-9a6b-72d72997f655.png)
@@ -121,30 +113,6 @@ or
cordova plugin add --save cordova-plugin-facebook4 --variable APP_ID="App ID" --variable APP_NAME="App Name"
```
-### Co-existing with plugins that use Firebase
-
-Problems may arise when push plugin is used along plugins that implement Firebase functionality (cordova-plugin-firebase-analytics, for example). Firebase uses `@string/google_app_id`, as does the push plugin, though the value format differs, causing problems like this: `Invalid google_app_id. Firebase Analytics disabled`.
-
-To make the two work together, you need to migrate your GCM project from Google console to Firebase console:
-
-1) In Firebase console - [import your existing GCM project](https://firebase.google.com/support/guides/google-android#migrate_your_console_project), don't create a new one.
-2) Set your `SENDER_ID` variable to match the id of your imported Firebase project. In case of cordova, your `config.xml` would look something like this:
-```xml
-<plugin name="phonegap-plugin-push" spec="~1.10.0">
- <variable name="SENDER_ID" value="1:956432534015:android:df201d13e7261425" />
-</plugin>
-```
-3) In your JavaScript, when you init the PushPlugin, senderID remains the same format as before:
-```javascript
-PushNotification.init({
- android: {
- senderID: 956432534015
- }
-});
-```
-
-*Note:* No changes on the back-end side are needed: [even though recommended](https://developers.google.com/cloud-messaging/android/android-migrate-fcm#update_server_endpoints), it isn't yet required and sending messages through GCM gateway should work just fine.
-
### Common errors
#### minSdkVersion === 14
@@ -255,21 +223,11 @@ cordova platform update ios@4.0.0
### CocoaPods
-Required `cordova-cli` minimum version: `6.4.0`
-
-Required `cordova-ios` minimum version: `4.3.0`
-
-Required `CocoaPods` minimum version: `1.0.1`
+Required `cordova-cli` version: `6.4.0`
+Required `cordova-ios` version: `4.3.0`
-To install CocoaPods, please follow the installation instructions [here](https://guides.cocoapods.org/using/getting-started). After installing CocoaPods, please run:
-
- pod setup
-
-This will clone the required CocoaPods specs-repo into your home folder at `~/.cocoapods/repos`, so it might take a while. See the [CocoaPod Disk Space](#cocoapod-disk-space) section below for more information.
-
-
-Version `2.0.0` (and above) of this plugin supports [CocoaPods](https://cocoapods.org) installation of the [Firebase Cloud Messaging](https://cocoapods.org/pods/FirebaseMessaging) library.
+Version `1.9.0` (and above) of this plugin supports [CocoaPods](https://cocoapods.org) installation of the [Google Cloud Messaging](https://cocoapods.org/pods/GoogleCloudMessaging) library.
If you are installing this plugin using `npm`, and you are using version `6.1.0` or greater of the `cordova-cli`, it will automatically download the right version of this plugin for both your platform and cli.
@@ -297,55 +255,59 @@ Failed to install 'phonegap-plugin-push':Error: pod: Command failed with exit co
Error: pod: Command failed with exit code 1
```
-Please run the command `pod repo update` and re-install the plugin. You would only run `pod repo update` if you have the specs-repo already cloned on your machine through `pod setup`.
-
-##### CocoaPod Disk Space
-
-Running `pod setup` can take over 1 GB of disk space and that can take quite some time to download over a slow internet connection. If you are having issues with disk space/network try this neat hack from @VinceOPS.
+Please run the command `pod repo update` and re-install the plugin.
-```
-git clone --verbose --depth=1 https://github.com/CocoaPods/Specs.git ~/.cocoapods/repos/master
-pod setup --verbose
-```
+## Additional Resources
-##### Library not found for -lPods-Appname
+The push plugin enables you to play sounds and display different icons during push (Android only). These additional resources need to be added to your projects `platforms` directory in order for them to be included into your final application binary. One way of doing it is to create a hook to do the copying for you on each build.
-If you open the app in Xcode and you get an error like:
+First create a `scripts` directory in the root of your project. Next add a file to the scripts directory called `copy_resource_files.js`. The contents of the file will look something like this:
-```
-ld: library not found for -lPods-Appname
-clang: error: linker command failed with exit code 1
-```
+```javascript
+#!/usr/bin/env node
-Then you are opening the .xcodeproj file when you should be opening the .xcworkspace file.
+// each object in the array consists of a key which refers to the source and
+// the value which is the destination.
+var filestocopy = [{
+ "resources/android/images/logo.png":
+ "platforms/android/res/drawable/logo.png"
+}, {
+ "resources/android/sounds/ring.mp3":
+ "platforms/android/res/raw/ring.mp3"
+}, {
+ "resources/ios/sounds/ring.caf":
+ "platforms/ios/YourAppName/ring.caf"
+}, ];
-##### Library not found for -lGoogleToolboxForMac
+var fs = require('fs');
+var path = require('path');
-Trying to build for iOS using the latest cocoapods (1.2.1) but failed with the following error (from terminal running cordova build ios):
+// no need to configure below
+var rootdir = process.argv[2];
+filestocopy.forEach(function(obj) {
+ Object.keys(obj).forEach(function(key) {
+ var val = obj[key];
+ var srcfile = path.join(rootdir, key);
+ var destfile = path.join(rootdir, val);
+ //console.log("copying "+srcfile+" to "+destfile);
+ var destdir = path.dirname(destfile);
+ if (fs.existsSync(srcfile) && fs.existsSync(destdir)) {
+ fs.createReadStream(srcfile).pipe(
+ fs.createWriteStream(destfile));
+ }
+ });
+});
```
-ld: library not found for -lGoogleToolboxForMac
-```
-
-Workarounds are to add the platform first and install the plugins later, or to manually run pod install on projectName/platforms/ios.
-## Additional Resources
-
-The push plugin enables you to play sounds and display different icons during push (Android only). These additional resources need to be added to your projects `platforms` directory in order for them to be included into your final application binary.
+Obviously, you'll need to modify the `filestocopy` variable to suit your needs. Pay attention to the destination path on iOS where you will need to replace `YourAppName`.
-You can now use the `resource-file` tag to deliver the image and sound files to your application. For example if you wanted to include an extra image file for only your Android build you would add the `resource-file` tag to your android `platform` tag:
+Next open up your `config.xml` file and add the following line:
+```xml
+<hook type="before_build" src="scripts/copy_resource_files.js" />
```
-<platform name="android">
- <resource-file src="myImage.png" target="res/drawable/myImage.png" />
-</platform>
-```
-
-or if you wanted to include a sound file for iOS:
+Now, when you build your app the files will get copied into your platforms directory for you.
-```
-<platform name="ios">
- <resource-file src="mySound.caf" />
-</platform>
-```
+If you are using PhoneGap Build check out these instructions on [Additional Resources](PHONEGAP_BUILD.md#additional-resources)