我想允许用户向我提供他们的电子邮件地址,而无需键入它。理想情况下,会是一个文本字段,用户既可以键入电子邮件地址,或按下按钮,自动填充。
I want to allow the user to provide me their email address without typing it in. Ideally, there'd be a text field where the user could either type an email address or push a button to autofill it.
在前面一个问题,Roman Nurik建议使用一个的AccountManager 来处理这个问题,但这需要我的应用程序使用GET_ACCOUNTS权限;我的应用程序便可以访问所有的用户帐户的设备,包括他们的Facebook / Twitter账户上。该权限似乎太宽泛了我想要的。
In an earlier question, Roman Nurik suggests using an AccountManager to handle this, but that requires my app to use the GET_ACCOUNTS privilege; my app could then access all of the user's accounts on the device, including their Facebook/Twitter accounts. That permission seems way too broad for what I want.
有没有一种更好的方式来处理这种不需要给予我的应用程序,例如重型许可?
Is there a nicer way to handle this that doesn't require granting my app such a heavy duty permission?
推荐答案事实上,不仅你不能做到这一点没有GET_ACCOUNTS,你想要的信息只存在于用户的(谷歌)帐户数据。
Indeed, not only can't you do this without GET_ACCOUNTS, the information you want only exists in the user's (Google) account data.
在我的Sprint手机,所有者地址冲刺分配是 myusername@sprintpcs ,并且可以使用被看作 getprop 从shell。但是,这不是我的主电子邮件地址,甚至是一个我曾经使用/检查。你的需要的是我的Gmail地址,并储存在Android的帐户数据。
On my Sprint phone, the 'owner' address sprint assigns is myusername@sprintpcs, and that can be seen using getprop from a shell. But that's not my primary email address, or even one I ever use/check. What you want is my gmail address, and that's stored in the Android account data.
其实,你想的的两个中的一个的 - 这是你需要GET_ACCOUNTS另一个原因。如果你要问我的电子邮件地址,你需要让我中选出两个@ gmail占我已经在设备上配置。 我知道哪一个是我的'preferred'一(但即使这样的语境),但AFAIK没有被认为是由系统更主要或默认比其他。
Actually, you want one of the two — which is another reason you need GET_ACCOUNTS. If you're going to ask for my email address, you need to let me select among the two @gmail accounts I have configured on the device. I know which one is my 'preferred' one (although even that's contextual), but AFAIK neither is considered by the system to be more 'primary' or 'default' than the other.
更多推荐
入门安卓所有者的电子邮件地址,很好
发布评论