channel-io-wi-synergy-sdk
package.json
Add dependency to "dependencies": {
"channel-io-wi-synergy-sdk": "git+https://github.com/zoyi/channel-io-wi-synergy-sdk.git",
}
npm install
react-native link
android/settings.gradle
Add dependency to include ':channel-io-wi-synergy-sdk'
project(':channel-io-wi-synergy-sdk').projectDir = new File(settingsDir, '../node_modules/channel-io-wi-synergy-sdk/android')
android/app/build.gradle
Add dependency to dependencies {
compile project(':channel-io-wi-synergy-sdk')
}
Add package to Application class
import com.zoyi.channel.wi.android.ChannelPackage;
public class MyApplication extends MultiDexApplication implements ReactApplication {
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new ChannelPackage() // Here
);
}
}
ChannelIO.track
function in js code
Call We do not recommend calling this function often.
We recommend call track
function when login succeed or application is start up
import ChannelIO from 'channel-io-wi-synergy-sdk'
ChannelIO.track(
pluginKey,
userId,
{
age: 19,
gender: 'male'
}
).then(() => {
console.log('success')
}).catch((error) => {
console.log(error)
})
ChannelIO.track(pluginKey, userId, profile)
-
pluginKey
(string, required)Channel plugin key
-
userId
(string, required)User id for specify user. It can be login id, hashed device id, etc...
-
profile
(object map, required)Profile information to logging. Map value can be
string
,number
,boolean