How to synchronize data between an account and a web server in android?
I have created a project where I am trying to create an account of my own and through that account I want to get the server data after a specific amount of interval period. So far, I have googled, I have found this useful link
which tells me a lot. But I can't have a clear idea of the steps what to do for my project. I will certainly appreciate any help or suggestions. Here is what I have done to create my account:-
public void onClick(View arg0) {
// startActivity(new Intent(Settings.ACTION_ADD_ACCOUNT));
str1 = ed1.getText().toString();
str2 = ed2.getText().toString();
if ((str1.matches(""))||(!str1.contains("@myapp.com"))) {
Toast.makeText(MainActivity.this, "Invalid type of User email id!", Toast.LENGTH_SHORT).show();
return;
}
if (str2.matches("")) {
Toast.makeText(MainActivity.this, "You did not enter a password", Toast.LENGTH_SHORT).show();
return;
}
Account account = new Account(str1, "com.example.accountMy");
String password = str2;
AccountManager accountManager = AccountManager.get(context);
boolean success = accountManager.addAccountExplicitly(account, password, null);
if(success){
Toast.makeText(MainActivity.this, "Myapp Account Created!", Toast.LENGTH_LONG).show();
}else{
Toast.makeText(MainActivity.this, "Account is not Created!", Toast.LENGTH_LONG).show();
}
}});
and I have used Customauthenticator and AcountauthenticatorService class to authenticate my account. Please advice.