简体   繁体   English

Android Facebook登录设置权限

[英]Android facebook login set permissions

I want to implement Facebook login option to my app. 我想对我的应用程序实现Facebook登录选项。 I have gone through this getting started tutorial https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/ . 我已经完成了本入门教程https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/

Everything works fine but I need to add permissions to ask for user to give access to his email and location. 一切正常,但我需要添加权限以要求用户授予对其电子邮件和位置的访问权限。

How can I do that? 我怎样才能做到这一点? I want to do that with my own custom button without using facebook sdk's LoginButton. 我想用我自己的自定义按钮来做到这一点,而不使用facebook sdk的LoginButton。

Are you talking about email + location on Facebook or email and location on your Android tablet. 您是在谈论Facebook上的电子邮件和位置,还是Android平板电脑上的电子邮件和位置。

If you're talking about FB permissions you pretty much have to use the FB SDK, and request the permissions see this list of FB permissions . 如果您在谈论FB权限,则几乎必须使用FB SDK,并请求该权限,请参阅此FB权限列表 FB doesn't like developers to roll their own interfaces, and will block you if you app gets popular, and you broke the TOU . FB不喜欢开发人员使用自己的界面,如果您的应用程序流行起来并且您破坏了TOU ,它将阻止您。

If you want to get that from Android, you'll need to add 如果您想从Android获得此功能,则需要添加

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

to get location. 获取位置。 You can use an Intent to send an email. 您可以使用Intent发送电子邮件。

You can also reference the entire list of android permissions here 您还可以在此处引用整个android权限列表

Okay, so the thing with that default style is it looks like that is only applied when you inflate the layout from XML, which is nice if you want to work around the default styles. 好的,因此具有默认样式的东西看起来只在从XML扩展布局时才应用,如果您要解决默认样式,这很好。 What you could do is put a FrameLayout into your XML layout to define the bounding box for the LoginButton and then add the LoginButton programatically using the LoginButton(Context ctx, AtrributeSet attrs, int styleDef) constructor. 您可以做的是将FrameLayout放入XML布局中,以定义LoginButton的边界框,然后使用LoginButton(Context ctx, AtrributeSet attrs, int styleDef)构造函数以编程方式添加LoginButton。

That solution is pretty hacky, as it requires you to put all of your styling information into a style as opposed to XML, but it should get the job done. 该解决方案非常笨拙,因为它要求您将所有样式信息放入一种与XML相对的样式中,但是它应该能够完成工作。

Edit: I also think it behooves me to echo the above poster in saying that this probably is not the best idea for a number of reasons. 编辑:我也认为我应该赞同以上的说法,因为种种原因,这可能不是最好的主意。 From a purely cosmetic perspective a lot of users have gotten used to that blue Facebook button meaning something very specific. 从纯粹的外观角度来看,许多用户已经习惯了蓝色的Facebook按钮,这意味着非常具体的事情。 If your app overrides that look it could end up having more negative effects on your UI than just keeping the standard FB button. 如果您的应用覆盖了外观,那么它可能会给用户界面带来更多负面影响,而不仅仅是保留标准FB按钮。 Also, I haven't fully read the TOU, but it could become a violation there as well. 另外,我还没有完全阅读该TOU,但是它也可能会违反该TOU。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM