my.getAppIdSync

Use this API to obtain the Mini Program App ID synchronously.

Sample Code

copy
const appIdRes = my.getAppIdSync();
console.log(appIdRes.appId);

Return Value

PropertyTypeDescription
appIdString

The ID of the current mini program. The result varies depending on whether the mini program is launched to AlipayCN:

  • If the mini program is launched to AlipayCN, the obtained value is the ID assigned by AlipayCN. If you need to obtain the ID assigned by Mini Program Platform, go to Mini Program Platform and find Mini Program ID on the mini-program details page.
  • If the mini program is not launched to AlipayCN, the obtained ID is the one assigned by Mini Program Platform.