[A] facebook share

This commit is contained in:
2025-01-17 16:15:48 +08:00
parent 90e54158f1
commit c576351bca
11 changed files with 609 additions and 19 deletions

View File

@@ -2,6 +2,7 @@
package com.unity3d.player;
import android.app.Activity;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
@@ -13,6 +14,9 @@ import com.barton.log.builder.ParamsBuilder;
import com.barton.log.ebarton.BaseUrl;
import com.barton.log.ebarton.EventType;
import com.barton.log.logapi.IGASDK;
import com.facebook.share.model.ShareLinkContent;
import com.facebook.share.widget.MessageDialog;
import com.facebook.share.widget.ShareDialog;
import com.google.android.gms.tasks.Task;
import com.google.android.play.core.review.ReviewException;
import com.google.android.play.core.review.ReviewInfo;
@@ -38,6 +42,7 @@ import org.json.JSONObject;
import java.util.HashMap;
import java.util.Map;
public class SDKManager {
private final static Handler handler = new Handler(Looper.getMainLooper());
@@ -390,6 +395,42 @@ public class SDKManager {
});
}
public static void FBShareLink(String title, String content, String url)
{
Log.e(TAG,"FBShareLink : " + title + " " + content + " " + url);
if (ShareDialog.canShow(ShareLinkContent.class)) {
Activity activity = UnityPlayer.currentActivity;
ShareDialog dialog = new ShareDialog(activity);
ShareLinkContent linkContent = new ShareLinkContent.Builder()
.setQuote(content)
.setContentUrl(Uri.parse("http://developers.facebook.com/android"))
.build();
dialog.show(linkContent);
}
else
{
Log.e(TAG, "FBShareDialog can not show");
}
}
public static void MessengerShareLink(String title, String content, String url)
{
Log.e(TAG,"MessengerShareLink : " + title + " " + content + " " + url);
if (MessageDialog.canShow(ShareLinkContent.class)) {
Activity activity = UnityPlayer.currentActivity;
ShareLinkContent linkContent = new ShareLinkContent.Builder()
.setQuote(content)
.setContentUrl(Uri.parse("http://developers.facebook.com/android"))
.build();
MessageDialog.show(activity,linkContent);
}
else
{
Log.e(TAG, "Messenger ShareDialog can not show");
}
}
}