how to get facebook game request url? - android

we are using facebook unity sdk game requests on android.
when someone clicks a game request in their facebook notifications
they switch to the game or the app store page (if it's not installed)
when the game runs, we call FB.GetAppLink(DeepLinkCallback)
however, we receive empty url.
anyone knows how to achieve this ?
Thanks.
Full code:
void AfterInit(){
FB.GetAppLink(DeepLinkCallback);
}
void DeepLinkCallback(IAppLinkResult result) {
Debug.Log("app url = "+result.Url);
}

Update:
Sorry For posting the same code. I have a question for you.
Is your app life in the store and linked to Facebook developer profile correctly? If is in test mode it can fail.
However I believe that the ID you need to send in-app invites is the app ID from Facebook developer profile.
(check the image)
Facebook developer profile
the example code for the in-app invites is this
FB.Mobile.AppInvite(
new Uri("https: // fb. me/810530068992919"), //the ID
new Uri("http://i.imgur.com/zkYlB.jpg"), // optional image
AppInviteCallback //callback function
);
Hope that this can solve your issues.
Thanks.

Related

Facebook Deep Link Tester Works, Ad Doesn't

Pretty straightforward situation: I'm doing deferred deep links for Facebook ads and have successfully tested them via the Deep Link Tester found here (to be clear I do also select "Send Deferred".) However, putting the app into production, even though I am certain that the app has received new launches via ads, the deferred deep link code returns null. Testing it via an Ad Preview is broken as well.
I'm not getting any errors logged from the Facebook SDK and I have confirmed that both the application id and the client token exist when I make the fetchDeferredAppLinkData call.
I've exhausted StackOverflow/Facebook/Google for possible solutions or reasons why there would be a difference between the Deep Link Tester and the actual ad, but have 0 clue. Any direction or thoughts would be really helpful, thanks so much!
For reference, here's the code I'm using to handle the deferred deep link:
AppLinkData.fetchDeferredAppLinkData(cordova.getActivity().getApplicationContext(),
new AppLinkData.CompletionHandler() {
#Override
public void onDeferredAppLinkDataFetched(AppLinkData appLinkData) {
if(appLinkData != null) {
//Handling link
}
}
}
);
EDIT: It looks like we're now getting the fetchDeferredAppLinkData to return values in production, this was after saving the client token in onCreate. However, Ad Previews still don't work in testing; is this by design? Are Ad Previews not intended to be fully-functional and thus shouldn't be used for this purpose?

Destroy Facebook session completely in a custom Android Application using Facebook SDK 4.x.x

I am just new to Android Application and trying my hands on implementing Facebook login within my app. Successfully implementation of login but logout causes some trouble.
The first time I logged in it requested for my details and then signed in.
Next time I do the same it no more asks for my details, by default it logs me in with account.
What if I want to sign in with different user?
I have searched the net for solution and found out that -
- I cannot use Session as they were available only till Facebook SDK 3.X.X not for SDK 4.X.X
- I have tried calling LoginManager.getInstance().logOut();
(But I still have doubts where to use it.)
- I have also tried
new GraphRequest(AccessToken.getCurrentAccessToken(),"/me/permissions/", null, HttpMethod.DELETE,
new GraphRequest.Callback(){
#Override
public void onCompleted(GraphResponse graphResponse) {
LoginManager.getInstance().logOut();
}
}).executeAsync();
and I have also tried doing this :
` AccountManager am = AccountManager.get(context);
Account[] localAccounts = am.getAccounts();
for (int i=0; i<localAccounts.length; i++){
if (localAccounts[i].type.equals("com.facebook.auth.login")){
am.removeAccount(localAccounts[i], null, null);
}
}`
So it'll be really great if somebody could guide me properly on how to carry out a successful logout operation on Facebook, I'll be highly obliged.
Thanks in advance :)
The SDK will use either of two options to let the user log in to your app on Android:
using the native login dialog (which is powered by the Facebook app that is installed on the device)
using a webview-based dialog if the Facebook app is not installed on the device.
Both options depend on you being signed into Facebook in another app (your browser/your native Facebook app).
If you want to log into your app as a different user (there is really no need, because android system user profiles should be considered personal and individually owned), you need to go to the app you use for Facebook (native Facebook app/browser) and switch to a different profile there. After that you should be able to log into your app with that other profile.
Other than that, it is not your app's job to log people out of their Facebook.

