Git Product home page Git Product logo

android-simple-facebook's People

Contributors

booker0108 avatar bperin avatar denny0223 avatar jason-wihardja avatar koraybalci avatar mateuszmlodawski avatar mrjohannchang avatar norbertschuler avatar ronlut avatar sromku avatar yongjhih avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-simple-facebook's Issues

Enhancement permissions

Hi,

It would be great to have or something like allPermissionsGranted(), so if you ask for read and write permissions it is easy to find out of all permissions have been granted. Another option is to get a list of all permissions granted.

Regards,
Mathijs.

How to publish photos?

amazing library!

i have a photo editing app , so how do i upload a picture using your library?

Cannot request publish or manage authorization with no permissions.

i am geting an exception when i am logged in. I close the app and i reopen it, if i call isLogin() it throws this exception.
Do you know whats going on?

10-28 14:00:29.242: E/AndroidRuntime(9347): com.facebook.FacebookException: Cannot request publish or manage authorization with no permissions.
10-28 14:00:29.242: E/AndroidRuntime(9347): at com.facebook.Session.validatePermissions(Session.java:1040)
10-28 14:00:29.242: E/AndroidRuntime(9347): at com.facebook.Session.open(Session.java:952)
10-28 14:00:29.242: E/AndroidRuntime(9347): at com.facebook.Session.openForPublish(Session.java:423)
10-28 14:00:29.242: E/AndroidRuntime(9347): at com.sromku.simple.fb.SimpleFacebook.openSession(SimpleFacebook.java:1147)
10-28 14:00:29.242: E/AndroidRuntime(9347): at com.sromku.simple.fb.SimpleFacebook.reopenSession(SimpleFacebook.java:1168)
10-28 14:00:29.242: E/AndroidRuntime(9347): at com.sromku.simple.fb.SimpleFacebook.isLogin(SimpleFacebook.java:802)

invite friends issue

When i invite friends it invites only friends who have already authorized the app on facebook.

deeplinking

is there a way i can deeplink my app's link ?

Library shouldn't ask for PUBLISH_ACTIONS upon login

According to Facebook, you should only request the permissions you need when you need them. This is a change from the old days of Facebook SDK 1.x and 2.x.

The way the library is currently designed (which is great by the way!), if your configuration contains both READ and PUBLISH permissions, after the session is opened, you extend the permissions; this triggers a second dialog (right after the first one) prompting the user for publish permissions:

/*
                 * Check if WRITE permissions were also defined in the configuration. If so, then ask in
                 * another dialog for WRITE permissions.
                 */
                else if (mAskPublishPermissions && session.getState().equals(SessionState.OPENED))
                {
                    if (mDoOnLogin)
                    {
                        /*
                         * If user didn't accept the publish permissions, we still want to notify about
                         * complete
                         */
                        mDoOnLogin = false;
                        mOnLoginListener.onLogin();
                    }
                    else
                    {

                        mDoOnLogin = true;
                        extendPublishPermissions();
                        mAskPublishPermissions = false;
                    }
                }

The workaround?

I define my initial config without publish permissions.

After I'm logged and before I need to do any sort of publish, I replace the configuration with one that has PUBLISH_ACTIONS too.

Since it's also very common for mobile apps to handle the FB token to a backend (even before any publish is done), I've included a new Listener/Method to request publish permissions.

I'll fork the lib and leave it there if anyone wants to use it.

After onNotAcceptingPermissions can't ask again.

Hi there,

I get constantly onNotAcceptingPermissions exception whenever I try to login again and accept read permissions after having them declined.

Happens the same on the example that comes along with the library.

Steps to reproduce:

1- Try to login asking read permissions.
2 - Click cancel.
3 - Try to login again (right after canceling, after resuming or after starting the app again)
4 - Click accept when asked again.
5 - onNotAcceptingPermissions exception thrown.

Thanks!

Get "You are not logged in" message while trying to Post

Hi,

I log the user in using a PreferenceFragment. All works well in that sense.

I want to be able to post from another screen.

I have a MainActivity which extends FragmentActivity.
In here I have made these changes.
@OverRide
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
mSimpleFacebook.onActivityResult(this, requestCode, resultCode, data);
//super.onActivityResult(requestCode, resultCode, data);
}

@Override
protected void onResume() {
    // TODO Auto-generated method stub
    super.onResume();
    mSimpleFacebook = SimpleFacebook.getInstance(this);
}

This is a tab/swipe interface so the activity I want to publish from extends Fragment.
On this screen I have made these changes.
@OverRide
public void onResume() {
super.onResume();
mSimpleFacebook = SimpleFacebook.getInstance(getActivity());
}

@OverRide
public void onActivityResult(int requestCode, int resultCode, Intent data) {
mSimpleFacebook.onActivityResult(getActivity(), requestCode, resultCode, data);
super.onActivityResult(requestCode, resultCode, data);
}

When I hit the button that calls the publish, I was get You are not logged in in the LogCat.

Any ideas?

getInstalled()

