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

Unable to filter listview in fragment
Do I have to worry about non-power-of-two textures on API 16+?
Adding custom layout to PreferenceFragment
Close image effect on drag up or down fragment
How to pass HashMap<String,List<String>> from intent
Cannot run android aplication - appcompat_v7 not found -
Android game development
Error copying object to Realm
How to keep Staging analytics/data out of Production for App Store deployment
OSX Gradle too old
How to change Android EditText keyboard color?
How to use single activity(class) and single layout(xml) to show different data based on item selection in recycler view
open selected PDF file in pdf reader on click of that selected filename
flip effect Fragment transaction with getSupportFragmentManger
How does android retrieve data from a website?
Error 0xfffffc03 when decoding multiple videos

Categories

HOME
uml
gridview
checkstyle
c++11
wakanda
nunit
formal-languages
can
edge
gembox-spreadsheet
x264
jtextpane
project
augeas
32bit-64bit
drop-down-menu
github-enterprise
google-form
pyramid
cfml
selinux
ksh
siri
shared
genexus-sd
magento-1.8
python-2.6
complex-numbers
powershell-ise
instantiation
sql-delete
xajax
apiary.io
lint
node-mssql
health-monitoring
typesafe-config
laravel-elixir
print-css
bindingnavigator
dtsearch
configurationmanager
manova
mongotemplate
singleinstance
arules
mach-o
template-toolkit
universal-analytics
android-instrumentation
stripe-connect
pytables
iotivity
mapinfo
vorpal.js
data-protection
ikiwiki
upx
findfirst
toast
inf
avisynth
fiware-monitoring
wiredep
extjs-grid
page.js
canalyzer
dnssec
telepat
umlgraph
packet-sniffers
jbake
punycode
imagefilter
nsmenu
named-parameters
printdialog
flex++
process-explorer
cardreader
swfobject
twisted.web
extreme-programming
xcode3.2
failing-tests
stress
box2d-iphone
entitydatasource
tmx
resharper-6.0
dot-emacs
binomial-heap
echo3
lobo-cobra
alsb
xslcompiledtransform

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