How to track organic vs paid-ad facebook users in my app?

I am using facebook sdk in my app for tracking of ads and install counts. Is there any way to know whether the source of new app install is facebook ad or not.
I read facebook sdk documentation but couldn't find a direct way to do it.
Facebook's mobile app install ads support deep linking. You can use that to send install attribution data into the app. This answer explains how.
I helped build and actively maintain a free deep linking platform called branch.io that can do this very easily for both Android or iOS. The tool leverages a public API that Facebook has to check if a new device came from a Facebook ad, app invite or whatever. You can read more about this public API here.
Let me explain how to set up and use it.
Head to dashboard.branch.io and create a Branch link. Add in labels for campaign, channel, etc depending on your use case. If you want to stuff custom parameters in, you can add unlimited keys/values in the deep link data section at the bottom.
Here's what it would look like: https://bnc.lt/m/3vk4ENnQcm
Once you have your Branch link, you're ready to make an advertisement. While creating your advertisement, you simply need to paste the link into the 'Deep Link' field as in the screenshot below.
Lastly, you want to know client side (after install) if the user came from an advertisement or not. To do this, you simply make a call to the Branch library in your App Delegate for iOS or splash Activity in Android. The callback block in the below example will contain all of the parameters of the link you created on the dashboard.
Branch *branch = [Branch getInstance];
[branch initSessionWithLaunchOptions:launchOptions
andRegisterDeepLinkHandler:^(NSDictionary *params, NSError *error) {
if (!error) {
NSLog(#"finished init with deep link params = %#", [params description]);
}
}];
I hope this helps!

"Page not found" when a user clicks on a Facebook invite from my application

I'm not sure if this is a programming related problem or not, but as I have no experience with the Facebook SDK I'm just assuming that I did something wrong somewhere, even though I've followed the documentation to the T.
I am using the Unity SDK for anybody that is curious, and I am using the FB.AppRequest to send the invite to the application, the code in my application looks exactly like that in the documentation.
public void InviteFriends() {
FB.AppRequest(
message: "Come play this great game!",
callback: LogCallback
);
}
void LogCallback(FBResult result) {
Debug.Log("Callback was called: " + result.Text);
}
This brings up the box as expected and allows me to invite a friend, and the friend does get the invite, however once they click on the invite they are redirected to a page that looks like this:
Which is causing quite a bit of problems for me; I've checked everything in the application panel and it seems like everything checks out. My google play identifier is correct as-well as my Class Name. My key hashes are all correct. I don't know what else I can do. If you'd like to look up my bundle identifier on the play store it's buzz.qualify and I'm sure that you'll find it with ease.
I should also add that I have an application page which can be found here: https://www.facebook.com/pages/Qualify/1647231425506903?fref=ts
This page is linked to the facebook application in the developer console as-well.
What can I do to resolve this issue? Is it in the code? Please help, this has been a 4 day long set-back and we're losing progress rapidly because of it.
It's been a few days now, we're now paying someone for a fix through paypal.
Do you have Canvas App setup on Facebook for your Android Game?
If not, read
Requirements for Invitable Friends.
It states that your game request will...
direct recipients to one of the following places:
Your app on Facebook Canvas.
Your native app on iOS or Android, if installed.
The Apple App Store or Google Play, if not installed.

Android - facebook automatically post

I want to integrate an android app with facebook.
I've managed to fetch friends list and to post on wall on demand (a facebook url view is loaded and the user can post on wall whatever he texts).
I want, when the app is started and the user accepts the permisions, to post a message on wall that he is started to play my game without showing that url view for posting (an automatically post)
Can someone help me?
It's probably late and maybe you've got your answer for this question.
But for anyone else who need an answer:
First, you can use the Graph API, there is an example of how to post on
a wall.
But there is a restriction!!
Facebook is not allow us to enter a prefiil message!
The content of this message must come from the user itself!
Watch this video of Facebook on Platform Policy 2.3 Example and Explanation

Categories

Resources