ワークフローの列挙

DataWedge 13.0

ワークフローを列挙

デバイスで利用可能な ワークフロー入力 のリストを生成します。ワークフローがライセンス付与されているかどうかに関わらず、ワークフロー IDと名前を返します。

関数プロトタイプ

Intent intent = new Intent();
intent.setAction("com.symbol.datawedge.api.ACTION");
intent.putExtra("com.symbol.datawedge.api.ENUMERATE_WORKFLOWS", "");

パラメータ

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

戻り値

ワークフローの列挙リストは、ブロードキャスト インテント (com.symbol.datawedge.api.RESULT_ENUMERATE_WORKFLOWS) を介して返されます。ワークフローのリストは、文字列配列の arrayList<String> として返されます。

コード例

ブロードキャスト インテントを登録/登録解除してワークフローを列挙し、インテントを送信し、結果を取得するサンプル コード:

    /*Call before sending the enumerate workflows query*/
    private void registerReceivers() {
        IntentFilter filter = new IntentFilter();
        filter.addAction("com.symbol.datawedge.api.RESULT_ACTION");
        filter.addCategory(Intent.CATEGORY_DEFAULT);
        registerReceiver(broadcastReceiver, filter);
    }

    /* Send the enumerate workflows command to DataWedge intent API*/
    private void enumerateWorkflows() {
        Intent intent = new Intent();
        intent.setAction("com.symbol.datawedge.api.ACTION");
        intent.putExtra("com.symbol.datawedge.api.ENUMERATE_WORKFLOWS", "");
        sendBroadcast(intent);
    }

    /*unregister the broadcast receiver*/
    private void unRegisterReceivers() {
        unregisterReceiver(broadcastReceiver);
    }

    /*Create broadcast receiver to receive the enumerate workflows result*/
    private BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            Log.d("EnumerateWorkflows", "Action: " + action);
            if (action.equals("com.symbol.datawedge.api.RESULT_ACTION")) {
                if (intent.hasExtra("com.symbol.datawedge.api.RESULT_ENUMERATE_WORKFLOWS")) {
                    Bundle workflowBundle = (Bundle) intent.getExtras().get("com.symbol.datawedge.api.RESULT_ENUMERATE_WORKFLOWS");
                    String strData = "";
                    int count = 1;
                    ArrayList<String> workflowList = new ArrayList<>();
                    if (workflowBundle != null) {
                        for (String key : workflowBundle.keySet()) {
                            String value = workflowBundle.getString(key);
                            if (value != null) {
                                String listItem = count + ") " +key +" - "+ value;
                                workflowList.add(listItem);
                                strData += listItem + "\n";
                                count++;
                            }
                        }
                        Log.d("EnumerateWorkflows",strData );
                    }
                }
            }
        }
    };

出力データの例:

    /* workflowID - WorkflowName */

    1) tin_number - Tire Identification Number(TIN)
    2) license_plate - License Plate
    3) container_scanning - Shipping Container ID
    4) free_form_ocr - Free - Form OCR
    5) free_form_capture - Free - Form Image Capture
    6) meter_reading - Meter
    7) document_capture - Document Capture
    8) id_scanning - Identification Documents
    9) vin_number - Vehicle Identification Number(VIN)

関連項目:

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

開発者ポータル | Zebra 開発者コミュニティ

インテント | Android 開発者

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

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