어제 올렸었는데 답변이 안달려서 다시질문 할게요.

 

AccountManager mgr = AccountManager.get(this);

Account[] accts = mgr.getAccountsByType("com.google");

Account acct = null;

if(accts.length>0)

acct = accts[0];

이방법으로 계정을 가져오고

String passwd =mgr.getPassword(acct);

패스워드는 가져와 지지않네요. 안드로이드 내부 권한 문제라고 생각됩니다.

 

포기하고 있었는데 일정관리로 인기가 많은 어플인 Jorte는 구글 캘린더에 연동할때

구글 개정의 패스워드를 입력하지 않아도 연동이 되게 구현했더라구요.

어떤방식으로 구현해야 하는지 조언즘주세요~!,

투데이리스트 어플이나 jorte 어플에서 계정정보(패스워드 또는 인증정보)를 어떻게 가져온건지에대한

조언 부탁드립니다.

 

   HttpURLConnection httpurlconnection = (HttpURLConnection)(new URL("https://www.google.com/accounts/ClientLogin")).openConnection();
            httpurlconnection.setRequestMethod("POST");
            httpurlconnection.setDoInput(true);
            httpurlconnection.setDoOutput(true);
            httpurlconnection.setUseCaches(false);
            httpurlconnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
            StringBuilder stringbuilder = new StringBuilder();
            stringbuilder.append("Email=").append(uEmail);
            stringbuilder.append("&Passwd=").append(uPasswd);
            stringbuilder.append("&service=").append("cl");
            OutputStream outputstream = httpurlconnection.getOutputStream();
            outputstream.write(stringbuilder.toString().getBytes("UTF-8"));
            outputstream.close();

 

이런형식으로 이메일 정보를 넘길때 사용하고 있습니다.

profile