AppInviteDialog android in hindi in most of devices - android

I want to send my app invites from Facebook.The code I've written is able to send invites but I'm facing two problems.
I don't receive any callback after invitation.
In most of devices Invite dialog has default language Hindi(Click for Screenshot). How can I change the defaults to English?.
PS: I have checked default language in my Facebook developer account app is English.
Any help would be appreciated.
String AppURl = "<My Facebook App URL>";
String previewImageUrl = "<Preview Image URL>";
sCallbackManager = CallbackManager.Factory.create();
AppInviteDialog appInviteDialog = new AppInviteDialog(getActivity());
appInviteDialog.registerCallback(sCallbackManager,
new FacebookCallback<AppInviteDialog.Result>() {
#Override
public void onSuccess(AppInviteDialog.Result result) {
Log.d("Invitation", "Invitation Sent Successfully");
Toast.makeText(getActivity(), "Invitation Sent Successfully", Toast.LENGTH_SHORT).show();
}
#Override
public void onCancel() {
}
#Override
public void onError(FacebookException e) {
Log.d("Invitation", "Error Occured");
}
});
if (AppInviteDialog.canShow()) {
AppInviteContent content = new AppInviteContent.Builder()
.setApplinkUrl(AppURl)
.setPreviewImageUrl(previewImageUrl)
.build();
appInviteDialog.show(content);
}

Related

How to Check Facebook invite app to friends is successfully sent invitation or not sent in android [duplicate]

In the new Fb SDK 4.0 for Android you can register a callback for the LoginButton according to the docs. https://developers.facebook.com/docs/facebook-login/android/v2.3
The question is is this possible for the AppInviteDialog as well? Or is there any other way to identify if the App-Invite was successful or not?
Yes, this is possible.
public static void openDialogInvite(final Activity activity)
{
String appLinkUrl, previewImageUrl;
appLinkUrl = "your app link url";
previewImageUrl = "https://www.example.com/my_invite_image.jpg";
if (AppInviteDialog.canShow())
{
AppInviteContent content = new AppInviteContent.Builder()
.setApplinkUrl(appLinkUrl)
.setPreviewImageUrl(previewImageUrl)
.build();
AppInviteDialog appInviteDialog = new AppInviteDialog(activity);
CallbackManager sCallbackManager = CallbackManager.Factory.create();
appInviteDialog.registerCallback(sCallbackManager, new FacebookCallback<AppInviteDialog.Result>()
{
#Override
public void onSuccess(AppInviteDialog.Result result)
{
}
#Override
public void onCancel()
{
}
#Override
public void onError(FacebookException e)
{
}
});
appInviteDialog.show(content);
}
}

Invite Friends using Facebook Lite app Android

I have implemented the Facebook invite friend in my app. It is working fine when I have installed the Facebook Application in my device. But if I uninstall the Facebook app and Download the Facebook lite application then it is not working.
Here is my code snippet.
Please help me.
Thanks in advance.
public void openDialogInvite(final Activity activity) {
String AppURl = "**************"; //Generated from //fb developers
CallbackManager sCallbackManager = CallbackManager.Factory.create();
if (AppInviteDialog.canShow()) {
AppInviteContent content = new AppInviteContent.Builder()
.setApplinkUrl(AppURl)
.build();
AppInviteDialog appInviteDialog = new AppInviteDialog(activity);
appInviteDialog.registerCallback(sCallbackManager,
new FacebookCallback<AppInviteDialog.Result>() {
#Override
public void onSuccess(AppInviteDialog.Result result) {
Log.d("Invitation", "Invitation Sent Successfully");
System.out.println("test onSuccess");
}
#Override
public void onCancel() {
System.out.println("test on cancel");
}
#Override
public void onError(FacebookException e) {
Log.d("Invitation", "Error Occured");
System.out.println("test Error" + e.getMessage());
}
});
appInviteDialog.show(content);
}
}

Facebook Posted image shared link not working?

