增加分享回调
This commit is contained in:
parent
6283a0a66b
commit
515ed80884
@ -241,7 +241,7 @@ public class MainActivity extends UnityPlayerActivity
|
||||
break;
|
||||
case FILE_SELECTOR_CODE:
|
||||
Uri uri = data.getData();
|
||||
shareToTikTok(uri);
|
||||
shareToTikTok(funId, uri);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@ -906,13 +906,15 @@ public class MainActivity extends UnityPlayerActivity
|
||||
public void showPage(String fid, final String url) {
|
||||
runOnUiThread(() -> {
|
||||
Log.i(TAG, "show page: " + url);
|
||||
// Intent intent = new Intent(this, WebPageActivity.class);
|
||||
// intent.putExtra("url", url);
|
||||
// startActivity(intent);
|
||||
openFileSelector();
|
||||
Intent intent = new Intent(this, WebPageActivity.class);
|
||||
intent.putExtra("url", url);
|
||||
startActivity(intent);
|
||||
// picker video file and share to tiktok
|
||||
// openFileSelector();
|
||||
});
|
||||
}
|
||||
public void shareToTikTok(Uri uriToImage) {
|
||||
public void shareToTikTok(String funId, Uri uriToImage) {
|
||||
this.funId = funId;
|
||||
grantUriPermission("com.zhiliaoapp.musically",
|
||||
uriToImage, Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
grantUriPermission("com.ss.android.ugc.trill",
|
||||
@ -929,9 +931,11 @@ public class MainActivity extends UnityPlayerActivity
|
||||
|
||||
// 3.set required parameters
|
||||
request.mMediaContent = content;
|
||||
request.mState = funId;
|
||||
request.mShareFormat = Share.Format.DEFAULT;
|
||||
tiktokOpenApi.share(request);
|
||||
}
|
||||
// share with Android ShareSheet
|
||||
// runOnUiThread(() -> {
|
||||
// Log.i(TAG, "share to tiktok: " + uriToImage);
|
||||
// Intent shareIntent = new Intent();
|
||||
|
@ -47,6 +47,11 @@ public class TikTokEntryActivity extends Activity implements IApiEventHandler {
|
||||
} else if (resp.getType() == CommonConstants.ModeType.SHARE_CONTENT_TO_TT_RESP) {
|
||||
Share.Response response = (Share.Response) resp;
|
||||
Log.i(TAG, "share result code:" + response.errorCode + " errorMessage:" + response.errorMsg);
|
||||
if (response.errorCode == 0) {
|
||||
JcSDK.nativeCb(response.state, null, "1");
|
||||
} else {
|
||||
JcSDK.nativeCb(response.state, response.errorMsg, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user