DDShareActivity.java 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. package uni.deepoil.com.ddshare;
  2. import android.os.Bundle;
  3. import android.util.Log;
  4. import androidx.annotation.Nullable;
  5. import androidx.appcompat.app.AppCompatActivity;
  6. /**
  7. * @author Berial
  8. * @since 2025-06-16
  9. */
  10. public class DDShareActivity extends AppCompatActivity { // implements IDDAPIEventHandler {
  11. // private IDDShareApi mIDDShareApi;
  12. @Override
  13. protected void onCreate(@Nullable Bundle savedInstanceState) {
  14. super.onCreate(savedInstanceState);
  15. Log.d("lzc" ,"onCreate==========>");
  16. try {
  17. // activity的export为true,try起来,防止第三方拒绝服务攻击。APP_ID指通过步骤一获取的应用的AppKey
  18. // mIDDShareApi = DDShareApiFactory.createDDShareApi(this, "dingcrhejkptu0mcsw3r", true);
  19. // mIDDShareApi.handleIntent(getIntent(), this);
  20. // DingTalkModule.shareApi.handleIntent(getIntent(), this);
  21. } catch (Exception e) {
  22. // e.printStackTrace();
  23. Log.d("lzc" , "e===========>" + e);
  24. }
  25. }
  26. // @Override
  27. // public void onReq(BaseReq baseReq) {
  28. // System.out.println(baseReq);
  29. // Bundle bundle = new Bundle();
  30. // baseReq.toBundle(bundle);
  31. // System.out.println(bundle);
  32. // }
  33. // @Override
  34. // public void onResp(BaseResp baseResp) {
  35. // System.out.println(baseResp);
  36. // int errCode = baseResp.mErrCode;
  37. // Log.d("lzc", "errorCode==========>" + errCode);
  38. // String errMsg = baseResp.mErrStr;
  39. // Log.d("lzc", "errMsg==========>" + errMsg);
  40. // if (baseResp.getType() == ShareConstant.COMMAND_SENDAUTH_V2 && (baseResp instanceof SendAuth.Resp)) {
  41. // SendAuth.Resp authResp = (SendAuth.Resp) baseResp;
  42. // switch (errCode) {
  43. // case BaseResp.ErrCode.ERR_OK:
  44. // Toast.makeText(this, "授权成功,授权码为:" + authResp.code, Toast.LENGTH_SHORT).show();
  45. // break;
  46. // case BaseResp.ErrCode.ERR_USER_CANCEL:
  47. // Toast.makeText(this, "授权取消", Toast.LENGTH_SHORT).show();
  48. // break;
  49. // default:
  50. // Toast.makeText(this, "授权异常" + baseResp.mErrStr, Toast.LENGTH_SHORT).show();
  51. // break;
  52. // }
  53. // } else {
  54. // switch (errCode) {
  55. // case BaseResp.ErrCode.ERR_OK:
  56. // Toast.makeText(this, "分享成功", Toast.LENGTH_SHORT).show();
  57. // break;
  58. // case BaseResp.ErrCode.ERR_USER_CANCEL:
  59. // Toast.makeText(this, "分享取消", Toast.LENGTH_SHORT).show();
  60. // break;
  61. // default:
  62. // Toast.makeText(this, "分享失败" + baseResp.mErrStr, Toast.LENGTH_SHORT).show();
  63. // break;
  64. // }
  65. // }
  66. // finish();
  67. // }
  68. }