Error:
Response={ "error": { "message": "(#100) Requires extended permission: publish_checkins or publish_actions", "type": "OAuthException", "code": 100 }}
Source Code:
Bundle params1 = new Bundle();
params1.putString("access_token",token);
params1.putString("place", "566414493392930"); // YOUR PLACE ID
params1.putString("message","I m here in this place");
JSONObject coordinates = new JSONObject();
try {
coordinates.put("latitude", "30.902823300000000000");
coordinates.put("longitude", "75.830516900000020000");
} catch (JSONException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
params1.putString("coordinates",coordinates.toString());
params1.putString("tags",params[0]);//where xx indicates the User Id
String response="";
try {
response =faceBook.request("me/checkins", params1, "POST");
Log.v("Response","Response="+response);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Well, the error says that the permissions: publish_checkins or publish_actions is required. To remove this error, simply add these permissions while authenticating the user. See how it is done: Android login- permissions
But, the thing is- the API checkins have been deprecated. Check here it says-
Checkins have been deprecated in favor of attaching place information to posts, or tagging places in Open Graph stories. Please check the related guides for information.
So your code shall not work anyway. You'll now have to use Open Graph Actions for the same. There's step wise tutorial for the same in the documentation, just go through it and implement. Good luck.
Related
i am using openfire xmpp server and asmack library to implement pubub node , the biggest issue that i face is the reconnection problem to the xmpp server.
whenever a connection is made to the xmpp server there are lots of stanza is being exchanged possibly around 5 to 7 stanza in a desktop applicaiton or web application it seems ok , but for mobile application where 3G link is pretty weak , in that case it too good to exchange so much of stanza.
i have tested that when the wifi has a weak signal or 3g link is down , i am making a reconnecting to the server (in background process) but i mostly get a response time out error and taking too much time if the connection gets successful.
i have seen messenger like whatsapp in which they are making a reconnection pretty fast. i want to do something like that only.
i have read about the pre-http binding but its exist in ejabber but didnt find anything in openfire moreover htt-prebinding is for anonymous users and i am using registered users only.
so can anyone tell me how can i reconnect fast to the xmpp server.
code snippet
Boolean onlyConnect = arg[0];
try {
if(xmpp!= null && !xmpp.isConnected())
xmpp.connect();
} catch(BOSHTimeoutException e){
Log.e("XConnection " , "Timeout occures");
// make a reconnection here
return false;
}
catch(ConnectionException e){
CatchErrors("ConnectionException" , "xmpp.connect()");
e.printStackTrace();
}catch(NoResponseException e){
CatchErrors("NoResponseException" , "xmpp.connect()");
// make a reconnection here
return false;
}catch (XMPPException e1) {
// TODO Auto-generated catch block
CatchErrors("XMPPException" , "xmpp.connect()");
e1.printStackTrace();
return false;
} catch (SmackException e) {
CatchErrors("SmackException" , "xmpp.connect()");
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
CatchErrors("IOException" , "xmpp.connect()");
e.printStackTrace();
}
try {
Log.e("LOGIN REQUIRED " , "LOGIN IN");
xmpp.login(XMPP_USER_NAME, XMPP_PASSWORD, "sh");
} catch (XMPPException e) {
// TODO Auto-generated catch block
CatchErrors("XMPPException" , "xmpp.login()");
e.printStackTrace();
return false;
} catch(NoResponseException e){
Log.e("LOGIN REQUIRED " , "NoResponseException");
CatchErrors("NoResponseException" , "xmpp.login()");
//make a reconnection here
return false;
}catch (SaslException e) {
// TODO Auto-generated catch block
CatchErrors("SaslException" , "xmpp.login()");
e.printStackTrace();
} catch (SmackException e) {
// TODO Auto-generated catch block
CatchErrors("SmackException" , "xmpp.login()");
e.printStackTrace();
} catch (IOException e) {
CatchErrors("IOException" , "xmpp.login()");
// TODO Auto-generated catch block
e.printStackTrace();
}
return true;
}
Hello friends I want to post comment to particular post in facebook with my android app, below is my code-
I Fetch All comments from URL which is below
http://retirementhomeslisting.com/home-detail/canterbury-place-83
Bundle mBundle=new Bundle();
mBundle.putString("message","testing...1234555");
#SuppressWarnings("deprecation")
Facebook fb=new Facebook(getResources().getString(R.string.fb_app_id));
try {
fb.request("478409145610921/comments",mBundle,"POST");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Here I provide one link which you can see all comment list with respective above object_id
Link for comment list for 478409145610921 object_id
When i run above code comment is not post with respective object_id so Any idea how can i solve it?
EDIT Answer
Bundle mBundle=new Bundle();
mBundle.putString("message","testing...1234555");
#SuppressWarnings("deprecation")
Facebook fb=new Facebook(getResources().getString(R.string.fb_app_id));
try {
fb.request("1309634065_478409145610921/comments",mBundle,"POST");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
To post a comment on a post, you need a post_id instead of object_id.
So your API call must be-
/{post_id}/comments
(post_id is also a field in the comments table)
Edit:
You must be using a comment plugin and trying to post a comment to that. Unfortunately, facebook don't allows you to do that! (Logical- since most of them are public, to avoid spamming, else anyone could flood comments to that post)
If you check the response here, you'll get:
{
"error": {
"message": "(#100) Comments may not be added to a comment plugin",
"type": "OAuthException",
"code": 100
}
}
You can test these API call on Graph API Explorer also.
Using Graph API:
...
if ([[FBSDKAccessToken currentAccessToken] hasGranted:#"publish_actions"]) {
[[[FBSDKGraphRequest alloc]
initWithGraphPath:#"post_id/likes"
parameters: #{ #"like" : #"true"}
HTTPMethod:#"POST"]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if (!error) {
NSLog(#"It was liked.");
}
}];
}
...
This question already has answers here:
Getting Product information like name, price etc using barcode number
(4 answers)
Closed 8 years ago.
Google has shut down the Search API for Shopping so what is the possible way to get product info ( manufacturer name, product number etc.) from barcode in android?
Try this api from www.outpan.com
try {
json = products(upc);
return json.getString(params[0]);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Once visit this this may helpful to you
I could build a sip profile using SipProfile.Builder class. I used following snippet of code to do it:
if (SipManager.isApiSupported(MyActivity.this)&& SipManager.isVoipSupported(MyActivity.this)) {
SipManager manager=SipManager.newInstance(this);
SipProfile.Builder builder;try {
builder = new Builder(userName,domainName);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} manager = SipManager.newInstance(MyActivity.this);
builder.setPassword(password);
profile = builder.build();
try {
manager.open(profile);
} catch (SipException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
manager.register(profile, 30, MyActivity.this);
} catch (SipException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Toast.makeText(MyActivity.this, "created",
Toast.LENGTH_LONG).show();
} else {
Toast.makeText(MyActivity.this, "Not Supported",
Toast.LENGTH_LONG).show();
}
It shows as a sip account in the settings/callsettings/Internet call settings.
Problem is i could not make it as primary account. How can i make it as primary account?
This information is account-based (primary email address for person, primary phone number, primary SIP account etc.) so it's stored in the phone's contacts-book.
It seems to me it's an option that is set per-data, per-account (for example: this type of data (email/phone/sip-addr) set it as primary).
You can set data as primary for a contact using IS_PRIMARY or IS_SUPER_PRIMARY
IS_PRIMARY: Whether this is the primary entry of its kind for the raw
contact it belongs to.
The data you should use it on is ContactsContract.CommonDataKinds.SipAddress. I hope that's useful as starting point.
I am building a Twitter client for android using Oauth1.0 and i am stuck somewhere in the middle
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
OAuthConsumer consumer = new DefaultOAuthConsumer(
"CONSUMER_KEY",
"CONSUMER_CUSTOMER_KEY");
OAuthProvider provider = new DefaultOAuthProvider(
"https://api.twitter.com/oauth/request_token",
"https://api.twitter.com/oauth/access_token",
"https://api.twitter.com/oauth/authorize");
Toast.makeText(getApplicationContext(), "fetching request token", Toast.LENGTH_SHORT).show();
try
{
String authUrl = provider.retrieveRequestToken(consumer, OAuth.OUT_OF_BAND);
// Toast.makeText(getApplicationContext(), authUrl, Toast.LENGTH_SHORT).show();
String url = provider.retrieveRequestToken(consumer, OAuth.OUT_OF_BAND);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)).setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_FROM_BACKGROUND);
this.startActivity(intent);
}
catch (OAuthMessageSignerException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (OAuthNotAuthorizedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (OAuthExpectationFailedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (OAuthCommunicationException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Now i have been able to authorize with this , but as soon as i enter my username and password , A pin code appears and no redirection takes place ! Well what i want is to display tweets of the user without entering the Pin Code ! What should i do ?
Thanks in Advance
First step is to read the documentation on OOB auth on dev.twitter.com
For applications that really can't handle the full OAuth process
Twitter provides the out-of-band/PIN code authentication mode, also
known as oob.
This authentication flow is almost identical to full OAuth except
instead of being directed back to your website the user is presented
with a PIN code.
You need to direct the user to your application to enter the supplied PIN code to complete the auth process. If you want redirection, use the full oAuth1.0a flow with either a server component, or make the callback URL a link to open your android application.