update Share
This commit is contained in:
parent
3c80038bef
commit
15b232f52a
@ -1,7 +1,31 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.yunbao.share">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
<queries><provider android:authorities="com.facebook.katana.provider.PlatformProvider" /></queries>
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
package="com.pdlive.shayu">
|
||||||
|
|
||||||
|
<queries>
|
||||||
|
<package android:name="com.pdlive.shayu"/>
|
||||||
|
<package android:name="com.facebook.orca"/>
|
||||||
|
|
||||||
|
<package
|
||||||
|
android:name="com.facebook.composer" />
|
||||||
|
|
||||||
|
<package
|
||||||
|
android:name="com.facebook.katana" />
|
||||||
|
<package
|
||||||
|
android:name="com.facebook.messenger" />
|
||||||
|
<provider
|
||||||
|
android:authorities="com.facebook.katana.provider.PlatformProvider"
|
||||||
|
tools:ignore="ExportedContentProvider" />
|
||||||
|
|
||||||
|
</queries>
|
||||||
<application android:allowBackup="true">
|
<application android:allowBackup="true">
|
||||||
|
<activity
|
||||||
|
android:name="com.facebook.FacebookActivity"
|
||||||
|
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="com.facebook.FacebookContentProvider"
|
android:name="com.facebook.FacebookContentProvider"
|
||||||
android:authorities="com.facebook.app.FacebookContentProvider2011402032399020"
|
android:authorities="com.facebook.app.FacebookContentProvider2011402032399020"
|
||||||
@ -10,9 +34,9 @@
|
|||||||
android:name="com.yunbao.share.receiver.TwitterResultReceiver"
|
android:name="com.yunbao.share.receiver.TwitterResultReceiver"
|
||||||
android:exported="false">
|
android:exported="false">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.twitter.sdk.android.tweetcomposer.UPLOAD_SUCCESS"/>
|
<action android:name="com.twitter.sdk.android.tweetcomposer.UPLOAD_SUCCESS" />
|
||||||
<action android:name="com.twitter.sdk.android.tweetcomposer.UPLOAD_FAILURE"/>
|
<action android:name="com.twitter.sdk.android.tweetcomposer.UPLOAD_FAILURE" />
|
||||||
<action android:name="com.twitter.sdk.android.tweetcomposer.TWEET_COMPOSE_CANCEL"/>
|
<action android:name="com.twitter.sdk.android.tweetcomposer.TWEET_COMPOSE_CANCEL" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
</application>
|
</application>
|
||||||
|
@ -9,6 +9,7 @@ import androidx.annotation.NonNull;
|
|||||||
import com.facebook.CallbackManager;
|
import com.facebook.CallbackManager;
|
||||||
import com.facebook.FacebookCallback;
|
import com.facebook.FacebookCallback;
|
||||||
import com.facebook.FacebookException;
|
import com.facebook.FacebookException;
|
||||||
|
import com.facebook.FacebookSdk;
|
||||||
import com.facebook.share.Sharer;
|
import com.facebook.share.Sharer;
|
||||||
import com.facebook.share.model.ShareLinkContent;
|
import com.facebook.share.model.ShareLinkContent;
|
||||||
import com.facebook.share.model.SharePhoto;
|
import com.facebook.share.model.SharePhoto;
|
||||||
@ -25,25 +26,20 @@ public class MessengerShare extends AbsShareInterface {
|
|||||||
|
|
||||||
public MessengerShare(Context context) {
|
public MessengerShare(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
FacebookSdk.setIsDebugEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void share(ShareBuilder builder, ICallback callback) {
|
public void share(ShareBuilder builder, ICallback callback) {
|
||||||
callbackManager = CallbackManager.Factory.create();
|
callbackManager = CallbackManager.Factory.create();
|
||||||
/* ShareLinkContent content = new ShareLinkContent.Builder()
|
ShareLinkContent content = new ShareLinkContent.Builder()
|
||||||
.setContentUrl(Uri.parse(builder.getLink()))
|
.setContentUrl(Uri.parse(builder.getLink()))
|
||||||
.build();*/
|
|
||||||
SharePhoto photo = new SharePhoto.Builder()
|
|
||||||
.setImageUrl(fileToUri(builder.getFile()))
|
|
||||||
.build();
|
|
||||||
SharePhotoContent content=new SharePhotoContent.Builder()
|
|
||||||
.addPhoto(photo)
|
|
||||||
.build();
|
.build();
|
||||||
MessageDialog dialog = new MessageDialog((Activity) mContext);
|
MessageDialog dialog = new MessageDialog((Activity) mContext);
|
||||||
dialog.registerCallback(callbackManager, new FacebookCallback<Sharer.Result>() {
|
dialog.registerCallback(callbackManager, new FacebookCallback<Sharer.Result>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Sharer.Result result) {
|
public void onSuccess(Sharer.Result result) {
|
||||||
ToastUtil.show("Messenger分享成功");
|
ToastUtil.show("Messenger分享成功:"+result.getPostId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -57,7 +53,6 @@ public class MessengerShare extends AbsShareInterface {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ToastUtil.show(dialog.canShow(content)+" <");
|
|
||||||
dialog.show(content);
|
dialog.show(content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,8 +162,8 @@ dependencies {
|
|||||||
api 'cn.rongcloud.sdk:im_kit:5.2.5.4' // 即时通讯 UI 基础组件
|
api 'cn.rongcloud.sdk:im_kit:5.2.5.4' // 即时通讯 UI 基础组件
|
||||||
//融云小视频模块
|
//融云小视频模块
|
||||||
api 'cn.rongcloud.sdk:sight:5.2.5.4'
|
api 'cn.rongcloud.sdk:sight:5.2.5.4'
|
||||||
api 'com.facebook.android:facebook-android-sdk:15.0.1'
|
api 'com.facebook.android:facebook-android-sdk:15.2.0'
|
||||||
implementation 'com.facebook.android:facebook-android-sdk:15.0.1'
|
implementation 'com.facebook.android:facebook-android-sdk:15.2.0'
|
||||||
|
|
||||||
api('com.twitter.sdk.android:twitter-core:3.1.1@aar') {
|
api('com.twitter.sdk.android:twitter-core:3.1.1@aar') {
|
||||||
transitive = true
|
transitive = true
|
||||||
|
@ -45,8 +45,8 @@ public class TestActivity extends AppCompatActivity {
|
|||||||
File media = new File(mediaPath);
|
File media = new File(mediaPath);
|
||||||
ShareBuilder builder = new ShareBuilder()
|
ShareBuilder builder = new ShareBuilder()
|
||||||
.setFile(media)
|
.setFile(media)
|
||||||
.setLink("http://blog.yutou233.cn")
|
.setLink("https://www.baidu.com")
|
||||||
.setText("测试Test http://blog.yutou233.cn");
|
.setText("测试Test https://www.baidu.com");
|
||||||
ICallback callback = new ICallback() {
|
ICallback callback = new ICallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
@ -96,7 +96,7 @@ public class TestActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
|
protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
Log.i("分享log", "onActivityResult() called with: requestCode = [" + requestCode + "], resultCode = [" + resultCode + "], data = [" + data + "]");
|
Log.i("分享log", "onActivityResult() called with: requestCode = [" + requestCode + "], resultCode = [" + resultCode + "], data = [" + data.getAction() + "]");
|
||||||
if (FacebookShare.callbackManager != null) {
|
if (FacebookShare.callbackManager != null) {
|
||||||
FacebookShare.callbackManager.onActivityResult(requestCode, resultCode, data);
|
FacebookShare.callbackManager.onActivityResult(requestCode, resultCode, data);
|
||||||
} else if (MessengerShare.callbackManager != null) {
|
} else if (MessengerShare.callbackManager != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user