diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d877ada..3b867487 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## Version 3.0.3 + +16-08-2016 + +* Added FCM support +* Deprecated openGcmMessage() and openGcmMessage(TaskStackBuilder customStack) with handlePushMessage() and handlePushMessage(TaskStackBuilder customStack) +* Fixed TCP connections not being fully killed when the application moves into the background +* Unread count listeners will now receive the latest unread count when they are attached +* Fixed an issue where the team profile could have an incorrect height after unlocking your device + ## Version 3.0.2 26-07-2016 diff --git a/README.md b/README.md index 39ba3245..51a191eb 100644 --- a/README.md +++ b/README.md @@ -7,17 +7,29 @@ Add the following dependency to your `build.gradle` file: ```gradle compile 'io.intercom.android:intercom-sdk:3.+' ``` +That includes the base Intercom module including GCM. +If you want to use Intercom FCM replace the line above with the following: -or if you are not using GCM: +```gradle +compile 'io.intercom.android:intercom-sdk-base:3.+' +compile 'io.intercom.android:intercom-sdk-fcm:3.+' +``` + +If you are not using Intercom push notifications you can just use: ```gradle compile 'io.intercom.android:intercom-sdk-base:3.+' ``` -`.aar` files are also included in this repo if you want to use them instead. If so then you will need to include GCM in your `build.gradle` file. +`.aar` files are also included in this repo if you want to use them instead. If so then you will need to include GCM or FCM dependancies in your `build.gradle` file. +GCM: ```gradle -compile 'com.google.android.gms:play-services-gcm:9.2.1' +compile 'com.google.android.gms:play-services-gcm:9.4.0' +``` +FCM: +```gradle +compile 'com.google.firebase:firebase-messaging:9.4.0' ``` ## Upgrading from 1.x.x @@ -203,33 +215,70 @@ Before version 1.1.0 of our Android SDK was released we included Google’s GCM ## Dependency graph Here is our complete dependency graph: + +intercom-sdk-base ``` -+--- project :intercom-sdk-base -| +--- com.android.support:design:24.1.1 -| +--- com.android.support:appcompat-v7:24.1.1 -| +--- com.android.support:animated-vector-drawable:24.1.1 -| +--- com.android.support:support-vector-drawable:24.1.1 ++--- com.android.support:design:24.1.1 | +--- com.android.support:support-v4:24.1.1 -| +--- com.android.support:support-annotations:24.1.1 +| | \--- com.android.support:support-annotations:24.1.1 | +--- com.android.support:recyclerview-v7:24.1.1 -| +--- com.facebook.rebound:rebound:0.3.8 -| +--- com.squareup:otto:1.3.8 -| +--- com.github.bumptech.glide:glide-intercom:3.7.0 -| +--- com.squareup.okio:okio:1.9.0 -| +--- com.squareup.okhttp3:okhttp:3.4.1 -| +--- com.squareup.okhttp3:okhttp-ws:3.4.1 -| +--- com.squareup.retrofit2:retrofit:2.1.0 -| +--- com.squareup.retrofit2:converter-gson:2.1.0 -| +--- com.google.code.gson:gson:2.7 -\--- project :intercom-sdk-gcm - \--- com.google.android.gms:play-services-gcm:9.2.1 - +--- com.google.android.gms:play-services-base:9.2.1 - | +--- com.google.android.gms:play-services-basement:9.2.1 - | | \--- com.android.support:support-v4:23.0.0 -> 24.1.1 (*) - | \--- com.google.android.gms:play-services-tasks:9.2.1 - | \--- com.google.android.gms:play-services-basement:9.2.1 (*) - +--- com.google.android.gms:play-services-basement:9.2.1 (*) - \--- com.google.android.gms:play-services-iid:9.2.1 - +--- com.google.android.gms:play-services-base:9.2.1 (*) - \--- com.google.android.gms:play-services-basement:9.2.1 (*) +| | +--- com.android.support:support-v4:24.1.1 (*) +| | \--- com.android.support:support-annotations:24.1.1 +| \--- com.android.support:appcompat-v7:24.1.1 +| +--- com.android.support:animated-vector-drawable:24.1.1 +| | \--- com.android.support:support-vector-drawable:24.1.1 +| | \--- com.android.support:support-v4:24.1.1 (*) +| +--- com.android.support:support-v4:24.1.1 (*) +| \--- com.android.support:support-vector-drawable:24.1.1 (*) ++--- com.android.support:appcompat-v7:24.1.1 (*) ++--- com.android.support:animated-vector-drawable:24.1.1 (*) ++--- com.android.support:support-vector-drawable:24.1.1 (*) ++--- com.android.support:support-v4:24.1.1 (*) ++--- com.android.support:support-annotations:24.1.1 ++--- com.android.support:recyclerview-v7:24.1.1 (*) ++--- com.facebook.rebound:rebound:0.3.8 ++--- com.squareup:otto:1.3.8 ++--- com.github.bumptech.glide:glide-intercom:3.7.0 ++--- com.squareup.okio:okio:1.9.0 ++--- com.squareup.okhttp3:okhttp:3.4.1 +| \--- com.squareup.okio:okio:1.9.0 ++--- com.squareup.okhttp3:okhttp-ws:3.4.1 +| \--- com.squareup.okhttp3:okhttp:3.4.1 (*) ++--- com.squareup.retrofit2:retrofit:2.1.0 +| \--- com.squareup.okhttp3:okhttp:3.3.0 -> 3.4.1 (*) ++--- com.squareup.retrofit2:converter-gson:2.1.0 +| +--- com.squareup.retrofit2:retrofit:2.1.0 (*) +| \--- com.google.code.gson:gson:2.7 ++--- com.google.code.gson:gson:2.7 ++--- io.intercom.android:nexus-client-android:2.0.3 +| +--- com.squareup.okhttp3:okhttp:3.4.1 (*) +| \--- com.squareup.okhttp3:okhttp-ws:3.4.1 (*) ++--- io.intercom.android:android-commons:0.0.11 +\--- io.intercom.android:intercom-blocks:1.1.2 +``` + +intercom-sdk-gcm +``` ++--- com.google.android.gms:play-services-base:9.4.0 +| +--- com.google.android.gms:play-services-basement:9.4.0 +| | \--- com.android.support:support-v4:23.0.0 -> 24.1.1 (*) +| \--- com.google.android.gms:play-services-tasks:9.4.0 +| \--- com.google.android.gms:play-services-basement:9.4.0 (*) ++--- com.google.android.gms:play-services-basement:9.4.0 (*) +\--- com.google.android.gms:play-services-iid:9.4.0 + +--- com.google.android.gms:play-services-base:9.4.0 (*) + \--- com.google.android.gms:play-services-basement:9.4.0 (*) +``` + +intercom-sdk-fcm +``` ++--- com.google.android.gms:play-services-basement:9.4.0 +| \--- com.android.support:support-v4:23.0.0 -> 24.1.1 (*) ++--- com.google.firebase:firebase-iid:9.4.0 +| +--- com.google.android.gms:play-services-basement:9.4.0 (*) +| \--- com.google.firebase:firebase-common:9.4.0 +| +--- com.google.android.gms:play-services-basement:9.4.0 (*) +| \--- com.google.android.gms:play-services-tasks:9.4.0 +| \--- com.google.android.gms:play-services-basement:9.4.0 (*) +\--- com.google.firebase:firebase-common:9.4.0 (*) ``` diff --git a/aar/intercom-sdk-base/intercom-sdk-base-3.0.2.aar b/aar/intercom-sdk-base/intercom-sdk-base-3.0.2.aar deleted file mode 100644 index e0d8923b..00000000 Binary files a/aar/intercom-sdk-base/intercom-sdk-base-3.0.2.aar and /dev/null differ diff --git a/aar/intercom-sdk-base/intercom-sdk-base-3.0.3.aar b/aar/intercom-sdk-base/intercom-sdk-base-3.0.3.aar new file mode 100644 index 00000000..24a57aef Binary files /dev/null and b/aar/intercom-sdk-base/intercom-sdk-base-3.0.3.aar differ diff --git a/aar/intercom-sdk-fcm/intercom-sdk-fcm-3.0.3.aar b/aar/intercom-sdk-fcm/intercom-sdk-fcm-3.0.3.aar new file mode 100644 index 00000000..ae08cd0c Binary files /dev/null and b/aar/intercom-sdk-fcm/intercom-sdk-fcm-3.0.3.aar differ diff --git a/aar/intercom-sdk-gcm/intercom-sdk-gcm-3.0.2.aar b/aar/intercom-sdk-gcm/intercom-sdk-gcm-3.0.2.aar deleted file mode 100644 index 8a7ac903..00000000 Binary files a/aar/intercom-sdk-gcm/intercom-sdk-gcm-3.0.2.aar and /dev/null differ diff --git a/aar/intercom-sdk-gcm/intercom-sdk-gcm-3.0.3.aar b/aar/intercom-sdk-gcm/intercom-sdk-gcm-3.0.3.aar new file mode 100644 index 00000000..36ddcc50 Binary files /dev/null and b/aar/intercom-sdk-gcm/intercom-sdk-gcm-3.0.3.aar differ diff --git a/aar/intercom-sdk/intercom-sdk-3.0.2.aar b/aar/intercom-sdk/intercom-sdk-3.0.2.aar deleted file mode 100644 index dbe747c2..00000000 Binary files a/aar/intercom-sdk/intercom-sdk-3.0.2.aar and /dev/null differ diff --git a/aar/intercom-sdk/intercom-sdk-3.0.3.aar b/aar/intercom-sdk/intercom-sdk-3.0.3.aar new file mode 100644 index 00000000..75ba59da Binary files /dev/null and b/aar/intercom-sdk/intercom-sdk-3.0.3.aar differ diff --git a/docs/allclasses-frame.html b/docs/allclasses-frame.html index 9b3e0ef1..382afc9d 100644 --- a/docs/allclasses-frame.html +++ b/docs/allclasses-frame.html @@ -2,9 +2,9 @@ - + All Classes (intercom-sdk-base API) - + diff --git a/docs/allclasses-noframe.html b/docs/allclasses-noframe.html index 95ef8928..16b3d311 100644 --- a/docs/allclasses-noframe.html +++ b/docs/allclasses-noframe.html @@ -2,9 +2,9 @@ - + All Classes (intercom-sdk-base API) - + diff --git a/docs/constant-values.html b/docs/constant-values.html index 15ba0193..829e15ba 100644 --- a/docs/constant-values.html +++ b/docs/constant-values.html @@ -2,9 +2,9 @@ - + Constant Field Values (intercom-sdk-base API) - + diff --git a/docs/deprecated-list.html b/docs/deprecated-list.html index 8488bebf..dbf1f256 100644 --- a/docs/deprecated-list.html +++ b/docs/deprecated-list.html @@ -2,9 +2,9 @@ - + Deprecated List (intercom-sdk-base API) - + @@ -71,6 +71,35 @@

