I have imported the Facebook Demo into netbeans and followed the guidelines as mentioned in the developer guide and as well as set required facebook permissions. But I'm failing to share the text on to the wall, where as am able to retrieve friends list, profile info and news feed.
final ShareButton share = new ShareButton();
final TextArea t = new TextArea(" This is sample text from using CodenameOne api");
t.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
share.setTextToShare(t.getText());
}
});
c.addComponent(BorderLayout.CENTER, t);
share.setTextToShare(t.getText());
Is there anything which im missing to integrate or set any additional permissions?
You need to be clear if this is in the device or in the simulator. On iOS/Android the native share functionality is used and the behavior is very different from the simulator.
Facebook recently made changes to the way permissions work and essentially blocked support for non-iOS/Android platforms. This still worked after the blocks but its possible that it stopped.
Related
I am working on a new android app and I want to integrate the 'Invite Friends' from fb in order to invite them to use the app. I have added the required code in the app, I've also created the app in the developer portal from Facebook, but users are not getting the notification if I share it.
I tried to also add the user in the settings -> tester users and yet no notification for them.
Can someone help me on this? I over searched the internet, but I could find an answer on this.
Code used for opening the sharing dialog:
private void InviteFriends()
{
if (AppInviteDialog.CanShow())
{
var content = new AppInviteContent.Builder()
.SetApplinkUrl(Resources.GetString(Resource.String.app_url))
//.SetPreviewImageUrl(previewImageUrl)
.Build();
AppInviteDialog.Show(this, (AppInviteContent)content);
}
}
Thank you in advance,
Alex
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.
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.
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.
I want to connect my users to signin in facebook through my app. I did some google and some people are saying use fbrocket where as some http://github.com/facebook/facebook-android-sdk.git. I want suggestions
1) which one is easy to implement?
2) what is the difference between them?
3) Why I need to install a jar. Can I achieve this using some Facebook Api?
Any suggestion is much appreciated.
Thanks rachana.
As Cristian said, fbrocket predates the official SDK and is more or less obsoleted by the official SDK, which is newer, shinier, and mostly based on newer longer-support-lived standards like OpenGraph and OAuth. FBRocket is supposedly being rewritten for these, but there's no release for that yet AFAIK. There's a few things the official SDK is still missing (photo uploading, for instance) but if you just want sign-in-via-facebook, it's definitely the way to go.
I'm not sure I understand your 3rd question though -- you need to include Facebook code, either by a jarfile, android library include, or copy-paste -- in order to actually call the Facebook APIs. The Facebook project is open source; if you're not comfortable including it wholesale, you can freely yank out the bits you need. For example, I've used it in projects that only needed authentication and not publishing, customizing the auth dialog handline and removing all the non-login-related code. You could roll your own implementation based on authenticating via OAuth2 and call all the endpoints yourself, but why bother when Facebook already did the work of giving you the code to do that from Android already?
I recommend to use http://github.com/facebook/facebook-android-sdk.git since it's official and it's updated regularly (it's also really easy to implement and it comes with a couple of nice examples). On the other hand FBRocket seems to be out of date, and the developers are still working on the support for Facebook Graph API.
This is facebook's developer info page, the link you gave seems to be the official Android API.
The jar is the actual library that speaks with facebook.
What action on Facebook are you trying to perform? If you are only trying to allow the user to post content from your application to their facebook page you do this
private static final String FACEBOOK_URL = "http://www.facebook.com/sharer.php?u=
try {
Uri uri = Uri.parse(FACEBOOK_URL + yourcontent + "&src=sp");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
catch (Exception e)
{
e.printStackTrace();
}
}