Add account automatically

前端 未结 3 1636
不知归路
不知归路 2020-12-16 07:59

My application needs to synchronize some data from server. I added necessary classes (similarly to SampleSyncAdapter) now I can add account via \"Settings/Sync and Accounts\

3条回答
  •  無奈伤痛
    2020-12-16 08:42

    Don't you have to add to the following code posted by Evan Elliott :

    Account account = new Account("Title", "com.package.nom");
    String password = "password";
    AccountManager accountManager = AccountManager.get(context);
    accountManager.addAccountExplicitly(account, password, null);
    

    The following: ?

    authenticator.xml

    
    
     
    

    and permissions?

提交回复
热议问题