Installation

R1Connect PhoneGap/Cordova Plugin

Platform Support

This plugin supports PhoneGap/Cordova apps running on iOS, Android and Windows Phone 8.

Version Requirements

This plugin is meant to work with PhoneGap 3.x - 4.x. For PhoneGap 5.x+ use branch cordova5

Installation

Overview

This integration doc assumes you have already set up Google Play Services in your application project for android, which is needed to use Google Cloud Messaging (GCM), the notification gateway R1 Connect utilizes. Also you will need to have created the app you will be using in R1 Connect.

In order to use R1 Connect with your application you will need a project number (sender ID) and API key from Google. Please visit “GCM Getting Started” here and create a google project and an API key.

If you do not want to use Push on android you can skip Google Play Services setup (but we recommend not skip this setup);

Automatic Installation using PhoneGap/Cordova CLI (iOS, Android and WP8)

  1. Install this plugin using PhoneGap/Cordova cli:

    cordova plugin add https://github.com/radiumone/r1-connect-demo-phonegap
    
  2. Modify the www/config.xml ( res/xml/config.xml for android ) directory to contain (replacing with your configuration settings) : Required (for Emitter only):

     

If you want to use Push on all platforms:

<preference name="com.radiumone.r1connect.clientKey" value="Your client Key" />

If you want to use Push on Android:

<preference name="com.radiumone.r1connect.senderId" value="Your GCM sender id" />

If you want to use Push on WP8:

<preference name="com.radiumone.r1connect.MPNSServiceName" value="[YOUR SERVICE NAME]" />
<preference name="com.radiumone.r1connect.MPNSChannelName" value="[YOUR PUSH CHANNEL]" />
<preference name="com.radiumone.r1connect.TileAllowedDomains" value="[TILE DOMAIN 1], [TILE DOMAIN 2]" />

If you have set up Google Play Services add this line

<meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

If you want to disable sending all advertising ids to the server add this line

<preference name="com.radiumone.r1connect.disableAllAdvertisingIds" value="true" />

iOS manual installation (unnecessary if installed automatically)

  1. Copy all files from src/ios with subfolders to your project
  2. Add LibR1Connect.a as a library (Target -> Build Phases -> Link Binary With Libraries)
  3. Make sure the following frameworks are linked (Target -> Build Phases -> Link Binary With Libraries):

    libsqlite3.dylib
    UIKit.framework
    Foundation.framework
    CoreGraphics.framework
    AdSupport.framework
    CoreTelephony.framework
    CoreLocation.framework
    SystemConfiguration.framework
    Security.framework
    CoreBluetooth.framework
    
  4. Modify the cordova config.xml file to include the R1ConnectPlugin and preferences:

    <feature name="R1ConnectPlugin">
        <param name="ios-package" value="R1ConnectPlugin" />
        <param name="onload" value="true" />
    </feature>
    
    <preference name="com.radiumone.r1connect.applicationId" value="Your application Id" />
    <preference name="com.radiumone.r1connect.clientKey" value="Your client Key (For Push only)" />
    
  5. Copy www/R1Connect.js into the project's www directory

  6. Require the R1Connect module var R1Connect = require('<Path to R1Connect.js>')

Android manual installation (unnecessary if installed automatically)

  1. Copy src/Android/R1ConnectPlugin.java and src/Android/CordovaPushReceiver.java files to your projects src/com/radiumone/cordova/plugin/ directory
  2. Copy src/Android/*.jar files to your projects libs directory
  3. Copy src/Android/r1connect.properties to your assets directory

  4. Modify the AndroidManifest.xml to include these permissions:

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    
    <!-- Please, replace $PACKAGE_NAME with your apps package name-->
    <uses-permission android:name="$PACKAGE_NAME.permission.C2D_MESSAGE" />
    
    <!-- Please, replace $PACKAGE_NAME with your apps package name-->
    <permission android:name="$PACKAGE_NAME.permission.C2D_MESSAGE" android:protectionLevel="signature" /> 
    
  5. Modify the AndroidManifest.xml Application section to include:

    <receiver android:exported="true" android:name="com.radiumone.emitter.gcm.R1GCMPushReceiver" android:permission="com.google.android.c2dm.permission.SEND">
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
    
            <!-- Please, replace $PACKAGE_NAME with your apps package name-->
            <category android:name="$PACKAGE_NAME" />
        </intent-filter>
    </receiver>
    <receiver android:exported="false" android:name="com.radiumone.emitter.push.R1PushBroadcastReceiver">
        <intent-filter>
            <action android:name="com.radiumone.r1push.OPENED_INTERNAL" />
        </intent-filter>
    </receiver>
    <receiver android:exported="false" android:name="com.radiumone.cordova.plugin.CordovaPushReceiver">
        <intent-filter>
            <action android:name="com.radiumone.r1push.OPENED" />
        </intent-filter>
    </receiver>
    
    <service android:name="com.radiumone.emitter.push.R1ConnectService" />
    <service android:name="com.radiumone.emitter.location.LocationService" />
    

If you have set up Google Play Services add this line

<meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
  1. Modify the cordova config.xml file to include the PushNotificationPlugin:

    <feature name="R1ConnectPlugin">
        <param name="android-package" value="com.radiumone.cordova.plugin.R1ConnectPlugin" />
    <param name="onload" value="true" />
    </feature>
    
    <preference name="com.radiumone.r1connect.applicationId" value="Your application Id" />
    <preference name="com.radiumone.r1connect.clientKey" value="Your client Key (For Push only)" />
    <preference name="com.radiumone.r1connect.senderId" value="Your google sender id (For Push only)" />
    
  2. Copy www/R1Connect.js into the project's www directory

  3. Require the R1Connect module var R1Connect = require('<Path to R1Connect.js>')

Windows Phone 8 manual installation (unnecessary if installed automatically)

  1. Copy all files from src/wp8 with subfolders to your project
  2. Select PROJECT -> Add Reference...
  3. In opened "Reference Manager" window press "Browse"
  4. Select copied libraries R1ConnectLibrary.dll, Newtonsoft.Json.dll and protobuf-net.dll
  5. Check your application Capabilities. For it
  6. Open [Your project]->Properties->WMAppManifest.xml in Solution Explorer.
  7. Select Capabilities tab
  8. Check ID_CAP_NETWORKING, ID_CAP_IDENTITY_DEVICE, ID_CAP_LOCATION
  9. Check ID_CAP_PUSH_NOTIFICATION if you want use R1 Connect Push
  10. Modify the cordova config.xml file to include the R1ConnectPlugin and preferences:
  11. Copy www/R1Connect.js into the project's www directory
  12. Require the R1Connect module var R1Connect = require('<Path to R1Connect.js>')
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk