目录

Closing the Sharing Panel from the Sharing Details Page

When returning to the sharing panel from the sharing details page, you can set resultCode to a specific ShareAbilityResultCode value to instruct the sharing panel to perform a proper operation. The options are as follows:

Development Procedure

  1. Import required modules.

    import { ShareExtensionAbility, UIExtensionContentSession, Want } from '@kit.AbilityKit';
    import { systemShare } from '@kit.ShareKit';
  2. Configure the target app to call the terminateSelfWithResult API to set resultCode to systemShare.ShareAbilityResultCode.CLOSE to close the sharing panel.

    export default class TestShareAbility extends ShareExtensionAbility {
      async onSessionCreate(want: Want, session: UIExtensionContentSession) {
        session.terminateSelfWithResult({
          resultCode: systemShare.ShareAbilityResultCode.CLOSE
        });
      }
    }