-
Notifications
You must be signed in to change notification settings - Fork 2
UserAPI
fkmhrk edited this page Oct 12, 2013
·
4 revisions
require_once ('<library_root>'. '/src/kii/KiiAppAPI.php');
$context = new KiiContext(APP_ID, APP_KEY, SITE);
$appApi = new KiiAppAPI($context);
$api = $appApi->userAPI();
try {
$installationId = $api->installDevice($user, UserAPI::OS_ANDROID, $regId);
} catch (CloudException $e) {
//error handling
}
If deviceType(2nd argument) is UserAPI::OS_IOS, you can set 4th argument to tell that this deviceToken is for development / production.
try {
// TRUE : development / FALSE : production(default)
$installationId = $api->installDevice($user, UserAPI::OS_IOS, $deviceToken, TRUE);
} catch (CloudException $e) {
//error handling
}
try {
$api->uninstallDevice(UserAPI::OS_ANDROID, $regId);
} catch (CloudException $e) {
//error handling
}
$user = $appApi->login('fkm', 'password123456');
$topic = new KiiTopic($user, 'test');
try {
$api->subscribe($user, $topic);
} catch (CloudException $e) {
//error handling
}