# smooch-cordova
Cordova (PhoneGap) bindings for Smooch.
Install Smooch iOS or Android libraries,
On iOS: http://docs.smooch.io/#manual-method
On Android: http://docs.smooch.io/android/#adding-smooch-to-your-app
cordova plugin add io-smooch-smcordovaplugin
You should now see smooch-cordova.js and the SmoochCordova source files in your project directory.
In your javascript:
Smooch.init({
"appToken" : "your-smooch-app-token",
"conversationAccentColor" : "#FFFFFF" // optional, default is #00B0FF
});
IMPORTANT: This call must be made AFTER the deviceready
event of Cordova.
See http://docs.smooch.io/api/ios/Classes/SKTSettings.html for other init settings.
Init Smooch(natively) in the Application class, for example:
public class MainApplication extends Application {
public void onCreate() {
super.onCreate();
Smooch.init(this, "your-smooch-app-token");
}
}
The javascript init call will not work in Android. It must be done natively.
See http://docs.smooch.io/api/android/ for other init settings.
Now, you're ready to show the Smooch chat window.
Smooch.show();
Smooch.setUser({
"firstName" : "Erlich",
"lastName" : "Bachman",
"email" : "erlich.bachman@aviato.com",
"signedUpAt" : 1397606400000 // unix timestamp in milliseconds
});
Smooch.setUserProperties({
"tv_show" : "Silicon Valley",
"episodes" : "Server Space, The Lady, Bad Money",
"net_worth" : 1000000
});
Smooch.track("Slapped kid");