diff --git a/.classpath b/.classpath
index c777b6c..b3f984f 100644
--- a/.classpath
+++ b/.classpath
@@ -5,13 +5,16 @@
-
-
-
+
+
+
+
+
+
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
deleted file mode 100644
index de1e091..0000000
--- a/CHANGELOG.txt
+++ /dev/null
@@ -1 +0,0 @@
-Place your change log text here. This file will be incorporated with your app at package time.
\ No newline at end of file
diff --git a/README.md b/README.md
index e1ce930..425e636 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Intercom android module for Intercom Android SDK version 1.1.11
+### Intercom android module for Intercom Android SDK version 1.1.21
Integrate Intercom.io with Appcelerator. iOS module available here https://github.com/markive/TiIntercom . Tested with 5.1.1GA SDK
@@ -47,7 +47,7 @@ exports.setDeviceToken = function(token, appicon /* 'device-token', Ti.App.Andro
```
-### tiapp.xml changes for Android GCM support
+### IMPORTANT : tiapp.xml changes for Android GCM support
```
@@ -78,6 +78,53 @@ exports.setDeviceToken = function(token, appicon /* 'device-token', Ti.App.Andro
```
+### IMPORTANT : create hooks folder and intercom.js file in the module for Android GCM support
+You need to create a hooks folder with a .js file inside the module directory with the following contents. This makes sure the additional R values are added for intercom during compile. If someone can tell me how to update the ant build script to create this automatically in the compiled dist please let me know otherwise you need to do this manually after compile.
+
+Create the following file:
+
+FILE: /modules/android/ti.intercom.android/1.0.4/hooks/intercom.js
+```
+exports.cliVersion = '>=3.X';
+
+exports.init = function(logger, config, cli, appc) {
+ cli.on('build.android.aapt', {
+ pre : function(data, next) {
+ var args = data.args[1];
+ if (args.indexOf('--auto-add-overlay') < 0) {
+ args.push('--auto-add-overlay');
+ }
+
+ var externalLibraries = [{
+ javaClass : 'io.intercom.android.sdk.gcm',
+ resPath : '/Users/jerodfritz/Appcelerator/Prspctr/modules/android/ti.intercom.android/1.0.4/platform/android/gcm-res'
+ }];
+ console.log("Add Intercom GCM External Libraries", JSON.stringify(externalLibraries));
+
+ // --extra-packages can be defined just once
+ if (args.indexOf('--extra-packages') < 0) {
+ args.push('--extra-packages');
+ args.push('');
+ }
+ var namespaceIndex = args.indexOf('--extra-packages') + 1;
+
+ externalLibraries.forEach(function(lib) {
+ if (args[namespaceIndex].indexOf(lib.javaClass) < 0) {
+ args[namespaceIndex].length && (args[namespaceIndex] += ':');
+ args[namespaceIndex] += lib.javaClass;
+ }
+ if (args.indexOf(lib.resPath) < 0) {
+ args.push('-S');
+ args.push(lib.resPath);
+ }
+ });
+ next(null, data);
+ }
+ });
+};
+```
+
+
#### Author
Jerod
(jerodfritz@gmail.com)
diff --git a/android/LICENSE b/android/LICENSE
deleted file mode 100644
index 6ae867d..0000000
--- a/android/LICENSE
+++ /dev/null
@@ -1 +0,0 @@
-TODO: place your license here and we'll include it in the module distribution
diff --git a/android/platform/android/fonts/Roboto-Light.ttf b/android/assets/fonts/intercomsdk_roboto_light.ttf
similarity index 100%
rename from android/platform/android/fonts/Roboto-Light.ttf
rename to android/assets/fonts/intercomsdk_roboto_light.ttf
diff --git a/android/platform/android/fonts/Roboto-Medium.ttf b/android/assets/fonts/intercomsdk_roboto_medium.ttf
similarity index 100%
rename from android/platform/android/fonts/Roboto-Medium.ttf
rename to android/assets/fonts/intercomsdk_roboto_medium.ttf
diff --git a/android/build.properties b/android/build.properties
index 3544a8e..5cc884c 100644
--- a/android/build.properties
+++ b/android/build.properties
@@ -1,3 +1,4 @@
-titanium.platform=/Users/jerodfritz/Library/Application Support/Titanium/mobilesdk/osx/5.1.1.GA/android
+titanium.platform=/Users/jerodfritz/Library/Application Support/Titanium/mobilesdk/osx/5.3.0.GA/android
android.platform=/Applications/Android/platforms/android-23
google.apis=/Applications/Android/add-ons/addon-google_apis-google-23
+android.ndk=/Applications/Android/ndk
\ No newline at end of file
diff --git a/android/build.xml b/android/build.xml
index 39f3f22..91fbd39 100644
--- a/android/build.xml
+++ b/android/build.xml
@@ -24,33 +24,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/android/dist/ti.intercom.android-android-1.0.2.zip b/android/dist/ti.intercom.android-android-1.0.2.zip
deleted file mode 100644
index 30adffd..0000000
Binary files a/android/dist/ti.intercom.android-android-1.0.2.zip and /dev/null differ
diff --git a/android/dist/ti.intercom.android-android-1.0.4.zip b/android/dist/ti.intercom.android-android-1.0.4.zip
new file mode 100644
index 0000000..b10586c
Binary files /dev/null and b/android/dist/ti.intercom.android-android-1.0.4.zip differ
diff --git a/android/dist/tiintercomandroid.jar b/android/dist/tiintercomandroid.jar
index 9569b35..2a13804 100644
Binary files a/android/dist/tiintercomandroid.jar and b/android/dist/tiintercomandroid.jar differ
diff --git a/android/documentation/index.md b/android/documentation/index.md
deleted file mode 100644
index fdf9ecb..0000000
--- a/android/documentation/index.md
+++ /dev/null
@@ -1,39 +0,0 @@
-# tiintercomandroid Module
-
-## Description
-
-TODO: Enter your module description here
-
-## Accessing the tiintercomandroid Module
-
-To access this module from JavaScript, you would do the following:
-
- var tiintercomandroid = require("ti.intercom.android");
-
-The tiintercomandroid variable is a reference to the Module object.
-
-## Reference
-
-TODO: If your module has an API, you should document
-the reference here.
-
-### tiintercomandroid.function
-
-TODO: This is an example of a module function.
-
-### tiintercomandroid.property
-
-TODO: This is an example of a module property.
-
-## Usage
-
-TODO: Enter your usage example here
-
-## Author
-
-TODO: Enter your author name, email and other contact
-details you want to share here.
-
-## License
-
-TODO: Enter your license/legal information here.
diff --git a/android/example/app.js b/android/example/app.js
deleted file mode 100644
index a519a81..0000000
--- a/android/example/app.js
+++ /dev/null
@@ -1,39 +0,0 @@
-// This is a test harness for your module
-// You should do something interesting in this harness
-// to test out the module and to provide instructions
-// to users on how to use it by example.
-
-
-// open a single window
-var win = Ti.UI.createWindow({
- backgroundColor:'white'
-});
-var label = Ti.UI.createLabel();
-win.add(label);
-win.open();
-
-// TODO: write your module tests here
-var tiintercomandroid = require('ti.intercom.android');
-Ti.API.info("module is => " + tiintercomandroid);
-
-label.text = tiintercomandroid.example();
-
-Ti.API.info("module exampleProp is => " + tiintercomandroid.exampleProp);
-tiintercomandroid.exampleProp = "This is a test value";
-
-if (Ti.Platform.name == "android") {
- var proxy = tiintercomandroid.createExample({
- message: "Creating an example Proxy",
- backgroundColor: "red",
- width: 100,
- height: 100,
- top: 100,
- left: 150
- });
-
- proxy.printMessage("Hello world!");
- proxy.message = "Hi world!. It's me again.";
- proxy.printMessage("Hello world!");
- win.add(proxy);
-}
-
diff --git a/android/java-sources.txt b/android/java-sources.txt
new file mode 100644
index 0000000..cf1bd76
--- /dev/null
+++ b/android/java-sources.txt
@@ -0,0 +1 @@
+"/Users/jerodfritz/Documents/Appcelerator_Studio_Workspace/tiintercomandroid/android/src/ti/intercom/android/TiintercomandroidModule.java"
\ No newline at end of file
diff --git a/android/lib/README b/android/lib/README
deleted file mode 100644
index a54313f..0000000
--- a/android/lib/README
+++ /dev/null
@@ -1,2 +0,0 @@
-You can place any .jar dependencies in this directory and they will be included
-when your module is being compiled.
\ No newline at end of file
diff --git a/android/lib/classes.jar b/android/lib/intercom-sdk-base-classes.jar
old mode 100644
new mode 100755
similarity index 52%
rename from android/lib/classes.jar
rename to android/lib/intercom-sdk-base-classes.jar
index ec92176..8bc7017
Binary files a/android/lib/classes.jar and b/android/lib/intercom-sdk-base-classes.jar differ
diff --git a/android/lib/intercom-sdk-gcm-classes.jar b/android/lib/intercom-sdk-gcm-classes.jar
new file mode 100755
index 0000000..f1b12d3
Binary files /dev/null and b/android/lib/intercom-sdk-gcm-classes.jar differ
diff --git a/android/lib/repackaged_dependencies.jar b/android/lib/repackaged_dependencies.jar
old mode 100644
new mode 100755
index 18e3c7f..d2e812f
Binary files a/android/lib/repackaged_dependencies.jar and b/android/lib/repackaged_dependencies.jar differ
diff --git a/android/libs/armeabi-v7a/libti.intercom.android.so b/android/libs/armeabi-v7a/libti.intercom.android.so
index 1c37f5b..82f951e 100644
Binary files a/android/libs/armeabi-v7a/libti.intercom.android.so and b/android/libs/armeabi-v7a/libti.intercom.android.so differ
diff --git a/android/libs/armeabi/libti.intercom.android.so b/android/libs/armeabi/libti.intercom.android.so
index 69f3988..4b7bb7d 100644
Binary files a/android/libs/armeabi/libti.intercom.android.so and b/android/libs/armeabi/libti.intercom.android.so differ
diff --git a/android/libs/x86/libti.intercom.android.so b/android/libs/x86/libti.intercom.android.so
index 348dee8..ce8ae1e 100644
Binary files a/android/libs/x86/libti.intercom.android.so and b/android/libs/x86/libti.intercom.android.so differ
diff --git a/android/manifest b/android/manifest
index 47aa11d..8f3c931 100644
--- a/android/manifest
+++ b/android/manifest
@@ -2,14 +2,14 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
-version: 1.0.2
+version: 1.0.4
apiversion: 2
architectures: armeabi armeabi-v7a x86
description: tiintercomandroid
author: Jerod Fritz
license: Specify your license
copyright: Copyright (c) 2015 by Your Company
-respackage: io.intercom.android.sdk
+respackage: io.intercom.android.sdk
# these should not be edited
name: tiintercomandroid
diff --git a/android/platform/android/fonts/intercomsdk_roboto_light.ttf b/android/platform/android/fonts/intercomsdk_roboto_light.ttf
new file mode 100644
index 0000000..13bf13a
Binary files /dev/null and b/android/platform/android/fonts/intercomsdk_roboto_light.ttf differ
diff --git a/android/platform/android/fonts/intercomsdk_roboto_medium.ttf b/android/platform/android/fonts/intercomsdk_roboto_medium.ttf
new file mode 100644
index 0000000..d0f6e2b
Binary files /dev/null and b/android/platform/android/fonts/intercomsdk_roboto_medium.ttf differ
diff --git a/android/platform/android/gcm-res/drawable-hdpi-v4/intercomsdk_default_push.png b/android/platform/android/gcm-res/drawable-hdpi-v4/intercomsdk_default_push.png
new file mode 100644
index 0000000..a0ecffe
Binary files /dev/null and b/android/platform/android/gcm-res/drawable-hdpi-v4/intercomsdk_default_push.png differ
diff --git a/android/platform/android/gcm-res/drawable-mdpi-v4/intercomsdk_default_push.png b/android/platform/android/gcm-res/drawable-mdpi-v4/intercomsdk_default_push.png
new file mode 100644
index 0000000..6c5e7cf
Binary files /dev/null and b/android/platform/android/gcm-res/drawable-mdpi-v4/intercomsdk_default_push.png differ
diff --git a/android/platform/android/gcm-res/drawable-xhdpi-v4/intercomsdk_default_push.png b/android/platform/android/gcm-res/drawable-xhdpi-v4/intercomsdk_default_push.png
new file mode 100644
index 0000000..1e65ae8
Binary files /dev/null and b/android/platform/android/gcm-res/drawable-xhdpi-v4/intercomsdk_default_push.png differ
diff --git a/android/platform/android/gcm-res/drawable-xxhdpi-v4/intercomsdk_default_push.png b/android/platform/android/gcm-res/drawable-xxhdpi-v4/intercomsdk_default_push.png
new file mode 100644
index 0000000..d331268
Binary files /dev/null and b/android/platform/android/gcm-res/drawable-xxhdpi-v4/intercomsdk_default_push.png differ
diff --git a/android/platform/android/gcm-res/values/values.xml b/android/platform/android/gcm-res/values/values.xml
new file mode 100644
index 0000000..995a5ec
--- /dev/null
+++ b/android/platform/android/gcm-res/values/values.xml
@@ -0,0 +1,10 @@
+
+
+
+ - "You have a new message"
+ - "You have %d new messages"
+
+ New notifications
+ New notifications
+ %1$s from %2$s
+
\ No newline at end of file
diff --git a/android/platform/android/res/drawable-hdpi-v4/intercomsdk_default_push.png b/android/platform/android/res/drawable-hdpi-v4/intercomsdk_default_push.png
new file mode 100644
index 0000000..a0ecffe
Binary files /dev/null and b/android/platform/android/res/drawable-hdpi-v4/intercomsdk_default_push.png differ
diff --git a/android/platform/android/res/drawable-mdpi-v4/intercomsdk_default_push.png b/android/platform/android/res/drawable-mdpi-v4/intercomsdk_default_push.png
new file mode 100644
index 0000000..6c5e7cf
Binary files /dev/null and b/android/platform/android/res/drawable-mdpi-v4/intercomsdk_default_push.png differ
diff --git a/android/platform/android/res/drawable-xhdpi-v4/intercomsdk_default_push.png b/android/platform/android/res/drawable-xhdpi-v4/intercomsdk_default_push.png
new file mode 100644
index 0000000..1e65ae8
Binary files /dev/null and b/android/platform/android/res/drawable-xhdpi-v4/intercomsdk_default_push.png differ
diff --git a/android/platform/android/res/drawable-xxhdpi-v4/intercomsdk_default_push.png b/android/platform/android/res/drawable-xxhdpi-v4/intercomsdk_default_push.png
new file mode 100644
index 0000000..d331268
Binary files /dev/null and b/android/platform/android/res/drawable-xxhdpi-v4/intercomsdk_default_push.png differ
diff --git a/android/platform/android/res/values/values.xml b/android/platform/android/res/values/values.xml
index fa2ede2..2cd0eb8 100644
--- a/android/platform/android/res/values/values.xml
+++ b/android/platform/android/res/values/values.xml
@@ -1,7 +1,5 @@
-
-
#009CDE
#B0BEC5
#eceff1
@@ -25,8 +23,6 @@
#455A64
#FFFFFF
-
-
50dp
18dp
12dp
@@ -47,20 +43,18 @@
2dp
- 0.7
- 1.0
-
-
- " & 1 other"
- " & %d others"
-
-
Avatar
Someone is typing
Powered by Intercom
Shadow
Welcome message
You\'ve successfully integrated your Android app with the Intercom platform.
+ CANCEL
+ SEND
Close
Congratulations
Delivered
@@ -78,14 +72,19 @@
Sending…
Not delivered. Tap to try again.
Start a conversation…
+ %dd ago
+ %dh ago
+ Just now
+ %dm ago
+ Never
+ %dw ago
+ %dy ago
Conversations
Tap to try again.
Follow us on Twitter
Unable to load conversations
Write a reply
You
-
-
+
+ - "You have a new message"
+ - "You have %d new messages"
+
+ New notifications
+ New notifications
+ %1$s from %2$s
+
\ No newline at end of file
diff --git a/android/platform/android/res/values/version.xml b/android/platform/android/res/values/version.xml
new file mode 100644
index 0000000..d8a0e1f
--- /dev/null
+++ b/android/platform/android/res/values/version.xml
@@ -0,0 +1,4 @@
+
+
+ 7571000
+
\ No newline at end of file
diff --git a/android/src/ti/intercom/android/ExampleProxy.java b/android/src/ti/intercom/android/ExampleProxy.java
deleted file mode 100644
index 3b91009..0000000
--- a/android/src/ti/intercom/android/ExampleProxy.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * This file was auto-generated by the Titanium Module SDK helper for Android
- * Appcelerator Titanium Mobile
- * Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved.
- * Licensed under the terms of the Apache Public License
- * Please see the LICENSE included with this distribution for details.
- *
- */
-package ti.intercom.android;
-
-import org.appcelerator.kroll.KrollDict;
-import org.appcelerator.kroll.KrollProxy;
-import org.appcelerator.kroll.annotations.Kroll;
-import org.appcelerator.titanium.TiC;
-import org.appcelerator.titanium.util.Log;
-import org.appcelerator.titanium.util.TiConfig;
-import org.appcelerator.titanium.util.TiConvert;
-import org.appcelerator.titanium.proxy.TiViewProxy;
-import org.appcelerator.titanium.view.TiCompositeLayout;
-import org.appcelerator.titanium.view.TiCompositeLayout.LayoutArrangement;
-import org.appcelerator.titanium.view.TiUIView;
-
-import android.app.Activity;
-
-
-// This proxy can be created by calling Tiintercomandroid.createExample({message: "hello world"})
-@Kroll.proxy(creatableInModule=TiintercomandroidModule.class)
-public class ExampleProxy extends TiViewProxy
-{
- // Standard Debugging variables
- private static final String LCAT = "ExampleProxy";
- private static final boolean DBG = TiConfig.LOGD;
-
- private class ExampleView extends TiUIView
- {
- public ExampleView(TiViewProxy proxy) {
- super(proxy);
- LayoutArrangement arrangement = LayoutArrangement.DEFAULT;
-
- if (proxy.hasProperty(TiC.PROPERTY_LAYOUT)) {
- String layoutProperty = TiConvert.toString(proxy.getProperty(TiC.PROPERTY_LAYOUT));
- if (layoutProperty.equals(TiC.LAYOUT_HORIZONTAL)) {
- arrangement = LayoutArrangement.HORIZONTAL;
- } else if (layoutProperty.equals(TiC.LAYOUT_VERTICAL)) {
- arrangement = LayoutArrangement.VERTICAL;
- }
- }
- setNativeView(new TiCompositeLayout(proxy.getActivity(), arrangement));
- }
-
- @Override
- public void processProperties(KrollDict d)
- {
- super.processProperties(d);
- }
- }
-
-
- // Constructor
- public ExampleProxy()
- {
- super();
- }
-
- @Override
- public TiUIView createView(Activity activity)
- {
- TiUIView view = new ExampleView(this);
- view.getLayoutParams().autoFillsHeight = true;
- view.getLayoutParams().autoFillsWidth = true;
- return view;
- }
-
- // Handle creation options
- @Override
- public void handleCreationDict(KrollDict options)
- {
- super.handleCreationDict(options);
-
- if (options.containsKey("message")) {
- Log.d(LCAT, "example created with message: " + options.get("message"));
- }
- }
-
- // Methods
- @Kroll.method
- public void printMessage(String message)
- {
- Log.d(LCAT, "printing message: " + message);
- }
-
-
- @Kroll.getProperty @Kroll.method
- public String getMessage()
- {
- return "Hello World from my module";
- }
-
- @Kroll.setProperty @Kroll.method
- public void setMessage(String message)
- {
- Log.d(LCAT, "Tried setting module message to: " + message);
- }
-}
\ No newline at end of file
diff --git a/android/src/ti/intercom/android/TiintercomandroidModule.java b/android/src/ti/intercom/android/TiintercomandroidModule.java
index 007abcd..87c35a9 100644
--- a/android/src/ti/intercom/android/TiintercomandroidModule.java
+++ b/android/src/ti/intercom/android/TiintercomandroidModule.java
@@ -17,6 +17,7 @@
import org.appcelerator.titanium.TiApplication;
import org.appcelerator.kroll.common.Log;
import org.appcelerator.kroll.common.TiConfig;
+import org.appcelerator.titanium.util.TiRHelper;
import io.intercom.android.sdk.Intercom;
import io.intercom.android.sdk.identity.Registration;
@@ -67,7 +68,7 @@ public void registerUnidentifiedUser() {
Intercom.client().registerUnidentifiedUser();
Log.d(LCAT, "Intercom : registerUnidentifiedUser();");
}
-
+
@Kroll.method
public void registerUserWithUserID(String userid) {
Intercom.client().registerIdentifiedUser(new Registration().withUserId(userid));
@@ -85,50 +86,56 @@ public void presentConversationList() {
Intercom.client().displayConversationsList();
Log.d(LCAT, "Intercom : presentConversationList()");
}
-
+
@Kroll.method
public void presentMessageComposer() {
Intercom.client().displayMessageComposer();
Log.d(LCAT, "Intercom : presentMessageComposer()");
}
-
+
@Kroll.method
public void logEventWithUserIDAndData(String event_name, String created_at, String user_id) {
- Map eventData = new HashMap();
- eventData.put("event_name", event_name);
+ Map eventData = new HashMap();
+ eventData.put("event_name", event_name);
eventData.put("created_at", created_at);
eventData.put("user_id", user_id);
Intercom.client().logEvent(event_name, eventData);
Log.d(LCAT, "Intercom : logEventWithNameAndData()");
}
-
+
@Kroll.method
public void logEventWithEmailAndData(String event_name, String created_at, String email) {
- Map eventData = new HashMap();
- eventData.put("event_name", event_name);
+ Map eventData = new HashMap();
+ eventData.put("event_name", event_name);
eventData.put("created_at", created_at);
eventData.put("email", email);
Intercom.client().logEvent(event_name, eventData);
Log.d(LCAT, "Intercom : logEventWithEmailAndData()");
}
-
+
@Kroll.method
public void logEventWithNameAndData(String event_name, HashMap eventData) {
Intercom.client().logEvent(event_name, eventData);
Log.d(LCAT, "Intercom : logEventWithNameAndData()");
}
-
+
@Kroll.method
public void updateUserWithAttributes(HashMap userData) {
Intercom.client().updateUser(userData);
Log.d(LCAT, "Intercom : updateUserWithAttributes()");
}
-
+
@Kroll.method
public void setDeviceToken(String token, int ic_push_logo) {
- Intercom.client().setupGCM(token, ic_push_logo);
- Log.d(LCAT, "Intercom : setDeviceToken()");
+ if(ic_push_logo > 0){
+ Log.d(LCAT, "Intercom : setDeviceToken(" + token + ", "+ ic_push_logo +")");
+ Intercom.client().setupGCM(token, ic_push_logo);
+ } else {
+ Log.d(LCAT, "Intercom : setDeviceToken(" + token + ")");
+ //Intercom.client().setupGCM(token, TiRHelper.getResource("R.drawable.intercomsdk_default_push"));
+ Intercom.client().setupGCM(token, 0x7f02003f);
+ }
+
}
}
-
diff --git a/documentation/index.md b/documentation/index.md
index fdf9ecb..1f60343 100644
--- a/documentation/index.md
+++ b/documentation/index.md
@@ -1,39 +1,77 @@
# tiintercomandroid Module
-## Description
-
-TODO: Enter your module description here
-
-## Accessing the tiintercomandroid Module
-
-To access this module from JavaScript, you would do the following:
-
- var tiintercomandroid = require("ti.intercom.android");
-
-The tiintercomandroid variable is a reference to the Module object.
-
-## Reference
-
-TODO: If your module has an API, you should document
-the reference here.
-
-### tiintercomandroid.function
-
-TODO: This is an example of a module function.
-
-### tiintercomandroid.property
-
-TODO: This is an example of a module property.
-
-## Usage
-
-TODO: Enter your usage example here
-
-## Author
-
-TODO: Enter your author name, email and other contact
-details you want to share here.
-
-## License
-
-TODO: Enter your license/legal information here.
+### add hooks folder to the module for Android GCM support
+You need to create a hooks folder twith a single js file within the module directory. This makes sure the additional R values are added for intercom during compile. For example create the following file:
+
+FILE: /modules/android/ti.intercom.android/1.0.4/hooks/intercom.js
+```
+exports.cliVersion = '>=3.X';
+
+exports.init = function(logger, config, cli, appc) {
+ cli.on('build.android.aapt', {
+ pre : function(data, next) {
+ var args = data.args[1];
+ if (args.indexOf('--auto-add-overlay') < 0) {
+ args.push('--auto-add-overlay');
+ }
+
+ var externalLibraries = [{
+ javaClass : 'io.intercom.android.sdk.gcm',
+ resPath : '/Users/jerodfritz/Appcelerator/Prspctr/modules/android/ti.intercom.android/1.0.4/platform/android/gcm-res'
+ }];
+ console.log("Add Intercom GCM External Libraries", JSON.stringify(externalLibraries));
+
+ // --extra-packages can be defined just once
+ if (args.indexOf('--extra-packages') < 0) {
+ args.push('--extra-packages');
+ args.push('');
+ }
+ var namespaceIndex = args.indexOf('--extra-packages') + 1;
+
+ externalLibraries.forEach(function(lib) {
+ if (args[namespaceIndex].indexOf(lib.javaClass) < 0) {
+ args[namespaceIndex].length && (args[namespaceIndex] += ':');
+ args[namespaceIndex] += lib.javaClass;
+ }
+ if (args.indexOf(lib.resPath) < 0) {
+ args.push('-S');
+ args.push(lib.resPath);
+ }
+ });
+ next(null, data);
+ }
+ });
+};
+```
+
+
+### tiapp.xml changes for Android GCM support
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
diff --git a/example/app.js b/example/app.js
deleted file mode 100644
index a519a81..0000000
--- a/example/app.js
+++ /dev/null
@@ -1,39 +0,0 @@
-// This is a test harness for your module
-// You should do something interesting in this harness
-// to test out the module and to provide instructions
-// to users on how to use it by example.
-
-
-// open a single window
-var win = Ti.UI.createWindow({
- backgroundColor:'white'
-});
-var label = Ti.UI.createLabel();
-win.add(label);
-win.open();
-
-// TODO: write your module tests here
-var tiintercomandroid = require('ti.intercom.android');
-Ti.API.info("module is => " + tiintercomandroid);
-
-label.text = tiintercomandroid.example();
-
-Ti.API.info("module exampleProp is => " + tiintercomandroid.exampleProp);
-tiintercomandroid.exampleProp = "This is a test value";
-
-if (Ti.Platform.name == "android") {
- var proxy = tiintercomandroid.createExample({
- message: "Creating an example Proxy",
- backgroundColor: "red",
- width: 100,
- height: 100,
- top: 100,
- left: 150
- });
-
- proxy.printMessage("Hello world!");
- proxy.message = "Hi world!. It's me again.";
- proxy.printMessage("Hello world!");
- win.add(proxy);
-}
-
diff --git a/hooks/intercom.js b/hooks/intercom.js
new file mode 100644
index 0000000..6b4e68c
--- /dev/null
+++ b/hooks/intercom.js
@@ -0,0 +1,37 @@
+exports.cliVersion = '>=3.X';
+
+exports.init = function(logger, config, cli, appc) {
+ cli.on('build.android.aapt', {
+ pre : function(data, next) {
+ var args = data.args[1];
+ if (args.indexOf('--auto-add-overlay') < 0) {
+ args.push('--auto-add-overlay');
+ }
+
+ var externalLibraries = [{
+ javaClass : 'io.intercom.android.sdk.gcm',
+ resPath : '/Users/jerodfritz/Appcelerator/Prspctr/modules/android/ti.intercom.android/1.0.4/platform/android/gcm-res'
+ }];
+ console.log("Add Intercom GCM External Libraries", JSON.stringify(externalLibraries));
+
+ // --extra-packages can be defined just once
+ if (args.indexOf('--extra-packages') < 0) {
+ args.push('--extra-packages');
+ args.push('');
+ }
+ var namespaceIndex = args.indexOf('--extra-packages') + 1;
+
+ externalLibraries.forEach(function(lib) {
+ if (args[namespaceIndex].indexOf(lib.javaClass) < 0) {
+ args[namespaceIndex].length && (args[namespaceIndex] += ':');
+ args[namespaceIndex] += lib.javaClass;
+ }
+ if (args.indexOf(lib.resPath) < 0) {
+ args.push('-S');
+ args.push(lib.resPath);
+ }
+ });
+ next(null, data);
+ }
+ });
+};