Deprecated API

Contents

+ +
+
+ + +
diff --git a/docs/help-doc.html b/docs/help-doc.html index 9f21f80c..73ae444d 100644 --- a/docs/help-doc.html +++ b/docs/help-doc.html @@ -2,9 +2,9 @@ - + API Help (intercom-sdk-base API) - + diff --git a/docs/index-all.html b/docs/index-all.html index 370ab9e2..a0b4afec 100644 --- a/docs/index-all.html +++ b/docs/index-all.html @@ -2,9 +2,9 @@ - + Index (intercom-sdk-base API) - + @@ -135,6 +135,14 @@

G

H

+
handlePushMessage() - Method in class io.intercom.android.sdk.Intercom
+
+
Handle the opening of an Intercom push message
+
+
handlePushMessage(TaskStackBuilder) - Method in class io.intercom.android.sdk.Intercom
+
+
Handle the opening of an Intercom push message
+
hideMessenger() - Method in class io.intercom.android.sdk.Intercom
Dismisses the Intercom messenger if it is on screen
@@ -185,11 +193,15 @@

O

openGcmMessage() - Method in class io.intercom.android.sdk.Intercom
-
Handle the opening of a GCM notification
+
Deprecated. + +
openGcmMessage(TaskStackBuilder) - Method in class io.intercom.android.sdk.Intercom
-
Handle the opening of a GCM notification
+
diff --git a/docs/index.html b/docs/index.html index 3abe1c44..ab9da581 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2,7 +2,7 @@ - + intercom-sdk-base API diff --git a/docs/io/intercom/android/sdk/Intercom.html b/docs/io/intercom/android/sdk/Intercom.html index 729e6613..ef4a0c0c 100644 --- a/docs/io/intercom/android/sdk/Intercom.html +++ b/docs/io/intercom/android/sdk/Intercom.html @@ -2,9 +2,9 @@ - + Intercom (intercom-sdk-base API) - + @@ -18,8 +18,8 @@ catch(err) { } //--> -var methods = {"i0":6,"i1":9,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6,"i7":9,"i8":6,"i9":6,"i10":6,"i11":6,"i12":6,"i13":6,"i14":6,"i15":6,"i16":6,"i17":6,"i18":9,"i19":6,"i20":6}; -var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],8:["t4","Concrete Methods"]}; +var methods = {"i0":6,"i1":9,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6,"i7":6,"i8":6,"i9":9,"i10":6,"i11":6,"i12":38,"i13":38,"i14":6,"i15":6,"i16":6,"i17":6,"i18":6,"i19":6,"i20":9,"i21":6,"i22":6}; +var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],8:["t4","Concrete Methods"],32:["t6","Deprecated Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; var tableTab = "tableTab"; @@ -189,7 +189,7 @@

