Skip to content

Commit

Permalink
improve Android code integration documentation (#152)
Browse files Browse the repository at this point in the history
* improve Android code integration documentation

* update android doc after code review

#152

* Update README.md

* Update README.md
  • Loading branch information
slorber authored and browniefed committed Jan 30, 2018
1 parent e170939 commit 0a8efd4
Showing 1 changed file with 60 additions and 17 deletions.
77 changes: 60 additions & 17 deletions README.md
Expand Up @@ -50,27 +50,70 @@ Initialize Intercom in your `AppDelegate.m`

More instructions here: [Intercom for Android](https://github.com/intercom/intercom-android)

```
Intercom.initialize(getApplicationContext(), "your api key", "your app id");
Your Android Application should look like:

```java
// ...
import com.robinpowered.react.Intercom.IntercomPackage;
import io.intercom.android.sdk.Intercom;

public class MainApplication extends Application {

@Override
public void onCreate() {
super.onCreate();
Intercom.initialize(this, "your api key", "your app id");
// ...
}

public List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
// ...
new IntercomPackage()
// ...
);
}
}

```

And in your *AndroidManifest.xml* file add the following lines within the `<application> ... </application>` tags
And in your *AndroidManifest.xml* should look like
```xml
<service
android:name="com.robinpowered.react.Intercom.IntercomIntentService"
android:exported="false">
<intent-filter
android:priority="999">
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.myapp"
...
... add the tools namespace if not already present...
xmlns:tools="http://schemas.android.com/tools"
...
>

<application
...
>

...
...
  ...

<!-- Add these lines -->
   <service
android:name="com.robinpowered.react.Intercom.IntercomIntentService"
android:exported="false">
<intent-filter
android:priority="999">
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
</intent-filter>
</service>

<receiver
android:name="io.intercom.android.sdk.push.IntercomPushBroadcastReceiver"
tools:replace="android:exported"
android:exported="true" />
```
Make sure to add *xmlns:tools="http://schemas.android.com/tools"* in your main `<application>` tag
</intent-filter>
</service>
<receiver
android:name="io.intercom.android.sdk.push.IntercomPushBroadcastReceiver"
tools:replace="android:exported"
android:exported="true" />

</application>
</manifest>
```

Don't forget the *tools* namespace `xmlns:tools="http://schemas.android.com/tools"` in your main `<application>` tag

Usage
=====
Expand Down

0 comments on commit 0a8efd4

Please sign in to comment.