Checkin feature in facebook android sdk - android

I would like to create an application on android which implement checkin feature. I read api reference for facebook api several times already and basically I am clueless. I understand that simply I do need to issue a POST request to facebook graph api server like this one:
curl -F 'access_token=...' \
-F 'message=The coffee is just meh.' \
-F 'place=PAGE_ID' \
-F 'coordinates={"latitude":"...", "longitude": "..."}' \
-F 'tags=USER_ID1, USER_ID2' \
https://graph.facebook.com/me/checkins
However I have no idea how to get those place[page_id] or coordinates[long and lat].
Question is if I have a name of place I want to check in, how could i search for its place[page_id] and how to get those coordinates?

For checkins you check this links for your references
Checkins for Facebook
If you want to get the Checkins of Particular user just use this API
https://graph.facebook.com/[user id]/checkins
in these just pass the USERID of the User.
If you want to get the Latest checkins of particular user use this API
https://graph.facebook.com/search?type=checkin&access_token=ACCESS_TOKEN
in these get your access token and pass it..
3 . If you are having Latitude and Longitude you can get the Nearest Locations by using this API
https://graph.facebook.com/search?type=place&center="+latitude+","+longitude+"& distance=5000&

Related

Adding the Location programatically to a Tweet

I am Working with the twitter API's for Android and there is computation that happens in the cloud and based on that, the tweets are to be published. How do I add the location programatically when I tweet without the user having to input it again?
Cheers
VS
First of all, you need to allow your twitter account to share location :
Connect on twitter.com with your account, go to your profile settings > Settings and privacy > Privacy and safety, check : Tweet with location, and save.
Then you can post with twurl and geolocation :
twurl -X POST -H api.twitter.com '/1.1/statuses/update.json?status=Testing twurl&lat=48.858334&lon=2.294415' | jq .

Not clear how to use the Github Notifications API

https://developer.github.com/v3/activity/notifications/
I am trying to use the Github Notifications API to display notifications like
"someone followed my repo", "someone followed me", "someone commented on my repo", etc.
on my Android application.
Before using it, I tried to understand how it works.
When I tried doing
GET https://api.github.com/notifications?access_token="mytoken"
on Postman to see what if gives, it just gave me
[]
When I asked my friend to follow me on Github, I expected something to appear in the response, but it still gave me
[]
after my friend tried to follow me.
In what case do I get a response, and how am I supposed to use it to fulfill my purpose?
Axibase developed a set of handy tools that use the GitHub API to create and send Webhooks based on the events you're describing.
The workflow for the Repo Watch notification is shown here, it's the same for each tool just a different flavor based on the alert event:
The whole set-up process takes less 10 minutes, follows this guide and runs in a Docker container which is pre-configured in the launch command. The procedure is goes like this:
From the Linux command line, launch ATSD with the following command:
docker run -d -p 8443:8443 -p 9443:9443 \
--name=atsd-sandbox \
--env SERVER_URL=https://atsd.company_name.com:8443 \
--env WEBHOOK=github \
--env SLACK_CONFIG="slack.properties \
--volume /home/user/slack.properties:/slack.properties \
--env ATSD_IMPORT_PATH='https://raw.githubusercontent.com/axibase/atsd-use-cases/master/how-to/github/resources/github-watch.xml' \
axibase/atsd-sandbox:latest
(Remove the terrible spacing that SO requires for code posts)
Replace the SERVER_NAME parameter with the public DNS name of the Docker host where the sandbox container will be running
What you're getting here is a local ATSD instance with a generated Webhook. The command is bootstrapped for Slack, so you need to create an .xml directory on your local machine or URL with the following parameters and then replace the slack.properties template variable with the appropriate path:
token=xoxb-************-************************
channels=general
Watch the Docker Logs, and copy the Webhook. It will look something like this:
Webhook URL: https://github:PdWnC1jF#atsd.company.com:8443/api/v1/messages/webhook/github?exclude=organization.*;repository.*;*.signature;*.payload;*.sha;*.ref;*_at;*.id&include=repository.name;repository.full_name&header.tag.event=X-GitHub-Event&excludeValues=http*&debug=true
Open the GitHub Settings menu for the repo for which you'd like to create notifications:
Configure the Webhook by pasting the one generated at runtime into the appropriate field and configure the remaining settings:
Confirm connectivity (GitHub will do this automatically), and you're ready to go.
Use one of these other guides according to the event which you'd like to trigger a notification. The really nice thing about them is that they can alert via third-party messenger so the notifications are send directly to your smartphone instead of just through email.
Disclaimer: I've worked for the development team that writes ATSD, which is the database responsible for the underlying data processing and management tasks.
Good luck!

Facebook Mobile hosting api for App links is not working in Android

