在我的應用程序中,我必須在單擊按鈕時發送郵件。除了「發件人地址」之外,我還有關於發送郵件的所有詳細信息。這個「發件人地址」應該是android手機中配置的Gmail帳戶。我如何獲取這些細節?任何人都可以幫忙嗎?檢索在android中配置的gmail帳戶詳細信息
2
A
回答
3
它得到了工作用的AccountManager類。
AccountManager manager = AccountManager.get(this);
Account[] accounts = manager.getAccountsByType("com.google");
Account account = accounts[0];
我們可以獲取使用
account.name
帳戶名和使用
manager.getPassword(account)
-1
您可以使用內置的ACTION_SEND
意圖使用默認的Android的郵件發送應用程序here你有一個例子。
這是你所需要的零件:
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
//set the content-type
emailIntent.setType("plain/text");
//set the receivers address
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { address.getText().toString() });
//set the subject
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText());
//set the text
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText());
Email.this.startActivity(Intent.createChooser(emailIntent, "Send mail..."));
注:我沒有測試它自己
+0
我在後臺發送郵件的加密密碼。如果我這樣做,然後屏幕會彈出詢問詳細信息...任何人有任何想法?有沒有人使用過GoogleLoginServiceHelper? – Mathew 2011-01-07 11:10:18
相關問題
- 1. Android主詳細信息詳細信息
- 2. 從CRM中檢索CampaignResponse詳細信息
- 3. PHP更新用戶帳戶的詳細信息沒有顯示錯誤,但帳戶詳細信息未更新
- 4. 要設置商戶帳戶的詳細信息
- 5. 在android中檢索電話簿的聯繫人詳細信息
- 6. 搜索用戶詳細信息表格
- 7. Crystal Reports詳細信息詳細信息
- 8. 存儲配置詳細信息
- 9. 用戶詳細信息表中的用戶認證詳細信息或單獨?
- 10. 從Square客戶中檢索卡片詳細信息
- 11. 如何從提到推文中檢索用戶詳細信息?
- 12. 客戶詳細信息
- 13. 在登錄時檢查用戶詳細信息Android
- 14. Android按鈕詳細信息
- 15. 如何使用Java API創建和訪問Gmail帳戶詳細信息?
- 16. c#獲取windows用戶配置文件的詳細信息?
- 17. 使用openid檢索用戶詳細信息
- 18. webservice中的客戶詳細信息
- 19. 如何通過用戶id在for循環中檢索用戶詳細信息?
- 20. 在Android上與Google/Google plus帳戶關聯的Youtube頻道的詳細信息
- 21. 在ASP.NET MVC中檢查用戶的詳細信息ActionFilter
- 22. 合併帳戶詳細信息使用CRM 4.0 Webservice(如果帳戶存在)
- 23. 檢索EKCalendar的帳戶信息
- 24. 活動目錄 - 獲取新創建的帳戶詳細信息
- 25. Paypal快速結帳 - 客戶的更多詳細信息
- 26. 如何檢索短信,電子郵件的詳細信息
- 27. 檢索從露天休息API的內容詳細信息API
- 28. 使用SQL檢索Magento中的產品詳細信息
- 29. 如何在wso2中添加外部配置詳細信息
- 30. 如何使用Get-MailBox獲取所有帳戶詳細信息
到目前爲止,這是行不通的。我得到以下錯誤:「java.lang.SecurityException:調用者uid 10155是不同於認證者的uid」。我不認爲你可以從第三方應用程序獲得Google密碼。請糾正我,如果我錯了,併發布解決這個問題。謝謝! – 2012-07-30 14:32:10