Facebook SDK request api - android

I have been reading the Facebook documentation. The Facebook documentation for asking/sending gifts mentioned a YOUR_OBJECT_IDfor this call:
FB.ui({method: 'apprequests',
message: 'Take this bomb and blast your way to victory!',
to: 'RECIPIENT_USER_ID'
action_type:'send',`enter code here`
object_id: 'YOUR_OBJECT_ID', // Where do I get this ?
data: 'Friend Smash Custom Tracking 1'
}, function(response) {
console.log(response);
});
How do I get get it? I have already created my object inside Open Graph, but there is no object id specified. Do I need to initiate a create request for the user from my app for that object or how is this suppose to work?

The request_object_id is what you will get back from the dialog, after the user sent the gift – it is part of the dialog’s return value. It is simply the identifier for the request that was send.
https://developers.facebook.com/docs/games/requests/v2.1#response
You can use it to read details of the request back from the API.
OK, so since this is about the object id that one can pass to the dialog:
That documentation section already links to https://developers.facebook.com/docs/sharing/opengraph/custom, where this is explained in more detail.
Basically, you need to set up your own Open Graph action and Open Graph object. This will define what your object is, and what players of the game can do with it.
Open Graph objects can be created in two ways:
You can host them yourself. To do this, you simply provide URLs to HTML pages which include the Open Graph meta data that specifies the object property values. Facebook will then read the meta data from those URLs (“scraping”). In that case, you would simply pass the object URL to the dialog as object_id.
You can use the Object API to create objects that Facebook will host for you. These can either be “app-owned” or “user-owned” – depends on if the are specific to a certain user, or “common” objects to be used by all users of your app. Creating an object via that API will give you back an object id, that you can then pass to the dialog.
If you are not familiar with the whole Open Graph Story concept yet, then I recommend you start by having a look at the whole Open Graph section, https://developers.facebook.com/docs/sharing/opengraph

Related

How to go to next page on Github API

With this. I want to use rel="next" instead of incrementing the parameter page manually
This's my Service.java Interface (using retrofit2):
#GET("user/repos")
Call<Repos> getRepos(#Query("api_key") String apiKey,
#Query("page") int pageIndex);
How can I do it? Android - using Java
By principle, HTTP RESTful APIs are stateless.
This means the Github API doesn't know what your current page is, and what your next page is.
Therefore, you must pass the page and per_page parameter.
rel="next" in the Link header indicates that the resource request is for the next page, but it can't and shouldn't be used to get the next page results without passing the page parameter.
In the simplest case, a link relation type identifies the semantics
of a link. For example, a link with the relation type "copyright"
indicates that the resource identified by the target IRI is a
statement of the copyright terms applying to the current context IRI.
Link relation types can also be used to indicate that the target
resource has particular attributes, or exhibits particular
behaviours; for example, a "service" link implies that the identified
resource is part of a defined protocol (in this case, a service
description).
From RFC-5988 Web Linking

Where do I view event parameters with Facebook Analytics App Events?

I'm using Facebook analytics in my Android app to log app events - I'm seeing the correct tracking of app events and am able to view them in my Facebook App Analytics dashboard.
However, I have no idea where parameters that I attach to each event are displayed. Some of them are automatically summed and shown - for instance, purchases or other values. For other, string-based parameters, however, I'm unable to figure out where I can view them.
As an example:
Say every time something goes wrong in my app, I log an event named "Error". I then pass the parameter named AppEventsConstants.EVENT_PARAM_DESCRIPTION a string description - so this might be "App Crashed" or "No Internet Connection" or something. Let's say one of each happens.
When I go to view my analytics, I will correctly see that there have been two "Error" events. But now I want to know whether these were instances of "App Crashed" or "No Internet Connection" - presumably that's what the point of the parameters is. How do I do this? I've googled and clicked everything I can think of, but haven't found a way to see the parameter breakdown of an event.
I can confirm that it is troublesome to find and the name has been changed to "Breakdowns"...
Activity -> Breakdowns
click "Create New" in upper right
give the report a NAME
select the top level event from the EVENT pop-up
select one or more parameters to report on from the 3 BREAKDOWN
pop-ups (note that your custom parameters appear at the bottom of
these menus)
Yep, its not simple to find that information. You will need to use Segments in Facebook Analytics for that. Go to Segments and try creating a new segment. Define Condition Type as "Events". Then select the Event then you want to include. After that, select the option of "Refine". This will show you "Select a Parameter". Here you can select the parameter that you want to see and its value. Save this segment, and use it in any chart you want.
Unfortunately, that is the best way I have found, though it is not as straightforward as it should be.
I tried using the ways based on the answers provided here. But the fact is, it is tedious or going round the bush.
The answer is simple, just send the values and parameters wrapped inside "contents".
It will be visible on your analytics dashboard the same as standard events do.
var name = "Dhinesh";
var platformName = "flutter";
//custom event - fb analytics
fbq('trackCustom', 'FreeTrialPlatform',
// begin parameter object data
{
contents: [{
name: name,
platform: platformName
}],
content_type: 'product'
}
// end parameter object data
);
View in fb analytics
For your case like this,
var errorName = "App crashed";
fbq('trackCustom', 'TrackError', {
contents: [{
Error: errorName
}],
});

get additional info from the link which launched my app

my app launches on clicking a link.
But there is additional information that the link contains which my app wants.
The link is something like this :
http://update_app_config.com?parameter1='value1'&parameter2='value2'&parameter3='value3'
can I get an object of key,value pair which contains the parameter and values or do I have to parse it myself?
Thanks
getIntent().getUri() will return a Uri object representing the link used to launch your app. You can then call methods like getQueryParameterNames() and getQueryParameters() to access the query parameters (stuff to the right of the ?).

How to publish checkin at a custom place (like foursquare)

I referred https://developers.facebook.com/docs/opengraph/location_tagging/
While trying to publish checkin, I passed place as place=(some url like "http://www.example.com/jeffys_burgers.html") along with lat,long coordinates and facebook user_id from android app,it
responds {"error":{"message":"(#100) Requires a valid Place Page ID","type":"OAuthException","code":100}}.
My query is how to specify actions,object type in my facebook app so that I can pass appropriate arguments from android app, for publishing checkin at a custom place ?
In the documentation you link to (in the section "Specifying Object Type") they create an object type called "Venue" of the type "Place". You have to do something similar. You don't have to call it "Venue" though.
Remeber that the object type Place is a "Facebook Place". Your jeffys_burgers.html should have og:type=yournamespace:venue (if you decide to call your object type "Venue"), and have the place:location:latitude and place:location:longitude set.

How to create a object to post score?

I'm developing a game on Android and want to integrate with facebook, so user can share his results.
I'm using the Open Graph to create the actions, the objects and so on from my app.
Already done some progress using direct Graph API requests like this.
Bundle params = new Bundle();
params.putString("my_object", "http://samples.ogp.me/251143638264597" );
mAsyncRunner.request("me/MY_APP_NAMESPACE:beat", params, "POST",
new WallPostRequestListener(), null);
This way the post is made. But ,as you can see on the code above, i'm using the sample object created by Open Graph.
My problem is: how can i create an object dynamically, in java? It's possible? I've already tried to create a JSON object, but didn't have success.
I saw on the tutorials an HTML metadata, but this is the only way to do it?

Categories

Resources