Callbacks

BootCallback

Callback when ChannelIO.boot is success or serve error

ParameterDescription
bootStatusBoot result

See BootStatus
userUser data when boot successful

See User
BootConfig bootConfig = BootConfig.create(YOUR_PLUGIN_KEY);

ChannelIO.boot(bootConfig, new BootCallback() {
  @Override
  public void onComplete(BootStatus bootStatus, @Nullable User user) {
    if (bootStatus == BootStatus.SUCCESS && user != null) {
      // success
    } else {
      // show failed reason from bootStatus
    }
  }
});
let bootConfig = BootConfig(pluginKey: YOUR_PLUGIN_KEY)

ChannelIO.boot(with: bootConfig) { (completion, user) in
	if completion == .success, let user = user {
		// success
	} else {
		// show failed reason from bootStatus
	}
}
BootConfig *bootConfig = [[BootConfig alloc] init];
[bootConfig setPluginKey:YOUR_PLUGIN_KEY];
[ChannelIO bootWith:bootConfig completion:^(BootStatus status, User *user) {
  if (status == BootStatusSuccess && user != nil) {
    // success
  } else {
    // show failed reason from bootStatus
  }
}];
const config = {
  "pluginKey": YOUR_PLUGIN_KEY,
  "memberId": MEMBER_ID,
  "memberHash": MEMBER_HASH,
  "profile": {
    "name": NAME,
    "email": EMAIL,
    "mobileNumber": "+~~~",
    "avatarUrl": AVATAR_URL,
    OTHER_KEY: OTHER_VALUE,
  },
  "language": LANGUAGE, // "en", "ko", "jp"
  "unsubscribed": BOOLEAN,
  "trackDefaultEvent": BOOLEAN,
  "hidePopup": BOOLEAN,
  "channelButtonOption": {
    "xMargin": 16,
    "yMargin": 16,
    "position": POSITION,  // "left", "right"
  },
}

ChannelIO.boot(config).then((result) => {
  // result.status
  // result.user
})

UserUpdateCallback

Callback used to

contains exception and User data

ChannelIO.addTags(testTags, new UserUpdateCallback() {
  @Override
  public void onComplete(@Nullable Exception e, @Nullable User user) {
    if (user != null) {
      // check result
    } else if (e != null) {
      // see reason of failure.
    } 
  }
});
ChannelIO.addTags(testTags) { (error, user) in
  if let user = user {
    // success
  } else if error = error {
    // check reason
  }
}
[ChannelIO addTags:testTags completion:^(NSError * error, User * user) {
  if user != nil {
    // success
  } else if error != nil {
    // check reason
  }
}];
const user = {
  "language": LANGUAGE, // "ko", "jp", "en"
  "tags": ["1", "2", "3"],
  "profile": {
    "name": NAME,
    "email": EMAIL,
    "mobileNumber": '+~~~',
    "avatarUrl": AVATAR_URL,
    OTHER_KEY: OTHER_VALUE,
  },
  "profileOnce": {
  },
  "unsubscribed": BOOLEAN,
};
ChannelIO.updateUser(user).then((result) => {
  // result.error
  // result.user
});