android-account

Should you use AccountManager for storing Usernames and Passwords for an Android app?

安稳与你 提交于 2019-11-27 01:22:03
问题 I would like to know if one should implement AccountManager to save user credentials such as username, email, passwords etc. I can't find a good reason to use it myself. I don't want other applications to have access to the Accounts and I don't really want them showing in the "Accounts and Sync" settings (although maybe that's not a big deal). So my question is: should I use it? Pros/cons? Can I hide the Accounts from other apps and stop them from appearing in "Accounts and Sync"? 回答1: This

Pick an email using AccountPicker.newChooseAccountIntent

落爺英雄遲暮 提交于 2019-11-27 00:52:19
问题 I'm trying to let the user pick an Email account using the following code: Intent intent = AccountPicker.newChooseAccountIntent(null, null, new String[]{"com.google"}, false, null, null, null, null); startActivityForResult(intent, 23); This code works great but if the user doesn't have a Gmail account but Yahoo, Hotmail, etc.. How can I show all Email accounts by changing the third parameter: new String[]{"com.google"} Thank you very much 回答1: According to the docs, the third parameter is

How to add whatsapp like options to contact whenever the is a new contact added to Contacts

心已入冬 提交于 2019-11-26 14:31:50
问题 I develop an app which needs to do 2 things: Create a user account (like WhatsApp). Whenever there is a new contact entry, if the contact is using my app, then immediately in the Contacts application show options "call" or "message" in the contact detail page. Example 回答1: You need to create a SyncAdapter , this is basically a service that is able to sync contacts to/from a server, like Google does for Google Contacts , you can set it to be notified when a new contact is added, and have your

How to maintain session in android?

两盒软妹~` 提交于 2019-11-26 10:25:41
问题 Can anybody tell me how to maintain session for a user login. For example when the user sign- in to an application they have to be signed in unless the user logouts or uninstall the application similar to gmail in android. 回答1: Make one class for your SharedPreferences public class Session { private SharedPreferences prefs; public Session(Context cntx) { // TODO Auto-generated constructor stub prefs = PreferenceManager.getDefaultSharedPreferences(cntx); } public void setusename(String usename