I have written an app for my Galaxy Watch and everything seems to be working except account.write is throwing an exception when I am trying to update the account. I have the privilege in the manifest and if I do not have it turned on the app does successfully request it. I am able to read the account that was created once, but it no longer seems to function. Anyone have any idea what I am doing wrong? I have tried turning it on and off manually in settings and uninstalling and reinstalling the app. I also see this behavior in 2 different apps I have, both had a write succeed once, but after that it fails.
<privileges> <privilege>http://tizen.org/privilege/account.read</privilege> <privilege>http://tizen.org/privilege/account.write</privilege> <privilege>http://tizen.org/privilege/internet</privilege> <privilege>http://tizen.org/privilege/network.get</privilege> </privileges>
private bool EnsureAccountPermissions()
{
var privilege = "http://tizen.org/privilege/account.write";
var result = PrivacyPrivilegeManager.CheckPermission(privilege);
if (result != CheckResult.Allow)
{
PrivacyPrivilegeManager.RequestPermission(privilege);
return false;
}
privilege = "http://tizen.org/privilege/account.read";
result = PrivacyPrivilegeManager.CheckPermission(privilege);
if (result != CheckResult.Allow)
{
PrivacyPrivilegeManager.RequestPermission(privilege);
return false;
}
return true;
}
if (Account == null)
Account = Account.CreateAccount();
Account.PackageName = "MyDemoApp";
Account.DisplayName = "MyDemoApp";
Account.UserName = UserName;
Account.AccessToken = AccessToken;
Account.SetCustomValue("VehicleName", VehicleName);
Account.SecrecyState = AccountSecrecyState.Invisible;
if (Account.AccountId == 0)
{
try
{
AccountService.AddAccount(Account);
}
catch (Exception e)
{
Log.Error("MyDemoApp", "MyDemoApp " + e.Message);
}
}
else
{
try
{
AccountService.UpdateAccount(Account);
}
catch (Exception e)
{
Log.Error("MyDemoApp", e.Message); Log.Error("MyDemoApp", "MyDemoApp " + e.Message);
}
}