I'm trying to make App Links work with my Android app. I have successfully created App-links from wen HTML page(with meta-tags) and its work fine with redirection to my application from Facebook. But when i try with the facebook mobile hosting api which allow us to create app links without help of any server or web page, I Found some serious confusion in facebook documentations.
https://developers.facebook.com/docs/applinks/hosting-api
I can not get idea How to call api using this below code :
`
curl https://graph.facebook.com/app/app_link_hosts \
-F access_token="APP_ACCESS_TOKEN" \
-F name="Android App Link Object Example" \
-F android=' [
{
"url" : "sharesample://story/1234",
"package" : "com.facebook.samples.sharesample",
"app_name" : "ShareSample",
},
]' \
-F web=' {
"should_fallback" : false,
}'
`
And can any one give some idea regarding how we can call api from android application to achieve app linking.
I work for a company called Branch.io. We are deep linking company that provides solutions for Android App Links, Facebook App Links, etc... all build into one link. The issue is Facebook is difficult to deal with and their links break in a lot of cases. You can convince yourself here. Deep Linking from Facebook in 2017
We actually support link hosting, so you should be able to use us without hosting your own web domain and we will make the API calls for you. We support Facebook links all within our own links with simple use of OpenGraph parameters within our links.
OpenGraph Parameters in Branch Links
Conceptually, on the inside a Branch link looks like this:
{
tags: [ 'tag1', 'tag2' ],
channel: 'facebook',
feature: 'dashboard',
stage: 'new user',
alias: 'myalias',
data: {
mydata: 'something',
foo: 'bar',
'$desktop_url': 'http://myappwebsite.com',
'$ios_url': 'http://myappwebsite.com/ios',
'$android_url': 'http://myappwebsite.com/android',
'$og_app_id': '12345',
'$og_title': 'My App',
'$og_description': 'My app\'s description.',
'$og_image_url': 'http://myappwebsite.com/image.png'
}
}
With this you can attach any metadata you would like and can therefore support your dynamic content with deep linking while covering Facebook links, as well as, nearly every other platform and device. We also cover deferred deep linking which is not supported with Facebook App links.
For the basic deep linking that you are looking for, the service is free.

Facebook app links on android

I have never come across a worst api documentation than Facebook .
I have been trying to deep link my android application with the facebook , such that when a person presses a story of my app on his facebook , it doesn't launch the browser , rather opens up my app .
I have followed this https://developers.facebook.com/docs/applinks/hosting-api and came across this piece of raw code through which I can generate a deep link .
curl https://graph.facebook.com/app/app_link_hosts \
-F access_token="APP_ACCESS_TOKEN" \
-F name="Android App Link Object Example" \
-F android=' [
{
"url" : "sharesample://story/1234",
"package" : "com.facebook.samples.sharesample",
"app_name" : "ShareSample",
},
]' \
-F web=' {
"should_fallback" : false,
}'
NOW WHAT ? . How should I actually run this request against the facebook server? . I ofcourse can't curl it , from android . Also how should I generate this app access token ?. I actually have so many questions right now .
I would really appreciate if anyone could point me to the correct direction.
You should run this from your own machine or server, and not in an Android app. The hosting API is not meant for creating thousands of URLs at runtime, it's meant for creating a handful of URLs that you will share and that your app understands. If you need to create or attach custom parameters, just add them to the end of the URL that's created for you, instead of creating new ones.
This is the first result for "facebook app access token" on google: https://developers.facebook.com/docs/facebook-login/access-tokens, there's a section on app tokens. The easiest way to create an app token is to just use app_id|app_secret, so if your app id is 123 and your app secret is def, your app access token is 123|def

Facebook: sharing a Play Store link using the Share Dialog

I share a link using the share dialog from the Facebook Android SDK. My code looks like this:
FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(this)
.setName("My app name")
.setCaption("A caption")
.setDescription("My description...")
.setLink("https://play.google.com/store/apps/details?id=com.company.myapp")
.setPicture("http://link_to_picture")
.build();
As I want users to be redirected to my app's Play Store page, I put this url in the link. But in that case, the post doesn't show the information I specified (name, caption, description). Instead, it shows the app name specified in the Play Store, with a "download it" caption (the picture is ok).
When I set another link, this issue doesn't occur: the post displays the name, caption and description as expected. Why can't I put my own text with a Play Store link?
EDIT
I tried using App Links. So I created an App Link object with this:
curl https://graph.facebook.com/app/app_link_hosts \
-F access_token="APP_ACCESS_TOKEN" \
-F name="My app link" \
-F android=' [
{
"url" : "myapp://share/1234",
"package" : "com.company.myapp",
"app_name" : "My app",
},
]' \
-F web=' {
"should_fallback" : false,
}'
And I got this url: https://fb.me/494085890722766
Now, the post looks good, but clicking on it from Facebook app when my app is not installed pops up a chooser that proposes to open the link in a browser or install the application, which is not a good user experience.
Finally, I found a workaround using App Links, which is detailed here : https://developers.facebook.com/docs/applinks/hosting-api
I created my App Link object without any "-F web" parameter, like this:
curl https://graph.facebook.com/app/app_link_hosts \
-F access_token="APP_ACCESS_TOKEN" \
-F name="My app link" \
-F android=' [
{
"url" : "myapp://share/1234",
"package" : "com.company.myapp",
"app_name" : "My app",
},
]'
However, I don't understand why Facebook API works in a so weird way. It's a complicated solution to a simple issue.
Replace your link with
.setLink("market://details?id=com.company.myapp")
See this link
In my case, I disable DeepLink in Facebook Developer Console and it work well.

Categories

Resources