Question

I want to implement Facebook login option to my app. I have gone through this getting started tutorial 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.

Was it helpful?

Solution

Are you talking about email + location on Facebook or email and location on your Android tablet.

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 doesn't like developers to roll their own interfaces, and will block you if you app gets popular, and you broke the TOU.

If you want to get that from Android, you'll need to add

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

to get location. You can use an Intent to send an email.

You can also reference the entire list of android permissions here

OTHER TIPS

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. 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.

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.

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. If your app overrides that look it could end up having more negative effects on your UI than just keeping the standard FB button. Also, I haven't fully read the TOU, but it could become a violation there as well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top