@blog.justoneplanet.info

日々勉強

androidに登録されているアカウント情報を取得する

■取得

パーミッション

AccountManagerActivity.java

package info.justoneplanet.android.sample.accountmanager;

import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

public class AccountManagerActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

Account[] accounts = AccountManager.get(this).getAccounts();
for (Account account : accounts) {
Log.e(“account – ” + account.name, account.type + “[” + account.describeContents() + “]”);
}
}
}

account.nameに実際の値が入っている感じ。

コメントはまだありません»

No comments yet.

RSS feed for comments on this post.TrackBack URL

Leave a comment