In My Application i am Using the Below Code to Uploade the Photo.
While i am unistalling the application and reinstall the application and posting thehoto on the facebook and if the faceboook id is new then it gives me the screen of application allow access. but Some time it not gives me that screen. I dont know whats the problem in it.
Please see the code and give me the Sollution. Why i am not able to get the application allow access Screen. Thanks.
the Code is:
// For Facebook ===================================
Button facebookButton = (Button) saveButtonDialog.findViewById(R.id.facebook);
facebookButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
saveButtonDialog.dismiss();
saveImageFunction(); // to save the Image
facebook.authorize(TWSBIDrawMainActivity.this, new String[]{ "user_photos,publish_checkins,publish_actions,publish_stream"},new DialogListener() {
@Override
public void onComplete(Bundle values) {
postImageonWall();
Toast.makeText(getApplicationContext(), "Image Posted on Facebook.", Toast.LENGTH_SHORT).show();
//File f = new File(APP_FILE_PATH + "/"+filename+".jpg");
//f.delete();
}
@Override
public void onFacebookError(FacebookError error) {
}
@Override
public void onError(DialogError e) {
}
@Override
public void onCancel() {
}
});
}
});
public void postImageonWall() {
byte[] data = null;
Bitmap bi = BitmapFactory.decodeFile(APP_FILE_PATH + "/"+filename+".jpg");
//Bitmap bi = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bi.compress(Bitmap.CompressFormat.JPEG, 100, baos);
data = baos.toByteArray();
Bundle params = new Bundle();
params.putString(Facebook.TOKEN, facebook.getAccessToken());
params.putString("method", "photos.upload");
params.putByteArray("picture", data);
AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook);
mAsyncRunner.request(null, params, "POST", new SampleUploadListener(), null);
}
A Solid Guess : Its because you have allowed this application(app id) in past so you just log-in to your facebook accout - go to your application and remove that app. so next time it will ask.
you tried another unm and pwd then also its not shown properly? then I don't have solution right now..will have to search for that...but meanwhile you can do one thing make use of another app id or unm/pwd and check your code!
and then to resolve your error (I am guessing cause didn't got such issue yet)..while log-in the window appears is from the facebook default app..so this all problem happens..to remove that and call your own pop-up dialog see My Answer Here.
Thanks.