Closed atticoos closed 5 years ago
Any update on this? @ajwhite
Any update? @ajwhite ༼ つ ◕◕ ༽つ GIVE ANDROID ༼ つ ◕◕ ༽つ
Sorry guys, dropped the ball on this. So ah.. 2 months later: https://github.com/asamiller/react-native-intercom/pull/7
Awesome @ajwhite! We're going to take a look at that PR and see if we can add to it. Thanks for your work :)
Please do! This was just enough to cover what I needed, so there's certainly more that can be done :+1:
However, it's not :100: in parity with iOS -- there's some features missing, such as message composing. Given that, not sure if this should be closed until Android is 1-1 with iOS.
Yes we can hold off on closing this till we hit parity. I'll see about getting a major version bump and cutting a release tonight.
Sounds good, thanks @browniefed!
@ajwhite Do you think you could write up how to go about initializing the android version with an API key and such?
Haven't done much android work so not entirely certain where the call to Intercom.initialize
should be.
Surely - I'll also put together the instructions on how to include and compile the android version in as well. May have to come early next week
@ajwhite Where Itercom.initialize
should be in the Android source? 🆘 ;)
--P.S. Solved!)
I have added new SampleApplication.java (ofc it's the should be your title;) file in src folder with MainActivity.java file.
package com.myawesomeapp;
import io.intercom.android.sdk.Intercom;
import android.app.Application;
public class SampleApplication extends Application {
//CHANGE THESE VALUES
private final String YOUR_API_KEY = "";
private final String YOUR_APP_ID = "";
@Override
public void onCreate() {
super.onCreate();
Intercom.initialize(this, YOUR_API_KEY, YOUR_APP_ID);
}
}
And also I've changed AndroidManifest file
...
<application
android:name=".SampleApplication"
android:allowBackup="true"
...
And it works. I think to call init function in js will be a great approach, like HockeyApp integration, where simply call registration function in the method of react lifecycle.
You can stick that right in the onCreate
.
I personally have
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intercom.initialize(
getApplication(),
BuildConfig.INTERCOM_KEY,
BuildConfig.INTERCOM_PROJECT
);
}
Note: my key/project is derived from environment variables in the gradle build process. can just stick them in there obvi
Thank you.) I hope somebody with the same noob problem can find this solution here)
I really owe you guys a setup guide 😞 I'm sorry!
Soon ™️
Im still having some troubles setting up Intercom
for android(ios works just fine), the thing I did is:
MainApplicaiton.java
import io.intercom.android.sdk.Intercom;
private final String API_KEY = "";
private final String APP_ID = "";
@Override
public void onCreate() {
super.onCreate();
Intercom.initialize(
this,
API_KEY,
APP_ID
);
}
app/build.gradle
dependencies {
compile project(':react-native-intercom')
}
settings.gradle
include ':react-native-intercom'
project(':react-native-intercom').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-intercom/android')
What troubles are you running into @dinodsaurus? Can you share some context of the error/problem?
First of all thanks for this quick response!
Build is successful but every time I try to call an Intercom
method that method is undefined
https://www.dropbox.com/s/ixeuz1iibjsf60w/Screenshot%202016-08-19%2016.51.03.png?dl=0
Mind linking a gist
of the file that produces this error?
I had a similar issue when adding it to my android application and solved by using getApplication
instead of this
.
Something like:
public class MainActivity extends ReactActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intercom.initialize(
getApplication(),
"<API_KEY>",
"<APP_ID>"
);
@dinodsaurus I had to register IntercomPackage
in MainApplication
as well:
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new IntercomPackage()
);
}
Hello everyone and thanks for the wrapper. Has anyone managed to successfully receive push notifications? I ve followed all the instructions - managed to successfully install intercom (am able to register and log out users) but still no push notifications.
Hey @ajwhite you can find my MainApplication.java
here - https://gist.github.com/dinodsaurus/da6641d4be1af653619b6ff6afcead75
The error that Im getting now is
.../android/app/src/main/java/com/ivyspacestudent/MainApplication.java:22: error: cannot find symbol
protected void onCreate(Bundle savedInstanceStat) {
^
symbol: class Bundle
location: class MainApplication
.../android/app/src/main/java/com/ivyspacestudent/MainApplication.java:21: error: method does not override or implement a method from a supertype
@Override
^
Im having the same error that @dinodsaurus. When I try to call the methods from Intercom, one error is dispatched on promise saying that method is undefined.
RN - 0.33
react-native-intercom - 3.0.3
MainApplication.java
import io.intercom.android.sdk.Intercom;
import android.app.Application;
public class SampleApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
Intercom.initialize(this, API_KEY, APP_ID);
}
}
app/build.gradle
dependencies { compile project(':react-native-intercom') }
settings.gradle
include ':react-native-intercom' project(':react-native-intercom').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-intercom/android')
Edit: on iOS is working fine.
You need to add new IntercomPackage()
to your MainApplication.getPackages()
// ...
import com.robinpowered.react.Intercom.IntercomPackage;
public class MainApplication extends Application implements ReactApplication {
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
// ...
new IntercomPackage()
);
}
};
Works here! Thanks all!
MainApplicaiton.java
import com.robinpowered.react.Intercom.IntercomPackage;
import io.intercom.android.sdk.Intercom;
private final String API_KEY = "";
private final String APP_ID = "";
@Override
public void onCreate() {
super.onCreate();
Intercom.initialize(
this,
API_KEY,
APP_ID
);
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new IntercomPackage()
);
}
app/build.gradle
dependencies {
compile project(':react-native-intercom')
}
settings.gradle
include ':react-native-intercom'
project(':react-native-intercom').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-intercom/android')
I've like triple checked @vitorebatista's comment with my files, and I'm getting no where
You can stick that right in the
onCreate
.I personally have
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intercom.initialize( getApplication(), BuildConfig.INTERCOM_KEY, BuildConfig.INTERCOM_PROJECT ); }
Note: my key/project is derived from environment variables in the gradle build process. can just stick them in there obvi
how do you get BuildConfig.INTERCOM_KEY ?
Thanks for putting together this package!
I'm in the process today in integrating Android on my fork. I'll throw a pull request your way at some point this week :smile: