android


android simple facebook returning “cancelled by user” when trying to share a post


I have downloaded and setup the android simple facebook sdk from github. I have made a simple page to test publishing a feed, and I was able to get to the point where I can add a message and click "share". However, once I click share, a progress dialog comes up that says "sending..." and then it goes away but nothing is sent. I printed the error message and it just says "Cancelled by user".
Here is the code I have, its just a button that logs in, and on success tries to post a feed.
Button postStuff;
private UiLifecycleHelper uiHelper;
Permission[] permissions = new Permission[] {
Permission.USER_PHOTOS,
Permission.EMAIL,
Permission.PUBLISH_ACTION
};
SimpleFacebookConfiguration configuration = new SimpleFacebookConfiguration.Builder()
.setAppId("My-App-ID")
.setNamespace("my_namespace")
.setPermissions(permissions)
.build();
SimpleFacebook mSimpleFacebook;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.fbtest);
SimpleFacebook.setConfiguration(configuration);
postStuff = (Button) findViewById(R.id.postStuff);
postStuff.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
OnLoginListener onLoginListener = new OnLoginListener() {
#Override
public void onLogin() {
// change the state of the button or do whatever you want
Log.i("fb login", "Logged in");
OnPublishListener onPublishListener = new OnPublishListener() {
#Override
public void onComplete(String postId) {
Log.i("fb post", "Published successfully. The new post id = " + postId);
}
#Override
public void onFail(String reason) {
Log.i("fb post","failed: " + reason);
}
/*
* You can override other methods here:
* onThinking(), onFail(String reason), onException(Throwable throwable)
*/
};
Feed feed = new Feed.Builder()
.setMessage("Check this out.")
.setName("Home Shop Guide App for Android")
.setCaption("Win prizes and deals daily")
.setDescription("User just won $500 from a daily scratchoff prize. You could be the next winner!")
.setPicture("https://homeshopguide.com/images/logo.png")
.setLink("https://homeshopguide.com/")
.build();
mSimpleFacebook.publish(feed, true, onPublishListener);
}
#Override
public void onNotAcceptingPermissions(Permission.Type type) {
// user didn't accept READ or WRITE permission
Log.w("fb login", String.format("You didn't accept %s permissions", type.name()));
}
#Override
public void onThinking() {
// TODO Auto-generated method stub
Log.i("fb login", "thinking");
}
#Override
public void onException(Throwable throwable) {
// TODO Auto-generated method stub
Log.i("fb login", "exception" + throwable.getLocalizedMessage());
}
#Override
public void onFail(String reason) {
// TODO Auto-generated method stub
Log.i("fb login", "failed: " + reason);
}
};
mSimpleFacebook.login(onLoginListener);
}
});
}
#Override
public void onResume() {
super.onResume();
mSimpleFacebook = SimpleFacebook.getInstance(this);
}
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
mSimpleFacebook.onActivityResult(this, requestCode, resultCode, data);
super.onActivityResult(requestCode, resultCode, data);
}
And this is what shows up in the error log when i press the button:
03-19 17:01:53.537: I/fb login(31226): Logged in
03-19 17:01:53.647: D/OpenGLRenderer(31226): Flushing caches (mode 1)
03-19 17:01:53.957: D/OpenGLRenderer(31226): Flushing caches (mode 0)
03-19 17:02:05.527: I/fb post(31226): failed: Canceled by user
EDIT:
I tried again the next day (before making any changes) and the log showed that the post was successful. However, the facebook account I am using to develop with is a business account and I do not know where the feed got posted to.
As sromku suggested I put the app in live mode to test with a normal facebook account. I am still receiving the "Canceled by user" error. however, when I checked my wall the post was there as expected. My question now is am I doing something wrong to receive this error or is it just an error showing up when it is not supposed to.
This behaviour has been fixed in simple facebook 2.2 release.
I've been experiencing the same issue and it got fixed after updating the lib.
Check this issue for the details.

Related Links

ListView with ArrayAdapter, exception when i click on a row
Android layout, specify dp to scale with screen size
custom holo style progress bar
ListView clickable false not working
Passing data between activities from a listView
Problems with android bluetooth permissions
Unable to uninstall applications from android emulator
how to use a custom view in a xml file in android
How to get Image Path just captured from camera
Get Android rotation angle in x-axis
Check transparency existence & load only RGB values
What is right way to use TextToSpeech.Engine.ACTION_CHECK_TTS_DATA in 2.1 for non default language?
Android Facebook SDK Bug
why is Eclipse file > new > android application project producing a gutted folder with different folder icons?
Android: App working fine on one device and not working on another
Aligning Two Controls, one of which uses all available space - Android

Categories

HOME
adal
turing-machines
jpa
c++11
ng-idle
webdriver
pyqt4
babeljs
mvc5
trac
barcode
accessibility
g++
google-schemas
mel
appcelerator-studio
mautic
package-managers
azure-powershell
mvc-mini-profiler
google-content-api
asp.net-mvc-viewmodel
soci
simpleitk
babel
short-url
pic32
licensing
corpus
mobx
memory-address
jett
gojs
twos-complement
numpy-broadcasting
sessionstorage
protein-database
mcustomscrollbar
plaintext
apriori
flask-restful
httrack
configurationmanager
bluez
convex-optimization
podscms
tinkerpop
cd-burning
restore
latin
google-cloud-console
mta
beamer
mapinfo
dup
respondcms
jnlua
relativelayout
dynatree
themoviedb-api
include-guards
sony-lifelog-api
branch-and-bound
linked-tables
java-security
gamekit
rapidsvn
angular-gettext
boost-program-options
sql-scripts
punycode
universal-image-loader
named-parameters
ignite-ui
cancellation
tinyxml
draw2d-js
fpdi
twitter-bootstrap-rails
scriptaculous
notorm
virtual-pc
onmousemove
extconf.rb
objectquery
azman
jquery-address
tournament
vs-android
ajax-polling
openfaces
blender-2.49
sifr
wordprocessingml
complex-event-processing
escrow
fault-tolerance
soappy
great-circle

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App