Hi im using Facebook Android Share Dialog but After successfully sharing a page on a facebook I get a post id like this: UzpfSTEwMDAwNzU5NjMxNDE5MDoxNjQ0MzI4NjU1ODMwMzI5
I check it via graph api but it still error?
{
"error": {
"message": "(#100) This api call does not support permalink tokens",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "B5OJZBt5DRL"
}
}
The post id UzpfSTEwMDAwNzU5NjMxNDE5MDoxNjQ0MzI4NjU1ODMwMzI5 is encoded to Base64 you should decode it.
Tried to decode it using https://www.base64decode.org/ and I got this S:_I100007596314190:1644328655830329. You could do a string manipulation and parse the postId to 100007596314190_1644328655830329. And you could use it on the Graph API to get the post.
This link should help you http://developer.android.com/reference/android/util/Base64.html in decoding Base64 in Android.
Related
I am trying to fetch the Video Views count from Instagram API, but I can't find any API that provides the video counts, I have found this answer on Stackoverflow [How to retrieve video view count from Instagram API][1]
[1]: How to retrieve video view count from Instagram API but it doesn't work and gives me this error and response code
{
"error": {
"message": "(#200) Provide valid app ID",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "AZJFNJL_G3KzPu7VWUDlzsT"
}
}
I can't even find this Instagram API on the documentation at all, How I can get the video views count from the video URl using Instgram Grapgh API? and does instgram provide this?
i am trying to create an app which removes the image background, the send the image through api key and server sends the response, here i get response but i coulnt understand the response image format. PLEASE senior developer and programmers help me.
sample response code : : ‰PNG
������IHDR����˜����������,ƒ7ª����
{{{;Ž}ƒ#âtp¶8_<Nˆ+ÄUàZp'pWp¸¼ÞïŒÅóðËñeøF|?ŽŸ!(Œ ®„HBa-¡’ÐF8K¸KxA$õˆNÄp¢€¸†XI<D<O%¾%QHf$6)$!m!í'"Ý"½ “ÉFdr<YLÞBn&Ÿ!ß'¿Q X(ðV+Ô(t\Qx¦ˆW4TôT\¬˜¯X¡xDqHñ©^ÉH‰-ÄQZ¥T£tTé†Ò´2UÙF9T9Cy³r‹òåG,ňâCáQŠ(û(g(cT„ªOeS¹ÔuÔFêYê8C3¦ÐRi¥´ohƒ´)ŠŠJ´JžJÊq)¡Ñèéô2úaúuú;U-UOU¾ê&Õ6Õ+ª¯Õæ¨y¨ñÕJÔÚÕFÔÞ©3Ô}ÔÓÔ·©w©ßÓ#i˜i„käjìÑ8«ñtmŽË9‡çÜÖ„5Í4#4WhîÓÐœÖÒÖòÓÊÒªÒ:£õT›®í¡ª½Cû„ö¤UÇMG ³Cç¤Îc†
5eCÙ‹²»Å4ÙÏÔ€ÄD²^2šã–S“ó&7:÷Hžrž0o¹ÙòMË'ò}ó¿^ZÁ]Ñ[ [°¶t¥çÊúUЪ¥«zWë¯.Z=¾Æo͵„µik(´.,/|¹.f]O‘VÑš¢±õ~ë[‹ŠEÅ76¸l¨ÛˆÚ(Ø8¸iMKx%K-K+Jßoæn¾ø•ÍW•_}Ú’´e°Ì¡lÏVÌVáÖëÛÜ·(W.Ï/Û²½scGÉŽ—;—ì¼PaWQ·‹°K²KZ\Ù]ePµµê}uJõHWM{-fí¦Ú×»y»¯ìñØÓV§UWZ÷n¯ïÍz¿úΣ†Š}˜}9û6F7öÍúº¹I£©´éÃ~á~éˆ}ÍŽÍÍ-š-e¬p«¤uòÂÁËßxÓÝÆl«o§·—‡$‡›øíõÃA‡{°Ž´}gø]mµ£¤ê\Þ9Õ•Ò%íŽë>x´·Ç¥§ã{Ëï÷Ó=Vs\åx٠‰¢ŸN柜>•uêééäÓc½Kz=s-/¼oðlÐÙóç|Ïé÷ì?yÞõü±ÎŽ^d]ìºäp©sÀ~ ãû:;‡‡º/;]îž7|âŠû•ÓW½¯ž»píÒÈü‘áëQ×oÞH¸!½É»ùèVú¬ç·snÏÜYs}·äžÒ½Šûš÷~4ý±]ê =>ê=:ð`Áƒ;cܱ'?eÿô~¼è!ùaÅ„ÎDó#ÛGÇ&}'/?^øxüIÖ“™§Å?+ÿ\ûÌäÙw¿xü20;5þ\ôüÓ¯›_¨¿ØÿÒîeïtØôýW¯f^—¼Qsà-ëmÿ»˜w3¹ï±ï+?˜~èùôñOŸ~÷„óû¤Ì\9������ pHYs����������šœ������IDATx^ìýœ¤éUÞŸÊ
Well, this is PNG as it starts with ‰PNG..
while loading image url from api response in android from rapid api while calling image url to show image in imageview it didnot load
"title": "Janmashtami Special Songs",
"actors": "",
"music": "Simrat Praksh",
"image_url": "https:\/\/1601606126.rsc.cdn77.org\/raagaimg\/r_img\/catalog\/cd\/H\/hd004247.jpg",
"album_id": "HD004247",
"song": "Yaad Kiya Na Kabhi Shyam Ko",
"year": "2019"
this is response while accessing this image url it shows error
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>19DFAEAD969893CB</RequestId>
<HostId>
107wdT5uUDCcJmMxZUB3zSOo3nZcNU3cN5/sxdeyhQAWK0Lt/DYq6xBQBd3kt3bOjepC9N20gT0=
</HostId>
</Error>
Muhammad Qasim
Can you please send a server request that you sending? Hope you are passing
RapidAPI-Key in request header
From provided logs, it is clear that the url is not public. It needs to be resolved with some APIKey or method, for this you can refer to rapidAPI documentation.
I was playing with facebook android sdk. Till yesterday their sample Hackbook example code was working. But today it is not working any more. I looked into the json response and it seems like facebook changed their json response format.
This is the response for request field of "name, picture":
{"name":"Mohammad Haque","id":"xxxxxxxx","picture":{"data":
{"url":"http:\/\/profile.ak.fbcdn.net\/hprofile-ak-ash3\/xxxx.jpg","is_silhouette":false}}}
It looks like profile url now wrapped inside another parent item. Has anyone faced this problem? I could not find any relevant information on facebook.
Thanks
It is the Facebook updates http://developers.facebook.com/roadmap/
According to Facebook documentation (https://developers.facebook.com/docs/reference/api/user/) - picture returns string; If the "October 2012 Breaking Changes" migration setting is enabled for your app, this field will be an object with the url and is_silhouette fields; is_silhouette is true if the user has not uploaded a profile picture
I retrieved picture url by this query:
https://graph.facebook.com/me/picture?type=large
JSONObject jb=Util.parseJson(query);
JSONArray ja=jb.optJSONArray("picture")
JSONArray v=ja.optJSONArray("data")
JSONObject j=v.optJSONObject(0);
j.get("name").toString();
j.get("url").toString();
Just parse the JSON appropiately with the changes and it should work.
I had successfully integrate twitter API and I am able to post text from my device but I want to know two things
Is is possible to post Image on twitter using API in Android ?
In twitter we used OAuth.OAUTH_TOKEN and OAuth.OAUTH_TOKEN_SECRET tokens.I passing token values on second argument in below code is it ok ? or I have to leave it blank ?
String token = prefs.getString(OAuth.OAUTH_TOKEN, OAuth_token_key);
String secret = prefs.getString(OAuth.OAUTH_TOKEN_SECRET, OAuth_token_secret);
I searched to know whether is it possible to post image on twitter using twitter API in Android but I have not found any link that I know whether it is possible or not.
I got one similar post image issue for iPhone and there is a answer also. I don't know about iPhone so I can't know weather it is right answer or not.Here is a link of similar question of post image for iPhone
Please help me out from this issue.
Yes You can post the Image on the Twitter.
AIK, there are two methods to upload the photo to the Twitter.
With First you have to implemente the Twitter API and use this Link to upload the Photot to the Twitter.
Sorry for the Example. as i dont get any example for how to use this.
With Second you can do this with the help of the twitPic4j API.
Just add the API for twitPic4j and write below code to upload the photo.
Code:
File picture = new File(APP_FILE_PATH + "/"+filename+".jpg");
// Create TwitPic object and allocate TwitPicResponse object
TwitPic tpRequest = new TwitPic(TWITTER_NAME, TWITTER_PASSWORD);
TwitPicResponse tpResponse = null;
// Make request and handle exceptions
try {
tpResponse = tpRequest.uploadAndPost(picture, customMessageEditText.getText()+" http://www.twsbi.com/");
}
catch (IOException e) {
e.printStackTrace();
Toast.makeText(getApplicationContext(), "Please enter valid username and password.", Toast.LENGTH_SHORT).show();
}
catch (TwitPicException e) {
e.printStackTrace();
Toast.makeText(getApplicationContext(), "Invalid username and password.", Toast.LENGTH_SHORT).show();
Toast.makeText(getApplicationContext(), "Please enter valid Username and Password.", Toast.LENGTH_SHORT).show();
}
// If we got a response back, print out response variables
if(tpResponse != null) {
tpResponse.dumpVars();
System.out.println(tpResponse.getStatus());
if(tpResponse.getStatus().equals("ok")){
Toast.makeText(getApplicationContext(), "Photo posted on Twitter.",Toast.LENGTH_SHORT).show();
//picture.delete();
}
}
Above code works in for my case.
Hope you got the sollution with the second one and i dont know how to use the first one.
Enjoy. :)
Updated
If still it not works for you and try some project listed below:
Example 1
Example 2
Example 3
Example 4
Hope that will help you.
Happy Coding.
==================================
FOR erdomester and Updated answer
==================================
Please check my first link given with Example1 and its api: Twitter4J
So, if any library that stop giving functionality to upload image on twitter, you can use other library for same. Please check and read regrading Twitter4j.
Check Twitter4J API to upload file to Twitter: Twitter4j Image Upload
For instance help you can also check below code to upload image file on Twitter.
Code to upload Image:
/**
* To upload a picture with some piece of text.
*
*
* #param file The file which we want to share with our tweet
* #param message Message to display with picture
* #param twitter Instance of authorized Twitter class
* #throws Exception exception if any
*/
public void uploadPic(File file, String message,Twitter twitter) throws Exception {
try{
StatusUpdate status = new StatusUpdate(message);
status.setMedia(file);
twitter.updateStatus(status);}
catch(TwitterException e){
Log.d("TAG", "Pic Upload error" + e.getErrorMessage());
throw e;
}
}
I hope this will help you more for your query.
Thanks to eredomester to notify me that tweetpic is no more working for Twitter. But please dont do downvote to answer untill you have not fully search on the given reply. Given library Twitter4J in Example1 gives clear idea about uploading image to twitter and you can easily implement it.
For more help and code you can also check: Twitter Upload media
Note: To use this please make sure you have latest jar file. I have used twitter4j-core-2.2.5.jar or more for this.
Please comment me instead of downvoting this answer, if you facing any issue in this.
Is is possible to post Image on twitter using API in Android ?
Yes you can upload Images to Twitter after successful Authentication Using Twitter Media Uplload.
In twitter we used OAuth.OAUTH_TOKEN and OAuth.OAUTH_TOKEN_SECRET
tokens.I passing token values on second argument in below code is it
ok ? or I have to leave it blank ?
You should add both Token and Token Secret Key it will be useful for setTokenWithSecret methos of Tiwtter in which you have to send both Token and Token Secret..
Yes you can post image on twitter using Twitter api like twitter4j but I will suggest you to do using HttpPost class and DefaultHttpClient class because its good in practice and you dont need to add any external twitter api to it.