---
schema_version: "1"
id: 94841db54868a4962c8e0071a10494e0f66e94766a34ac32a9441381e72ca860
title: Packaging Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_system_Packaging.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_system_Packaging.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: aa7bceb92a2c96cddbd45f26031b3924e81db7eea34c9b2183eb560677ff7e51
description: Contains a method for obtaining information about managed and unlocked packages.Returns the context packageID in managed and unlocked packages.
---
# Packaging Class

Contains a method for obtaining information about managed and unlocked packages.

## Namespace

[System](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_System.htm "The System namespace provides classes and methods for core Apex functionality.")

## Usage

In the context of a package, use the getCurrentPackageId method to retrieve the packageID.

- **[Packaging Methods](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_system_Packaging.htm#apex_System_Packaging_methods)**

## Packaging Methods

The following are methods for Packaging.

- **[getCurrentPackageId()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_system_Packaging.htm#apex_System_Packaging_getCurrentPackageId)**  
    Returns the context packageID in managed and unlocked packages.

### getCurrentPackageId()

Returns the context packageID in managed and unlocked packages.

#### Signature

public String getCurrentPackageId()

#### Return Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

#### Usage

For managed packages, this method can be combined with [isCurrentUserLicensedForPackage(packageId)](#apex_System_Packaging_getCurrentPackageId "Returns the context packageID in managed and unlocked packages.") to retrieve the packageId at runtime. Then, use packageId to confirm that the contextual user is licensed to use that managed package.