Constructor Summary

Method Summary

- + @@ -232,11 +232,23 @@

Method Summary

+ + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods 
Modifier and Type Method and Description
abstract voidhandlePushMessage() +
Handle the opening of an Intercom push message
+
abstract voidhandlePushMessage(android.app.TaskStackBuilder customStack) +
Handle the opening of an Intercom push message
+
abstract void hideMessenger()
Dismisses the Intercom messenger if it is on screen
static void initialize(android.app.Application application, java.lang.String apiKey, @@ -244,81 +256,85 @@

Method Summary

Initialize the Intercom singleton.
abstract void logEvent(java.lang.String name)
Log an event with a given name.
abstract void logEvent(java.lang.String name, java.util.Map<java.lang.String,?> metaData)
Log an event with a given name and some metadata.
abstract void openGcmMessage() -
Handle the opening of a GCM notification
+
Deprecated.  +
replaced with handlePushMessage()
+
abstract void openGcmMessage(android.app.TaskStackBuilder customStack) -
Handle the opening of a GCM notification
+
Deprecated.  + +
abstract void registerIdentifiedUser(Registration userRegistration)
Registers an identified user with Intercom.
abstract void registerUnidentifiedUser()
Registers an unidentified user with Intercom.
abstract void removeUnreadConversationCountListener(UnreadConversationCountListener listener)
Remove a listener from the collection that receive updates when the unread conversation count changes
abstract void reset()
Clear all data from the Intercom SDK
abstract void setInAppMessageVisibility(Intercom.Visibility visibility)
Toggle visibility of messages within the Intercom sdk
abstract void setLauncherVisibility(Intercom.Visibility visibility)
Toggle visibility of messages within the Intercom sdk
static void setLogLevel(int logLevel)
Set the level of the logger
abstract void setSecureMode(java.lang.String secureHash, java.lang.String secureData)
Set the secure hash and data to be used for Secure Mode.
abstract void updateUser(java.util.Map<java.lang.String,?> attributes)
Updates a user in Intercom.
@@ -417,8 +433,8 @@

initialize

Parameters:
application - A reference to the Application
-
apiKey - The Android-SDK API key found on the Intercom API Key settings page.
-
appId - The App ID of your Intercom app.
+
apiKey - The Android SDK API key found on the Intercom for Android settings page.
+
appId - The app ID of your Intercom app.
Since:
1.0.0
@@ -470,12 +486,7 @@

registerIdentifiedUser

In order to keep track of a specific user, you must identify it with a unique user identifier, an email address, or both. By supplying information like this Intercom provides richer user profiles for your users. This is a userId, supplied by you (e.g. from an existing web service for your product) to represent your - user in Intercom, once set it cannot be changed.

- -

If you are putting the Intercom SDK into an app that has persisted an authentication token or equivalent - so your users don't have to log in repeatedly (like most apps) then we advise putting the user registration - call in the `didBecomeActive:` method in your application delegate. This won't have any negative impact if - you also add it to your authentication success method elsewhere in your app.

+ user in Intercom, once set it cannot be changed.

Parameters:
userRegistration - the Registration for a user
@@ -496,7 +507,7 @@

setSecureMode

Secure Mode helps to make sure that conversations between you and your users are kept private and that one user can't impersonate another. - In Secure Mode the Android SDK will sign all requests going to the Intercom servers with tokens. + In Secure Mode the SDK will sign all requests going to the Intercom servers with tokens. It requires your mobile application to have its own server which authenticates the app's users and which can store a secret. More information on secure mode can be found here.

@@ -736,13 +747,19 @@

hideMessenger

  • openGcmMessage

    -
    public abstract void openGcmMessage()
    -

    Handle the opening of a GCM notification

    +
    @Deprecated
    +public abstract void openGcmMessage()
    +
    Deprecated. replaced with handlePushMessage()
    +

    Handle the opening of an Intercom push message

    -

    Opens up the URI from the last Google Cloud Message.

    +

    Opens up the URI from the last Intercom push message.

    +

    If the message is an in-app message or reply this will open up the messenger (Push Notifications).

    +

    If the message was an Intercom push message this will follow the URI you provided (Push Messages).

    Since:
    3.0.0
    +
    See Also:
    +
    How do mobile push notifications work with Intercom?
@@ -752,15 +769,63 @@

openGcmMessage

  • openGcmMessage

    -
    public abstract void openGcmMessage(android.app.TaskStackBuilder customStack)
    -

    Handle the opening of a GCM notification

    +
    @Deprecated
    +public abstract void openGcmMessage(android.app.TaskStackBuilder customStack)
    +
    Deprecated. replaced with handlePushMessage(TaskStackBuilder)
    +

    Handle the opening of an Intercom push message

    -

    Opens up the URI from the last Google Cloud Message.

    +

    Opens up the URI from the last Intercom push message.

    +

    If the message is an in-app message or reply this will open up the messenger (Push Notifications).

    +

    If the message was an Intercom push message this will follow the URI you provided (Push Messages).

    Parameters:
    -
    customStack - provide a taskstackbuilder to allow for a custom back stack
    +
    customStack - provide a TaskStackBuilder to allow for a custom back stack
    Since:
    3.0.0
    +
    See Also:
    +
    How do mobile push notifications work with Intercom?
    +
    +
  • +
+ + + +
    +
  • +

    handlePushMessage

    +
    public abstract void handlePushMessage()
    +

    Handle the opening of an Intercom push message

    + +

    Opens up the URI from the last Intercom push message.

    +

    If the message is an in-app message or reply this will open up the messenger (Push Notifications).

    +

    If the message was an Intercom push message this will follow the URI you provided (Push Messages).

    +
    +
    Since:
    +
    3.0.3
    +
    See Also:
    +
    How do mobile push notifications work with Intercom?
    +
    +
  • +
+ + + +
    +
  • +

    handlePushMessage

    +
    public abstract void handlePushMessage(android.app.TaskStackBuilder customStack)
    +

    Handle the opening of an Intercom push message

    + +

    Opens up the URI from the last Intercom push message.

    +

    If the message is an in-app message or reply this will open up the messenger (Push Notifications).

    +

    If the message was an Intercom push message this will follow the URI you provided (Push Messages).

    +
    +
    Parameters:
    +
    customStack - provide a TaskStackBuilder to allow for a custom back stack
    +
    Since:
    +
    3.0.3
    +
    See Also:
    +
    How do mobile push notifications work with Intercom?
diff --git a/docs/io/intercom/android/sdk/identity/Registration.html b/docs/io/intercom/android/sdk/identity/Registration.html index c1782ede..d6ab6c32 100644 --- a/docs/io/intercom/android/sdk/identity/Registration.html +++ b/docs/io/intercom/android/sdk/identity/Registration.html @@ -2,9 +2,9 @@ - + Registration (intercom-sdk-base API) - + diff --git a/docs/io/intercom/android/sdk/identity/package-frame.html b/docs/io/intercom/android/sdk/identity/package-frame.html index 0526c599..17fcd2fb 100644 --- a/docs/io/intercom/android/sdk/identity/package-frame.html +++ b/docs/io/intercom/android/sdk/identity/package-frame.html @@ -2,9 +2,9 @@ - + io.intercom.android.sdk.identity (intercom-sdk-base API) - + diff --git a/docs/io/intercom/android/sdk/identity/package-summary.html b/docs/io/intercom/android/sdk/identity/package-summary.html index f94a1dbe..3e956f78 100644 --- a/docs/io/intercom/android/sdk/identity/package-summary.html +++ b/docs/io/intercom/android/sdk/identity/package-summary.html @@ -2,9 +2,9 @@ - + io.intercom.android.sdk.identity (intercom-sdk-base API) - + diff --git a/docs/io/intercom/android/sdk/identity/package-tree.html b/docs/io/intercom/android/sdk/identity/package-tree.html index d7fc9cdd..828345bb 100644 --- a/docs/io/intercom/android/sdk/identity/package-tree.html +++ b/docs/io/intercom/android/sdk/identity/package-tree.html @@ -2,9 +2,9 @@ - + io.intercom.android.sdk.identity Class Hierarchy (intercom-sdk-base API) - + diff --git a/docs/io/intercom/android/sdk/package-frame.html b/docs/io/intercom/android/sdk/package-frame.html index 4e6a2ee6..bade4864 100644 --- a/docs/io/intercom/android/sdk/package-frame.html +++ b/docs/io/intercom/android/sdk/package-frame.html @@ -2,9 +2,9 @@ - + io.intercom.android.sdk (intercom-sdk-base API) - + diff --git a/docs/io/intercom/android/sdk/package-summary.html b/docs/io/intercom/android/sdk/package-summary.html index cba53740..0f9513ed 100644 --- a/docs/io/intercom/android/sdk/package-summary.html +++ b/docs/io/intercom/android/sdk/package-summary.html @@ -2,9 +2,9 @@ - + io.intercom.android.sdk (intercom-sdk-base API) - + diff --git a/docs/io/intercom/android/sdk/package-tree.html b/docs/io/intercom/android/sdk/package-tree.html index fcefc39e..4cf525b1 100644 --- a/docs/io/intercom/android/sdk/package-tree.html +++ b/docs/io/intercom/android/sdk/package-tree.html @@ -2,9 +2,9 @@ - + io.intercom.android.sdk Class Hierarchy (intercom-sdk-base API) - + diff --git a/docs/overview-frame.html b/docs/overview-frame.html index fd3a72f6..81e1243a 100644 --- a/docs/overview-frame.html +++ b/docs/overview-frame.html @@ -2,9 +2,9 @@ - + Overview List (intercom-sdk-base API) - + diff --git a/docs/overview-summary.html b/docs/overview-summary.html index 806a8f24..27fd2aa0 100644 --- a/docs/overview-summary.html +++ b/docs/overview-summary.html @@ -2,9 +2,9 @@ - + Overview (intercom-sdk-base API) - + diff --git a/docs/overview-tree.html b/docs/overview-tree.html index 8c9d91cd..ad8b7b68 100644 --- a/docs/overview-tree.html +++ b/docs/overview-tree.html @@ -2,9 +2,9 @@ - + Class Hierarchy (intercom-sdk-base API) - + diff --git a/samples/README.md b/samples/README.md index 7911fccc..0c297d03 100644 --- a/samples/README.md +++ b/samples/README.md @@ -4,19 +4,48 @@ ### Setting Up This is a sample application to demonstrate how to integrate Intercom in a simple app. -You will need to add your Api Key and App Id to the SampleApplication -You will also need to add either an email or user id (THIS USER WILL BE REGISTERED IN YOUR APP) -If you have enabled secure mode you will need to provide hmac and data +You will need to add your API key and app ID to the SampleApplication +If you have enabled secure mode you will need to provide HMAC and data + If you want to enable GCM in the test app simply provide your sender_id (project number in google-services.json) in the strings.xml file inside the tag intercom_gcm_sender_id ### Usage 1. Open the app -2. Tap the register button -3. Tap the chat with us button to open the messenger -4. Send a new message to that user to see the unread badge update on the custom launcher and the in app arrive +2. Go to your https://app.intercom.io/a/apps/[YOUR_INTERCOM_APP_ID]/users/segments/active +3. Find user 123456 and send them a message. +4. You will see the unread badge update on the custom launcher and the in app arrive +5. Tap the chat with us button to open the messenger + +### Error checking +- Check logcat for any errors, make sure you have no filters turned on. It can help to switch + logcat to Verbose. +- Report any issue on Intercom or on our Github repo + +## Intercom FCM Sample + +### Setting Up +This is a sample application to demonstrate how to integrate Intercom in a simple app. +You will need to add your API key and app ID to the SampleApplication +If you have enabled secure mode you will need to provide HMAC and data + +This sample is indented to be used to test FCM integrations. To set up FCM in Intercom you need to: +1. Go to https://firebase.google.com/docs/android/setup#add_firebase_to_your_app follow the steps + and download the google-services.json file +2. Copy the google-services.json file into the directory [PATH_TO_SAMPLES]/android-sdk-samples/intercom-sample-fcm/app +3 Go to https://console.firebase.google.com/project/[YOUR_GOOGLE_APP]/settings/cloudmessaging + and copy the Server key. +4. Go to https://app.intercom.io/a/apps/[YOUR_INTERCOM_APP_ID]/settings/android and Enable GCM by adding the + server key from the previous step. + +### Usage +1. Run the FCM sample application. +2. Background the app. +3. Go to your https://app.intercom.io/a/apps/[YOUR_INTERCOM_APP_ID]/users/segments/active +4. Find user 123456 and send them a message. +5. You should receive a push notification to your device. ### Error checking - Check logcat for any errors, make sure you have no filters turned on. It can help to switch logcat to Verbose. -- Report any issue on Intercom or on our Github repo \ No newline at end of file +- Report any issue on Intercom or on our Github repo diff --git a/samples/intercom-sample-fcm/.gitignore b/samples/intercom-sample-fcm/.gitignore new file mode 100644 index 00000000..1406630a --- /dev/null +++ b/samples/intercom-sample-fcm/.gitignore @@ -0,0 +1,6 @@ +.gradle +local.properties +.idea +.DS_Store +build +*.iml diff --git a/samples/intercom-sample-fcm/app/build.gradle b/samples/intercom-sample-fcm/app/build.gradle new file mode 100644 index 00000000..f3c61d8b --- /dev/null +++ b/samples/intercom-sample-fcm/app/build.gradle @@ -0,0 +1,31 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 24 + buildToolsVersion "24.0.1" + + defaultConfig { + applicationId "io.intercom.sample" + minSdkVersion 15 + targetSdkVersion 24 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +repositories { + maven { + url 'https://dl.bintray.com/intercom/intercom-maven' + } +} + +dependencies { + compile 'io.intercom.android:intercom-sdk-base:3.0.3' + compile 'io.intercom.android:intercom-sdk-fcm:3.0.3' +} diff --git a/samples/intercom-sample-fcm/app/proguard-rules.pro b/samples/intercom-sample-fcm/app/proguard-rules.pro new file mode 100644 index 00000000..83f4de79 --- /dev/null +++ b/samples/intercom-sample-fcm/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/dalecantwell/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/samples/intercom-sample-fcm/app/src/main/AndroidManifest.xml b/samples/intercom-sample-fcm/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..932cdfa8 --- /dev/null +++ b/samples/intercom-sample-fcm/app/src/main/AndroidManifest.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + diff --git a/samples/intercom-sample-fcm/app/src/main/java/io/intercom/sample/MainActivity.java b/samples/intercom-sample-fcm/app/src/main/java/io/intercom/sample/MainActivity.java new file mode 100644 index 00000000..c9411a55 --- /dev/null +++ b/samples/intercom-sample-fcm/app/src/main/java/io/intercom/sample/MainActivity.java @@ -0,0 +1,95 @@ +package io.intercom.sample; + +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.text.TextUtils; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +import io.intercom.android.sdk.Intercom; +import io.intercom.android.sdk.UnreadConversationCountListener; +import io.intercom.android.sdk.identity.Registration; + +public class MainActivity extends AppCompatActivity implements View.OnClickListener { + //---------------------------------------------------------------------------------------------- + //Make sure you go to SampleApplication.java to set your app ID and API key + //---------------------------------------------------------------------------------------------- + private static final String USER_ID = "123456"; + + //---------------------------------------------------------------------------------------------- + //If you use secure mode you will need to include HMAC and data + //We suggest taking these values from your app. You may need to change USER_ID above + //to match your HMAC values + //---------------------------------------------------------------------------------------------- + private static final String YOUR_HMAC = ""; + private static final String YOUR_DATA = ""; + + private TextView unreadCountView; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + if (TextUtils.isEmpty(SampleApplication.YOUR_APP_ID) + || TextUtils.isEmpty(SampleApplication.YOUR_API_KEY)) { + findViewById(R.id.not_initialized).setVisibility(View.VISIBLE); + } else { + //if you have provided a HMAC and data try begin secure session + if (!TextUtils.isEmpty(YOUR_HMAC) && !TextUtils.isEmpty(YOUR_DATA)) { + Intercom.client().setSecureMode(YOUR_HMAC, YOUR_DATA); + } + + //Enable default launcher + Intercom.client().setLauncherVisibility(Intercom.Visibility.VISIBLE); + //Register a user with Intercom + Intercom.client().registerIdentifiedUser(Registration.create().withUserId(USER_ID)); + //Custom launcher + Button messengerButton = (Button) findViewById(R.id.messenger_button); + messengerButton.setOnClickListener(this); + + //set the unread count + unreadCountView = (TextView) findViewById(R.id.unread_counter); + int unreadCount = Intercom.client().getUnreadConversationCount(); + unreadCountView.setText(String.valueOf(unreadCount)); + setBadgeVisibility(unreadCount, unreadCountView); + } + } + + @Override + public void onClick(View v) { + switch (v.getId()) { + case R.id.messenger_button: + Intercom.client().displayConversationsList(); + break; + } + } + + private final UnreadConversationCountListener unreadConversationCountListener = new UnreadConversationCountListener() { + @Override public void onCountUpdate(int unreadCount) { + setBadgeVisibility(unreadCount, unreadCountView); + unreadCountView.setText(String.valueOf(unreadCount)); + } + }; + + private void setBadgeVisibility(int unreadCount, TextView unreadCountView) { + int visibility = unreadCount == 0 ? View.INVISIBLE : View.VISIBLE; + unreadCountView.setVisibility(visibility); + } + + @Override + protected void onPause() { + super.onPause(); + + Intercom.client().removeUnreadConversationCountListener(unreadConversationCountListener); + } + + @Override + public void onResume() { + super.onResume(); + + Intercom.client().addUnreadConversationCountListener(unreadConversationCountListener); + Intercom.client().handlePushMessage(); + } +} diff --git a/samples/intercom-sample-fcm/app/src/main/java/io/intercom/sample/SampleApplication.java b/samples/intercom-sample-fcm/app/src/main/java/io/intercom/sample/SampleApplication.java new file mode 100644 index 00000000..d02e212c --- /dev/null +++ b/samples/intercom-sample-fcm/app/src/main/java/io/intercom/sample/SampleApplication.java @@ -0,0 +1,19 @@ +package io.intercom.sample; + +import android.app.Application; + +import io.intercom.android.sdk.Intercom; + +public class SampleApplication extends Application { + //---------------------------------------------------------------------------------------------- + // You need to enter your API key and app ID here to use Intercom for Android + // To get these keys go to https://app.intercom.io/a/apps/_/settings/android and follow the step-up guide + //---------------------------------------------------------------------------------------------- + static final String YOUR_API_KEY = ""; + static final String YOUR_APP_ID = ""; + + @Override public void onCreate() { + super.onCreate(); + Intercom.initialize(this, YOUR_API_KEY, YOUR_APP_ID); + } +} diff --git a/samples/intercom-sample-fcm/app/src/main/res/drawable-xxhdpi/ic_chat.png b/samples/intercom-sample-fcm/app/src/main/res/drawable-xxhdpi/ic_chat.png new file mode 100644 index 00000000..d8f16330 Binary files /dev/null and b/samples/intercom-sample-fcm/app/src/main/res/drawable-xxhdpi/ic_chat.png differ diff --git a/samples/intercom-sample-fcm/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/intercom-sample-fcm/app/src/main/res/drawable-xxhdpi/ic_launcher.png new file mode 100755 index 00000000..49bca7ce Binary files /dev/null and b/samples/intercom-sample-fcm/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/samples/intercom-sample-fcm/app/src/main/res/drawable/rounded_badge.xml b/samples/intercom-sample-fcm/app/src/main/res/drawable/rounded_badge.xml new file mode 100644 index 00000000..0a90b6f2 --- /dev/null +++ b/samples/intercom-sample-fcm/app/src/main/res/drawable/rounded_badge.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/samples/intercom-sample-fcm/app/src/main/res/drawable/rounded_button.xml b/samples/intercom-sample-fcm/app/src/main/res/drawable/rounded_button.xml new file mode 100644 index 00000000..c8148435 --- /dev/null +++ b/samples/intercom-sample-fcm/app/src/main/res/drawable/rounded_button.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/samples/intercom-sample-fcm/app/src/main/res/layout/activity_main.xml b/samples/intercom-sample-fcm/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..457e8d22 --- /dev/null +++ b/samples/intercom-sample-fcm/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,44 @@ + +