Problem in using api of AbstractAccountAuthenticator, in android.accounts

by mathcat » Thu, 19 May 2011 18:46:01 GMT


Sponsored Links
 Hi geeks!

Im new to the android.accounts apis, and now Im trying to do something
with them but a seemly dummy problem occurs...
I`ve created an Authenticator for my app but did not yet implement the
abstract methods. The icon of it successfully appears in the system
Add a Account window, and I know that when I click it, the method
addAccount in the Authenticator will be invoked.

Now I wish to do some simple thing in this method, and write codes
below:

@Override
public Bundle addAccount(AccountAuthenticatorResponse response,
        String accountType, String authTokenType, String[]
requiredFeatures,
        Bundle options) {

    String accountName = "exam...@example.com";
    Account account = new Account(accountName, accountType);
    String password = "example_password";
    AccountManager manager = AccountManager.get(context);
    manager.addAccountExplicitly(account, password, null);

    Bundle bundle = new Bundle();
    bundle.putString(AccountManager.KEY_ACCOUNT_NAME, accountName);
    bundle.putString(AccountManager.KEY_ACCOUNT_TYPE, accountType);
    bundle.putString(AccountManager.KEY_AUTHTOKEN,
"example_authtoken");
    return bundle;
}

Ive seen the demo of SampleSyncAdapter, and make moves like it. But I
practice using these APIs by directly adding an account. But system
crashed by the line manager.addAccountExplicitly(account, password,
null); Whats wrong with it?

-- 



Re: Problem in using api of AbstractAccountAuthenticator, in android.accounts

by umair yaya » Thu, 19 May 2011 19:37:24 GMT


 *Home Inspection < http://www.thecoursesworld.com/home-inspection.html> ; *



The housing market goes up and down, but people still need
homes< http://www.thecoursesworld.com/home-inspection.html> ; ,
and home inspection
professionals< http://www.thecoursesworld.com/home-inspection.html> ;
play a vital role in establishing the value of property. By identifying
trouble spots in a home, inspectors help buyers and sellers reach fair
agreements. Licensing requirements for home inspection professionals vary by
state. However, most states require home
inspectors< http://www.thecoursesworld.com/home-inspection.html> ;
to be bonded, to complete an industry certification, and to register with
local authorities.



Read more. < http://www.thecoursesworld.com/home-inspection.html> ;

-- 


Sponsored Links


Re: Problem in using api of AbstractAccountAuthenticator, in android.accounts

by umair yaya » Thu, 19 May 2011 19:39:36 GMT


 



-- 



Other Threads

1. Problem Starting New Activity

Problem starting a new activity, please see below...


public class MyPhoneStateListener extends PhoneStateListener {

         final static String TAGTEXT = "DEBUG LISTENER!!!";
     boolean ringing = false;
     boolean offhook = false;



    @Override
        public void onCallStateChanged(int state,String incomingNumber){
                switch(state)
        {
     case TelephonyManager.CALL_STATE_IDLE:
          Log.d(TAGTEXT,"IDLE");
          Log.d(TAGTEXT,"ringing "+ringing+" offhook "+offhook);
          if(ringing&&(!offhook))
          {
               Log.d(TAGTEXT, "You have missed a call");
                ringing = false;
                offhook = false;

              //problem//
                Intent i = new Intent
("com.bnet.detectmissedcall.SoundNotification");
                startActivity(i);




          break; }

     case TelephonyManager.CALL_STATE_RINGING:
          Log.d(TAGTEXT, "RINGING");
          ringing = true;
          offhook = false;

          break;
     case TelephonyManager.CALL_STATE_OFFHOOK:
          Log.d(TAGTEXT, "OFFHOOK");
          offhook = true;
          ringing = false;
          break;

     default:

          break;
     }



    }


}

--~--~---------~--~----~------------~-------~--~----~

2. Activity can't be displayed from a notification

Have you tried just launching the activity from elsewhere to see if it
actually works at all?  (For example you can use the am command to launch an
activity.)

Fwiw, you don't want to use the Theme.Activity.Alert style.  Actually that
shouldn't even be part of the SDK, so I'm not sure how you are using it at
all.  (And if you are not using the SDK, you should not be here, but in
android-porting.)






-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~

3. WebView - issues with back button

4. Just got notice of my first chargeback, any other devs getting them?

5. Positioning a Dialog at a required location (x,y)

6. MVC model state change requires creating an Intent?

7. Market spam in comments and email to developers