APP needs access to database of Facebook without user

  • Replies:0
Dev Trinat
  • Forum posts: 1

Jan 14, 2016, 3:48:09 PM via Website

Hello,

I am developping an application which search a data in Facebook and lists them. I have started with following things: AppId, AppSecret, which package, which class, which key hashes, rights of internet,... I have followed some tutorials.

All codes (I find) are only for users of facebook. With the aid of toast I have checked that AccessToken.getCurrentAccessToken() is always zero. I cannot connect my application.
Without "parameters.putString("access_token", appId );" I get following message: "D/GraphRequest﹕ Warning: Request without access token missing application ID or client token.".
In the other codes I have found, the developers make AppId and AppSecret, but the Facebook's website says to not use AppSecret. I don't have the warning above anymore using parameters.putString with appId|appSecret or if I only use appId.

I don't know how to search for or safe an information. I don't know if with my code it is already done or they are missing some commands. The object rebonse is unfindable although it is in the settings.

I have tried other graphRequests with JSON,... but there was never one code without errors.

Following my code:

   String appId = ""+R.string.facebook_app_id;
GraphRequest request = GraphRequest.newGraphPathRequest(
        AccessToken.getCurrentAccessToken(),
        //AccessToken.setCurrentAccessToken(AccessToken("mAccessToken", appId, null, null, null, AccessTokenSource.FACEBOOK_APPLICATION_NATIVE, null, null)),
        "/https :/ /g raph.f acebook.c om /search",
        new GraphRequest.Callback() {
                @Override
                public void onCompleted(GraphResponse response) {
                        if(AccessToken.getCurrentAccessToken() == null)
                                Toast.makeText(getBaseContext(), "NULL", Toast.LENGTH_SHORT).show();
                        else
                                Toast.makeText(getBaseContext(),"non nul", Toast.LENGTH_SHORT).show();
                        }
                });

                Bundle parameters = new Bundle();
                //parameters.putString("access_token", " 000000000000000 | AppSecret ");
                parameters.putString("access_token", appId );
                parameters.putString("q", "Paris");
                parameters.putString("type", "event");
                parameters.putString("want_localized_name", "true");
                parameters.putString("limit", "5000");
                parameters.putString("debug", "all");
                request.setParameters(parameters);
                request.executeAsync();

                //getFacebookData();

                /*
                GET graph.facebook.com
                /search?
                    q=MotClef&    //mot clef
                    type=TypeDeResultat& //type de recherche : place,user, page, event, group, place, placetopic
                    center=37.76,-122.427& //centre de recherche, je ne sais pas l'unitée
                    distance=1000     //jusqu'à quelle distance en metre
                 */
        }

What do I have to do now?

Thank you for all your help!

Reply