You have an issue with getInstalled() that can get fixed immediately.

/**
* Specifies whether the user has installed the application associated with the app access token that is
* used to make the request.

*

* Permissions:

* {@link Permissions#BASIC_INFO}
*
* @return True if installed, otherwise False
*/
public boolean getInstalled()
{
Boolean property = (Boolean)mGraphUser.asMap().get(Properties.INSTALLED);
if (property != null)
{
return true;
}
return false;
}

Should be changed to

/**
* Specifies whether the user has installed the application associated with the app access token that is
* used to make the request.

*

* Permissions:

* {@link Permissions#BASIC_INFO}
*
* @return True if installed, otherwise False
*/
public boolean getInstalled()
{
Boolean property = (Boolean)mGraphUser.asMap().get(Properties.INSTALLED);
if (property != null)
{
return property;
}
return false;
}

invite friend not working

when i invite friends it display Toast invitation was send but not display in friends notification

Android Studio Support

Great work. Thanks a lot for the effort. Is there any chance of you adding instructions to configure Android Studio to make use of the library?

Profile Picture

Hi,
First of all thank u for your great . I wonder that if there is a way to get user profile picture. ฤฐ tried to add "picture" tag in Profile.java but it returns null. Do i have to add picture object like Location?

Thank you

Publish Permissions decline error

I wrote what i did on your sample app step by step .

1 open app
2 login with Facebook
3 accept read permissions and decline publish permissions
4 close app
5 close app from background or go tasks and force to close app
6 open app again
7 click to publish photo
8 decline permission

then sample app stuck in "waiting for Facebook" dialog. There is no response, error or anything else.

The reason of this error when i send a additional permission request to Facebook and i decline it. Facebook creates a pending permission request. When we close and open app again and send a new additional permission request there occurs a request problem. i m confused and i don't know how can we fix it :)

exception when running the sample

When I press "login" i get :" exception unknown error: key hash ... does not match any stored hash key."

When I remove this :
@OverRide
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
mSimpleFacebook.onActivityResult(this, requestCode, resultCode, data);
super.onActivityResult(requestCode, resultCode, data);
}

I can connect but there is a problem after : for example when I try to invite freinds he tell me i'm not connect..

(I do logged in my facebbok app.)

What is the problem?

Thanks!! Your work is really helpfull

Invite request param and deleting them

Hi, in invite call, you receive the "request" param from facebook but you do not pass it to the client in onComplete call.

We do need that param to store and later delete that request from Facebook when the invite is responded by the other facebook user (invitee).

We also need a function to delete these requests in the library. Please check https://developers.facebook.com/docs/android/app-link-requests/#step3 for further info.

