---
schema_version: "1"
id: df532e3dd3da38c4978ccf596fb183a0517562f82a8d993cfcb673c77125287c
title: getApplicationContext()
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_canvas_RenderContext_getApplicationContext.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_canvas_RenderContext_getApplicationContext.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: f28a378b96884bd1d4fe899a88df4e82ce9e61fe79345da92f56785d93c0e958
description: Retrieves the application context information.
---
# getApplicationContext()

Retrieves the application context information.

## Signature

public Canvas.ApplicationContext getApplicationContext()

## Return Value

Type: [Canvas.ApplicationContext](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_interface_canvas_ApplicationContext.htm "Use this interface to retrieve application context information, such as the application version or URL.")

## Usage

Use this method to get the application context information for your canvas app.

## Example

The following example implementation of the [CanvasLifecycleHandler](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_interface_canvas_CanvasLifecycleHandler.htm "Implement this interface to control context information and add custom behavior during the application render phase.") onRender() method uses the provided RenderContext to retrieve the application context information and then checks the namespace, version, and app URL.

public void onRender(Canvas.RenderContext renderContext){
    Canvas.ApplicationContext app = renderContext.getApplicationContext();
    if (!'MyNamespace'.equals(app.getNamespace())){
        // This application is installed, add code as needed
        ...
    }

    // Check the application version
    Double currentVersion = Double.valueOf(app.getVersion());

    if (currentVersion <= 5){
        // Add version specific code as needed
        ...
        // Tell the canvas application to operate in deprecated mode
        app.setCanvasUrlPath('/canvas?deprecated=true');
    }
}