プロファイルの複製

DataWedge 15.0

CLONE_PROFILE

すべての設定を含む既存の DataWedge プロファイルのコピーを作成するために使用します。

関数プロトタイプ

Intent i = new Intent(); i.setAction("com.symbol.datawedge.api.ACTION"); i.putExtra("com.symbol.datawedge.api.CLONE_PROFILE", <values>);

パラメータ

ACTION [String]: com.symbol.datawedge.api.ACTION

EXTRA_DATA [String]: com.symbol.datawedge.api.CLONE_PROFILE

String[ ] <値>: コピーするプロファイルの名前、新しいプロファイル名

結果コード

DataWedge は、アプリにインテント エクストラ (SEND_RESULT および COMMAND_IDENTIFIER) が含まれている場合、次のエラー コードを返し、DataWedge の結果インテント メカニズムを使用してアプリで結果を取得できるようにします。以下のを参照してください。

  • PROFILE_NOT_FOUND - エラー
  • PROFILE_ALREADY_EXIST - エラー
  • UNKNOWN - エラー
  • PARAMETER_INVALID - エラー
  • PROFILE_NAME_EMPTY - エラー

詳細については、結果コード ガイドも参照してください。

コード例

Intent i = new Intent(); i.setAction("com.symbol.datawedge.api.ACTION"); String[ ] values = {"Source profile","Destination Profile"}; i.putExtra("com.symbol.datawedge.api.CLONE_PROFILE", values); this.sendBroadcast(i);

結果の生成および受信

コマンドおよび構成インテント パラメータは、結果コードを送信するかどうかを決定します (デフォルトでは無効)。SEND_RESULT を使用する場合は、結果コードと元のインテントを照合するために、COMMAND_IDENTIFIER を使用します。こうしたパラメータの使用方法のサンプルを以下に示します。

注: 使用する API に合わせて、この汎用コードを変更します

// send the intent Intent i = new Intent(); i.setAction(ACTION); i.putExtra("com.symbol.datawedge.api.CREATE_PROFILE", "Profile1"); // request and identify the result code i.putExtra("SEND_RESULT","true"); i.putExtra("COMMAND_IDENTIFIER","123456789"); this.sendBroadcast(i); // register to receive the result public void onReceive(Context context, Intent intent){ String command = intent.getStringExtra("COMMAND"); String commandidentifier = intent.getStringExtra("COMMAND_IDENTIFIER"); String result = intent.getStringExtra("RESULT"); Bundle bundle = new Bundle(); String resultInfo = ""; if(intent.hasExtra("RESULT_INFO")){ bundle = intent.getBundleExtra("RESULT_INFO"); Set<String> keys = bundle.keySet(); for (String key: keys) { resultInfo += key + ": "+bundle.getString(key) + "\n"; } } String text = "Command: "+command+"\n" + "Result: " +result+"\n" + "Result Info: " +resultInfo + "\n" + "CID:"+commandidentifier; Toast.makeText(context, text, Toast.LENGTH_LONG).show(); };

結果コードの設定/取得

コマンドおよび構成インテント パラメータは、結果コードを送信するかどうかを決定します (デフォルトでは無効)。SEND_RESULT を使用する場合は、結果コードと元のインテントを照合するために、COMMAND_IDENTIFIER を使用します。こうしたパラメータの使用方法のサンプルを以下に示します。

注: 使用する API に合わせて、この汎用コードを変更します

// send the intent Intent i = new Intent(); i.setAction(ACTION); i.putExtra("com.symbol.datawedge.api.CREATE_PROFILE", "Profile1"); // request and identify the result code i.putExtra("SEND_RESULT","true"); i.putExtra("COMMAND_IDENTIFIER","123456789"); this.sendBroadcast(i); // register to receive the result public void onReceive(Context context, Intent intent){ String command = intent.getStringExtra("COMMAND"); String commandidentifier = intent.getStringExtra("COMMAND_IDENTIFIER"); String result = intent.getStringExtra("RESULT"); Bundle bundle = new Bundle(); String resultInfo = ""; if(intent.hasExtra("RESULT_INFO")){ bundle = intent.getBundleExtra("RESULT_INFO"); Set<String> keys = bundle.keySet(); for (String key: keys) { resultInfo += key + ": "+bundle.getString(key) + "\n"; } } String text = "Command: "+command+"\n" + "Result: " +result+"\n" + "Result Info: " +resultInfo + "\n" + "CID:"+commandidentifier; Toast.makeText(context, text, Toast.LENGTH_LONG).show(); };

関連項目:

Zebra Support Central | インテグレータ ガイド、製品マニュアル、ソフトウェア ダウンロードおよびサポート

LaunchPad | Zebra 開発者コミュニティ

インテント | Android 開発者

インテントおよびインテント フィルタ | Android 開発者

Android インテント | チュートリアル