I may have missed this functionality in your lib, if so, apologies. I can also try to fork and implement it if you like (or don't have the time), but I am not very fond of Java (my app is an html5 one).

cheers.

Uploading a video?

Your library is totally amazing. Too bad I ran into it only now.
Is there any way of uploading a video with it?
Is it even possible? ๐ŸŽฑ
Thanks!

facbook login

facbook login work on my device but not working on my friends device when he try to login one display dialog box for read permission then when click on ok nothing happen

Exception after closing and opening login page: java.lang.UnsupportedOperationException: Session: an attempt was made to open a session that has a pending request.

Hi guys.

First of all Thanks for this API. It's saving me. Dealing with that "Official" Facebook SDK is a nightmare.

So, to the problem:

I'm using the code from the project page to login and fetch profile info.

It works. When I click on my "login" button it displays the Facebook Login page, then after login it goes to authorization and heads back to my app and it works.

BUT, if I click on login, then close the LoginDialog that opens with the Facebook Login Page, and attempt to login again I get this exception:

ERROR/Facebook(17472): Bad thing happened java.lang.UnsupportedOperationException: Session: an attempt was made to open a session that has a pending request. at com.facebook.Session.open(Session.java:958) at com.facebook.Session.openForRead(Session.java:388) at com.sromku.simple.fb.SimpleFacebook.openSession(SimpleFacebook.java:680) at com.sromku.simple.fb.SimpleFacebook.login(SimpleFacebook.java:255)

How to solve this?

twitter?

I love this library , would you add twitter also? It can be really amazing , and almost all android apps would be benefited by the work that you will do ...

onLogin() method of onLoginListener() does not get called

I was trying to include this library in my project but noticed that onLogin() method of onLoginListener() does not get called and hence the code in onLogin() does not execute. I need to publish to the feed once user logs in but there seems to be a bug.

Publish scores

Can you please give an example on how to publish a score with your lib? Graph api related part is not documented in readme. I assume we should use Story but I am not sure at all.

String score = "42";
Story story = new Story.Builder()
            .setAction("scores")
            .addActionProperty("scores", score).build();

mSimpleFacebook.publish(story, onPublishListener);

(Checking your source code, I suspect, I should call setObject as well, but I am not sure what to give there.)

I would also love an example for getting the scores, if it is possible at all with the lib and graph calls..

Enhancement: callback on not accepting write permissions

Hi,
I'm asking for bot, read and write permissions, but I can't see if someone pressed at the cancel button when the user has been asked for publish permissions. Could you add or a new method or add write permissions to the listener?

@OverRide
public void onNotAcceptingPermissions()
{
Log.w(TAG, "User didn't accept read permissions");
}

unable to login

E/AndroidRuntime(12448): java.lang.RuntimeException: Unable to resume activity {com.test.mars/com.test.mars.MainActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=64206, result=-1, data=Intent { (has extras) }} to activity {com.dotspiders.sg.UltraV/com.dotspiders.sg.UltraV.MainActivity}: java.lang.NullPointerException

i am getting this message in log cat and my app is crashing. unable to fix it. any help much appreciated.

Doubt about Invite

Hey friend, many thanks for this great job!

I need your help about invite purposes....

I can invite a friend or a lot of them without problems...the invitation are sent, ok.
How can I know if a friend has accepted my invitation? How can I make a list of friends that have accepted my invitation?

Many thanks man!

Att.

Daniel

Exception not caught when trying to publish twice before accepting the permissions

In my application I call SimpleFacebook.publish when a button is pressed. If the user did not accept the publish permissions at login, he is prompted to accept them again when he presses the button. During stress testing of our application, this button was pressed repeatedly at short intervals. This throws an exception which is not caught by SimpleFacebook:
java.lang.UnsupportedOperationException: Session: an attempt was made to request new permissions for a session that has a pending request.

I think the solution would be to wrap extendPublishPermissions(); (see SimpleFacebook.java line 873) in a try catch statement, like so:

try {
    extendPublishPermissions();
}
catch (UnsupportedOperationException e) {
    logError("User tried to extend publish permissions while still having a pending request", e);
}

setDefaultAudience does not work without facebook app

Hi.
It's a bug I discovered when I developed the video uploading feature.
When using the library without facebook app installed (my case), SimpleFacebookConfiguration.Builder().setDefaultAudience(audience) doesn't work and it always uses FRIENDS as the default setting.
This is because the [facebook documentation](https://developers.facebook.com/docs/reference/android/current/Session.OpenRequest/#setDefaultAudience(SessionDefaultAudience) declares:

Sets the defaultAudience for the OpenRequest.
This is only used during Native login using a sufficiently recent facebook app.

I'm opening it here as an issue so I won't forget it.
I (and anyone else is welcome) will fix it as soon as I'll have time.

login is not opening "facebook login"

Hi, I follow all the steps to execute login and it doesnt open the facebook login however onLoginListener onLogin() is executed.
Thanks in advance

Session

How i access previous session on reopening application.is it store in cache

Publish feed question

Hello sromku,
I'm looking into your work, that seems to me verry good.
I have a simple question: could it be possible with Feed.Builder() to use a local picture instead of a http one?

Thanks

How can i get profile directly after login successfully?

i call the getProfileExample() method in onLogin() method using the provided example.

i change the getProfileExample() method become :

private void getProfileExample() {
    // mSimpleFacebook.getProfile(onProfileRequestListener);

    // listener for profile request
    final OnProfileRequestListener onProfileRequestListener = new SimpleFacebook.OnProfileRequestListener() {

        @Override
        public void onFail(String reason) {
            hideDialog();
            // insure that you are logged in before getting the profile
            Log.w(TAG, reason);
        }

        @Override
        public void onException(Throwable throwable) {
            hideDialog();
            Log.e(TAG, "Bad thing happened", throwable);
        }

        @Override
        public void onThinking() {
            showDialog();
            // show progress bar or something to the user while fetching
            // profile
            Log.i(TAG, "Thinking...");
        }

        @Override
        public void onComplete(Profile profile) {
            hideDialog();
            Log.i(TAG, "My profile id = " + profile.getId());
            session.createLoginSession(profile.getFirstName(),
                    profile.getEmail());
            toast("My profile id = "
                    + session.getUserDetails().get(
                            Constants.SESSION_KEY_NAME)
                    + ", "
                    + session.getUserDetails().get(
                            Constants.SESSION_KEY_EMAIL));
        }
    };

    mSimpleFacebook.getProfile(onProfileRequestListener);
}

i keep get can not start activity NullPointerException in mSimpleFacebook.getProfile(onProfileRequestListener);

Gender in Profile

public String getGender()
{
String gender = String.valueOf(mGraphUser.getProperty(PROPERTY_GENDER));
return gender;
}

you can add this piece of code to end of profile.java for getting user gender.

You can edit location like this

public String getLocation()
{
GraphLocation gObject = mGraphUser.getLocation();
JSONObject jsonObject;
jsonObject = gObject.getInnerJSONObject();
String name = "";
try {
name = jsonObject.getString("name");
} catch (JSONException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
return name;
}

for getting string location

Thanks

Graph Api builder

Hi, @sromku

if you have a time you can make a graph api builder like profile builder, for all graphapi features. What do you think ?

Thanks :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.