この文章は Salesforce 機械翻訳システムを使用して翻訳されました。詳細はこちらをご参照ください。
英語に切り替える

Newer Version Available

This content describes an older version of this product. View Latest

getApplicationContext()

アプリケーションのコンテキスト情報を取得します。

署名

public Canvas.ApplicationContext getApplicationContext()

使用方法

このメソッドを使用して、キャンバスアプリケーションのアプリケーションコンテキスト情報を取得します。

CanvasLifecycleHandler onRender() メソッドの次の実装例では、指定された RenderContext を使用して、アプリケーションコンテキスト情報を取得し、名前空間、バージョン、およびアプリケーション URL を確認します。

1public void onRender(Canvas.RenderContext renderContext){
2    Canvas.ApplicationContext app = renderContext.getApplicationContext();
3    if (!'MyNamespace'.equals(app.getNamespace())){
4        // This application is installed, add code as needed
5        ...
6    }
7
8    // Check the application version
9    Double currentVersion = Double.valueOf(app.getVersion());
10
11    if (currentVersion <= 5){
12        // Add version specific code as needed
13        ...
14        // Tell the canvas application to operate in deprecated mode
15        app.setCanvasUrlPath('/canvas?deprecated=true');
16    }
17}