When we post image on facebook by my android app it's post successfully but when we click on that post on Facebook app (on mobile devices) there is a toast appear "There's a problem opening this app." but when open in WEB and click on that posted image it'll redirect to shared link successfully.
I have use this code to share post on facebook.
GraphRequest request = GraphRequest.newPostRequest(AccessToken.getCurrentAccessToken(),
"me/feed", null, new GraphRequest.Callback() {
#Override
public void onCompleted(GraphResponse response) {
Log.i(TAG, response.toString());
//checkPostStatusAndEnableButton();
}
});
Bundle postParams = request.getParameters();
postParams.putString("link",post_url);
postParams.putString("caption", caption);
request.setParameters(postParams);
request.executeAsync();
Is we have use some other action for url for mobile devices?
Try this on :
private static List<String> PERMISSIONS = Arrays.asList("public_profile","user_photos","user_videos", "email","user_likes","user_posts",
"user_hometown", "user_location","user_about_me","user_birthday",
"user_friends","user_relationship_details");
LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
#Override
public void onSuccess(LoginResult loginResult) {
// App code
Log.i(TAG,"onSuccess registerCallback");
}
#Override
public void onCancel() {
// App code
Log.i(TAG,"onCancel registerCallback");
}
#Override
public void onError(FacebookException exception) {
// App code
Log.i(TAG,"onError registerCallback");
}
});
Then call this share link method :
private void shareLink() {
ShareLinkContent content = new ShareLinkContent.Builder()
.setContentUrl(Uri.parse("https://developers.facebook.com"))
.build();
ShareDialog shareDialog = new ShareDialog(this);
shareDialog.show(content, ShareDialog.Mode.AUTOMATIC);
}

No image and content in preview when sharing Facebook app link for mobile only content

When I try to implement the sharing of links for the app links using the ShareDialog using ShareLinkContent, the image and title are not shown correctly when the actually the post is shared.
String url = "https://fb.me/" + id; //Id is generated by app links hosting api
ShareDialog shareDialog = new ShareDialog(activity);
if (ShareDialog.canShow(ShareLinkContent.class)) {
ShareLinkContent.Builder linkContentBuilder = new ShareLinkContent.Builder()
.setContentUrl(Uri.parse(url))
.setContentTitle(contentTitle)
.setContentDescription(contentDescription);
if (imageUrl != null) {
linkContentBuilder.setImageUrl(Uri.parse(imageUrl));
}
ShareLinkContent linkContent = linkContentBuilder.build();
shareDialog.setShouldFailOnDataError(true);
shareDialog.registerCallback(activity.callbackManager,
new FacebookCallback<Sharer.Result>() {
#Override
public void onSuccess(Sharer.Result result) {
Log.d(TAG, "Facebook sharing successful");
}
#Override
public void onCancel() {
Log.d(TAG, "Facebook sharing cancelled");
}
#Override
public void onError(FacebookException e) {
Log.d(TAG, "Facebook sharing error");
Log.d(TAG, e.getMessage());
}
});
shareDialog.show(linkContent);
}
But the sharing looks like below:
Facebook sharing
Can someone help me out?

Using facebook sdk 4.4.1. Want to get the number of invites sent by the app user using app invite dialog?

i want to calculate the number of person app user has invited from his friend list.
this is my code. in result i m getting null.
public void openDialogInvite(final Activity activity) {
String AppURl = "https://fb.me/659724450828700"; //Generated from //fb developers
//String previewImageUrl = " ";
sCallbackManager = CallbackManager.Factory.create();
if (AppInviteDialog.canShow()) {
AppInviteContent content = new AppInviteContent.Builder()
.setApplinkUrl(AppURl)
//.setPreviewImageUrl(previewImageUrl)
.build();
final AppInviteDialog appInviteDialog = new AppInviteDialog(activity);
appInviteDialog.registerCallback(sCallbackManager,
new FacebookCallback<AppInviteDialog.Result>() {
#Override
public void onSuccess(AppInviteDialog.Result result) {
Log.v("invitation", result.toString());
// setting parameters for request execution for both graph api request
}
#Override
public void onCancel() {
}
#Override
public void onError(FacebookException e) {
Log.d("Invitation", "Error Occured");
}
});
appInviteDialog.show(content);
}
thanks in advance.
It is is not possible, to get the list of invited friends of a user until unless ur app is not a game on canvas.

Categories

Resources