Example usage for android.os Message getData

List of usage examples for android.os Message getData

Introduction

In this page you can find the example usage for android.os Message getData.

Prototype

public Bundle getData() 

Source Link

Document

Obtains a Bundle of arbitrary data associated with this event, lazily creating it if necessary.

Usage

From source file:org.torproject.android.Orbot.java

private void startTor() throws RemoteException {

    startService(TorServiceConstants.CMD_START);
    torStatus = TorServiceConstants.STATUS_CONNECTING;

    mTxtOrbotLog.setText("");

    //here we update the UI which is a bit sloppy and mixed up code wise
    //might be best to just call updateStatus() instead of directly manipulating UI in this method - yep makes sense
    imgStatus.setImageResource(R.drawable.torstarting);
    lblStatus.setText(getString(R.string.status_starting_up));

    //we send a message here to the progressDialog i believe, but we can clarify that shortly
    Message msg = mHandler.obtainMessage(TorServiceConstants.ENABLE_TOR_MSG);
    msg.getData().putString(HANDLER_TOR_MSG, getString(R.string.status_starting_up));
    mHandler.sendMessage(msg);/*from w  w w .java2  s  .  co  m*/

}

From source file:com.huofu.RestaurantOS.ui.splash.activate.java

@Override
protected void dealWithmessage(Message msg) {
    switch (msg.what) {
    case ERROR:/*from   ww  w.  ja v a  2s.c  o  m*/
        Bundle bd = (Bundle) msg.getData();
        CommonUtils.sendMsg(null, HIDE_LOADING, mUiHandler);
        showDialogError(bd.getString("reason"), 0);
        break;
    case AUTH_FAILED:
        stopQrScanTimer();
        buttonSwitchInputCode.performClick();
        CommonUtils.sendMsg(null, HIDE_LOADING, mUiHandler);
        showDialogError((String) msg.obj, 0);
        break;
    case AUTH_SUCCESS:
        CommonUtils.sendMsg(getString(R.string.readyToJumpToLogin), activate.SHOW_LOADING_TEXT, mUiHandler);
        mUiHandler.removeMessages(AUTH_SUCCESS);

        finishWithNextActivity(LoginActivity.class);
        break;
    case GET_QRCODE_SUCCESS://???
        qrcodeCreateTime = System.currentTimeMillis() / 1000;

        Bundle bdQrcode = (Bundle) msg.getData();

        tokenQrcode = bdQrcode.getString("token");
        String qrcode_url = bdQrcode.getString("qrcode_url");
        imageViewQrcode.setVisibility(View.VISIBLE);
        bitmapUtils.display(imageViewQrcode, qrcode_url, bigPicDisplayConfig, callback);
        break;
    case SCAN_QRCODE_SUCCESS://???
        flagAuthSuccess = true;
        //stopQrScanTimer();
        CommonUtils.sendMsg(null, AUTH_SUCCESS, mUiHandler);
        break;
    case GET_QRCODE://???
        CommonUtils.sendMsg(getString(R.string.loadingQrcode), SHOW_LOADING_TEXT, mUiHandler);
        ApisManager.GetAuthQrcode(new ApiCallback() {
            @Override
            public void success(Object object) {
                sendUIMessage(HIDE_LOADING, "");
                try {
                    JSONObject obj = (JSONObject) object;
                    String token = (String) obj.get("token");
                    String qrcode_url = (String) obj.get("qrcode_url");

                    Message msg = new Message();
                    msg.what = activate.GET_QRCODE_SUCCESS;
                    Bundle bd = new Bundle();
                    bd.putString("token", token);
                    bd.putString("qrcode_url", qrcode_url);
                    msg.setData(bd);
                    mUiHandler.sendMessage(msg);
                } catch (Exception e) {
                }

            }

            @Override
            public void error(BaseApi.ApiResponse response) {
                sendUIMessage(HIDE_LOADING, "");
                sendUIMessage(SHOW_ERROR_MESSAGE, response.error_message + "");
                CommonUtils.LogWuwei(tag, "GetAuthQrcode failed:" + response.error_message);
            }
        });

        break;
    case SHOW_LOADING_TEXT:
        String content = (String) msg.obj;
        showLoadingDialog(content);
        break;
    case HIDE_LOADING:
        hideLoadingDialog();
        break;
    case SHOW_ERROR_MESSAGE:
        String errMsg = (String) msg.obj;
        showDialogError(errMsg, 0);
        break;
    case UPDATE_QRCODE_SCAN_STATUS:
        textviewScanStauts.setText((String) msg.obj);
        break;
    case SHOW_QRCODE_REFRSH_AGAIN:
        dealQrcodeExpired();
        break;
    case STOP_SCAN_QRCODE_TIMER:
        stopQrScanTimer();
        break;

    }
}

From source file:org.openremote.android.console.AppSettingsActivity.java

/**
 * Initializes the SSL related UI widget properties and event handlers to deal with user
 * interactions.//w  ww .  ja va 2 s .  co  m
 */
private void initSSLState() {
    // Get UI Widget references...

    final ToggleButton sslToggleButton = (ToggleButton) findViewById(R.id.ssl_toggle);
    final EditText sslPortEditField = (EditText) findViewById(R.id.ssl_port);

    final TextView pin = (TextView) findViewById(R.id.ssl_clientcert_pin);

    // Configure UI to current settings state...

    boolean sslEnabled = AppSettingsModel.isSSLEnabled(this);

    sslToggleButton.setChecked(sslEnabled);
    sslPortEditField.setText("" + AppSettingsModel.getSSLPort(this));

    // If SSL is off, disable the port edit field by default...

    if (!sslEnabled) {
        sslPortEditField.setEnabled(false);
        sslPortEditField.setFocusable(false);
        sslPortEditField.setFocusableInTouchMode(false);
    }

    // Manage state changes to SSL toggle...

    sslToggleButton.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isEnabled) {

            // If SSL is being disabled, and the user had soft keyboard open, close it...

            if (!isEnabled) {
                InputMethodManager input = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                input.hideSoftInputFromWindow(sslPortEditField.getWindowToken(), 0);
            }

            // Set SSL state in config model accordingly...

            AppSettingsModel.enableSSL(AppSettingsActivity.this, isEnabled);

            // Enable/Disable SSL Port text field according to SSL toggle on/off state...

            sslPortEditField.setEnabled(isEnabled);
            sslPortEditField.setFocusable(isEnabled);
            sslPortEditField.setFocusableInTouchMode(isEnabled);
        }
    });

    pin.setText("...");

    final Handler pinHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            pin.setText(msg.getData().getString("pin"));
        }
    };

    new Thread() {
        public void run() {
            String pin = ORKeyPair.getInstance().getPIN(getApplicationContext());

            Bundle bundle = new Bundle();
            bundle.putString("pin", pin);

            Message msg = pinHandler.obtainMessage();
            msg.setData(bundle);

            msg.sendToTarget();
        }
    }.start();

    sslPortEditField.setOnKeyListener(new OnKeyListener() {
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            //TODO not very user friendly
            if (keyCode == KeyEvent.KEYCODE_ENTER) {
                String sslPortStr = ((EditText) v).getText().toString();

                try {
                    int sslPort = Integer.parseInt(sslPortStr.trim());
                    AppSettingsModel.setSSLPort(AppSettingsActivity.this, sslPort);
                }

                catch (NumberFormatException ex) {
                    Toast toast = Toast.makeText(getApplicationContext(), "SSL port format is not correct.", 1);
                    toast.show();

                    return false;
                }

                catch (IllegalArgumentException e) {
                    Toast toast = Toast.makeText(getApplicationContext(), e.getMessage(), 2);
                    toast.show();

                    sslPortEditField.setText("" + AppSettingsModel.getSSLPort(AppSettingsActivity.this));

                    return false;
                }
            }

            return false;
        }

    });

}

From source file:org.ntpsync.service.NtpSyncService.java

private void handleResult(final Message message) {
    Log.d(Constants.TAG, "Handle message directly in NtpSyncService...");

    // we need a looper to get toasts displayed from service!
    Handler handler = new Handler(Looper.getMainLooper());

    handler.post(new Runnable() {
        public void run() {
            DateFormat df = DateFormat.getDateTimeInstance();

            switch (message.arg1) {
            case NtpSyncService.RETURN_GENERIC_ERROR:
                Toast.makeText(getApplicationContext(),
                        getString(R.string.app_name) + ": " + getString(R.string.return_generic_error),
                        Toast.LENGTH_LONG).show();

                break;

            case NtpSyncService.RETURN_OKAY:

                Bundle returnData = message.getData();
                final Date newTime = (Date) returnData.getSerializable(NtpSyncService.MESSAGE_DATA_TIME);

                Toast.makeText(//w w  w . j  av  a  2s. co m
                        getApplicationContext(), getString(R.string.app_name) + ": "
                                + getString(R.string.return_set_time) + " " + df.format(newTime),
                        Toast.LENGTH_LONG).show();

                break;

            case NtpSyncService.RETURN_SERVER_TIMEOUT:
                Toast.makeText(getApplicationContext(),
                        getString(R.string.app_name) + ": " + getString(R.string.return_timeout),
                        Toast.LENGTH_LONG).show();

                break;

            case NtpSyncService.RETURN_NO_ROOT:
                Toast.makeText(getApplicationContext(),
                        getString(R.string.app_name) + ": " + getString(R.string.return_no_root),
                        Toast.LENGTH_LONG).show();

                break;

            default:
                break;
            }
        }
    });
}

From source file:com.cellbots.logger.LoggerActivity.java

@Override
public void onPrepareDialog(int id, Dialog dialog, Bundle bundle) {
    super.onPrepareDialog(id, dialog, bundle);

    if (id != PROGRESS_ID) {
        return;//w w  w . j a  va2  s  .  co  m
    }

    final ProgressDialog progressDialog = (ProgressDialog) dialog;
    progressDialog.setMessage("Processing...");
    final Handler handler = new Handler() {
        @Override
        public void handleMessage(android.os.Message msg) {
            int done = msg.getData().getInt("percentageDone");
            String status = msg.getData().getString("status");
            progressDialog.setProgress(done);
            progressDialog.setMessage(status);

            if (mRemoteControl != null) {
                mRemoteControl.broadcastMessage("Zipping Progress: " + done + "%\n");
            }
        }
    };

    zipperThread = new Thread() {
        @Override
        public void run() {
            if (useZip) {
                ZipItUpRequest request = new ZipItUpRequest();
                String directoryName = application.getLoggerPathPrefix();
                request.setInputFiles(new FileListFetcher().getFilesAndDirectoriesInDir(directoryName));
                request.setOutputFile(directoryName + "/logged-data.zip");
                request.setMaxOutputFileSize(MAX_OUTPUT_ZIP_CHUNK_SIZE);
                request.setDeleteInputfiles(true);
                request.setCompressionLevel(Deflater.NO_COMPRESSION);

                try {
                    new ZipItUpProcessor(request).chunkIt(handler);
                } catch (IOException e) {
                    Log.e("Oh Crap!", "IoEx", e);
                }
            }
            // closing dialog
            progressDialog.dismiss();
            application.generateNewFilePathUniqueIdentifier();

            // TODO: Need to deal with empty directories that are created if
            // another recording
            // session is never started.
            initSensorLogFiles();

            if (mCamcorderView != null) {
                try {
                    mCamcorderView.startPreview();
                    if (mRemoteControl != null)
                        mRemoteControl.broadcastMessage("*** Packaging Finished: OK to start ***\n");
                } catch (RuntimeException e) {
                    e.printStackTrace();
                    runOnUiThread(new Runnable() {
                        // @Override
                        @Override
                        public void run() {
                            Toast.makeText(getApplicationContext(),
                                    "Camera hardware error. Please restart the application.", Toast.LENGTH_LONG)
                                    .show();
                        }
                    });
                    finish();
                    return;
                }
            }
        }
    };
    zipperThread.start();
}

From source file:com.nuvolect.securesuite.main.ContactListActivity.java

/**
 * This class and method receives message commands and the message handler
 * on a separate thread. You can enter messages from any thread.
 *///from   www .j av a  2  s  .co  m
public void _handleMessage(Message msg) {

    Bundle bundle = msg.getData();
    WorkerService.WorkTask cmd = WorkerService.WorkTask.values()[msg.what];

    switch (cmd) {

    /*
     * Messages are sent from the server for each contact imported.
     */
    case IMPORT_CLOUD_CONTACTS_UPDATE: {//import_cloud

        CloudImportDialog.updateProgress(m_act, bundle);
        break;
    }
    /*
     * A final message is sent when the import is complete.
     */
    case IMPORT_CLOUD_CONTACTS_COMPLETE: {

        /**
         * Importing an account a second time sometimes hangs on account_db.beginTransaction();
         * Yet when checked, the database is not in a transaction.
         */
        String mainAccountImported = CloudImportDialog.getMainAccountImported();
        if (!mainAccountImported.isEmpty()) {

            LogUtil.log("CLA _handleMessage importedAccount: " + mainAccountImported);
            // next line hangs
            Cryp.setCurrentAccount(mainAccountImported);
            int group = MyGroups.getDefaultGroup(mainAccountImported);
            Cryp.setCurrentGroup(group);
            long contactId = MyContacts.getFirstContactInGroup(group);
            Cryp.setCurrentContact(m_act, contactId);
        }
        CloudImportDialog.complete(m_act);
        break;
    }
    case REFRESH_USER_INTERFACE: {

        if (DEBUG)
            LogUtil.log(LogType.CLA, "" + cmd + bundle);

        if (bundle.getString(CConst.UI_TYPE_KEY).contentEquals(CConst.RECREATE)) {

            m_act.recreate();//FUTURE refresh specific fragments
        } else if (DEBUG)
            LogUtil.log(LogType.CLA, "UI_TYPE_KEY no match: " + bundle.getString(CConst.UI_TYPE_KEY));
    }

    default:
        if (DEBUG)
            LogUtil.log(LogType.CLA, "_handleMessage default: " + cmd + " " + bundle);
        break;
    }
}

From source file:org.thialfihar.android.apg.ui.EditKeyActivity.java

/**
 * Handle intent action to create new key
 *
 * @param intent//  ww w. j a v  a2 s . c  o  m
 */
private void handleActionCreateKey(Intent intent) {
    Bundle extras = intent.getExtras();

    mCurrentPassphrase = "";
    mIsBrandNewKeyring = true;

    if (extras != null) {
        // if userId is given, prefill the fields
        if (extras.containsKey(EXTRA_USER_IDS)) {
            Log.d(Constants.TAG, "UserIds are given!");
            mUserIds.add(extras.getString(EXTRA_USER_IDS));
        }

        // if no passphrase is given
        if (extras.containsKey(EXTRA_NO_PASSPHRASE)) {
            boolean noPassphrase = extras.getBoolean(EXTRA_NO_PASSPHRASE);
            if (noPassphrase) {
                // check "no passphrase" checkbox and remove button
                mNoPassphrase.setChecked(true);
                mChangePassphrase.setVisibility(View.GONE);
            }
        }

        // generate key
        if (extras.containsKey(EXTRA_GENERATE_DEFAULT_KEYS)) {
            boolean generateDefaultKeys = extras.getBoolean(EXTRA_GENERATE_DEFAULT_KEYS);
            if (generateDefaultKeys) {

                // Send all information needed to service generate keys in other thread
                final Intent serviceIntent = new Intent(this, ApgIntentService.class);
                serviceIntent.setAction(ApgIntentService.ACTION_GENERATE_DEFAULT_RSA_KEYS);

                // fill values for this action
                Bundle data = new Bundle();
                data.putString(ApgIntentService.GENERATE_KEY_SYMMETRIC_PASSPHRASE, mCurrentPassphrase);

                serviceIntent.putExtra(ApgIntentService.EXTRA_DATA, data);

                // Message is received after generating is done in ApgIntentService
                ApgIntentServiceHandler saveHandler = new ApgIntentServiceHandler(this,
                        getResources().getQuantityString(R.plurals.progress_generating, 1),
                        ProgressDialog.STYLE_HORIZONTAL, true,

                        new DialogInterface.OnCancelListener() {
                            @Override
                            public void onCancel(DialogInterface dialog) {
                                // Stop key generation on cancel
                                stopService(serviceIntent);
                                EditKeyActivity.this.setResult(Activity.RESULT_CANCELED);
                                EditKeyActivity.this.finish();
                            }
                        }) {

                    @Override
                    public void handleMessage(Message message) {
                        // handle messages by standard ApgIntentServiceHandler first
                        super.handleMessage(message);

                        if (message.arg1 == ApgIntentServiceHandler.MESSAGE_OKAY) {
                            // get new key from data bundle returned from service
                            Bundle data = message.getData();

                            ArrayList<PGPSecretKey> newKeys = PgpConversionHelper.BytesToPGPSecretKeyList(
                                    data.getByteArray(ApgIntentService.RESULT_NEW_KEY));

                            ArrayList<Integer> keyUsageFlags = data
                                    .getIntegerArrayList(ApgIntentService.RESULT_KEY_USAGES);

                            if (newKeys.size() == keyUsageFlags.size()) {
                                for (int i = 0; i < newKeys.size(); ++i) {
                                    mKeys.add(newKeys.get(i));
                                    mKeysUsages.add(keyUsageFlags.get(i));
                                }
                            }

                            buildLayout(true);
                        }
                    }
                };

                // Create a new Messenger for the communication back
                Messenger messenger = new Messenger(saveHandler);
                serviceIntent.putExtra(ApgIntentService.EXTRA_MESSENGER, messenger);

                saveHandler.showProgressDialog(this);

                // start service with intent
                startService(serviceIntent);
            }
        }
    } else {
        buildLayout(false);
    }
}

From source file:org.sufficientlysecure.keychain.ui.keyview.ViewKeyActivity.java

private void changePassword() {
    CryptoOperationHelper.Callback<ChangeUnlockParcel, EditKeyResult> editKeyCallback = new CryptoOperationHelper.Callback<ChangeUnlockParcel, EditKeyResult>() {
        @Override//ww  w .  j  a  v a  2  s. c om
        public ChangeUnlockParcel createOperationInput() {
            return mChangeUnlockParcel;
        }

        @Override
        public void onCryptoOperationSuccess(EditKeyResult result) {
            displayResult(result);
        }

        @Override
        public void onCryptoOperationCancelled() {

        }

        @Override
        public void onCryptoOperationError(EditKeyResult result) {
            displayResult(result);
        }

        @Override
        public boolean onCryptoSetProgress(String msg, int progress, int max) {
            return false;
        }
    };

    mEditOpHelper = new CryptoOperationHelper<>(2, this, editKeyCallback, R.string.progress_building_key);

    // Message is received after passphrase is cached
    Handler returnHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            if (message.what == SetPassphraseDialogFragment.MESSAGE_OKAY) {
                Bundle data = message.getData();

                // use new passphrase!
                mChangeUnlockParcel = ChangeUnlockParcel.createChangeUnlockParcel(mMasterKeyId, mFingerprint,
                        (Passphrase) data.getParcelable(SetPassphraseDialogFragment.MESSAGE_NEW_PASSPHRASE));

                mEditOpHelper.cryptoOperation();
            }
        }
    };

    // Create a new Messenger for the communication back
    Messenger messenger = new Messenger(returnHandler);

    SetPassphraseDialogFragment setPassphraseDialog = SetPassphraseDialogFragment.newInstance(messenger,
            R.string.title_change_passphrase);

    setPassphraseDialog.show(getSupportFragmentManager(), "setPassphraseDialog");
}

From source file:org.sufficientlysecure.keychain.ui.EditKeyActivity.java

/**
 * Handle intent action to create new key
 *
 * @param intent/*  w  w  w .  j a  v a 2s . c o m*/
 */
private void handleActionCreateKey(Intent intent) {
    Bundle extras = intent.getExtras();

    mCurrentPassphrase = "";
    mIsBrandNewKeyring = true;

    if (extras != null) {
        // if userId is given, prefill the fields
        if (extras.containsKey(EXTRA_USER_IDS)) {
            Log.d(Constants.TAG, "UserIds are given!");
            mUserIds.add(extras.getString(EXTRA_USER_IDS));
        }

        // if no passphrase is given
        if (extras.containsKey(EXTRA_NO_PASSPHRASE)) {
            boolean noPassphrase = extras.getBoolean(EXTRA_NO_PASSPHRASE);
            if (noPassphrase) {
                // check "no passphrase" checkbox and remove button
                mNoPassphrase.setChecked(true);
                mChangePassphrase.setVisibility(View.GONE);
            }
        }

        // generate key
        if (extras.containsKey(EXTRA_GENERATE_DEFAULT_KEYS)) {
            boolean generateDefaultKeys = extras.getBoolean(EXTRA_GENERATE_DEFAULT_KEYS);
            if (generateDefaultKeys) {

                // Send all information needed to service generate keys in other thread
                final Intent serviceIntent = new Intent(this, KeychainIntentService.class);
                serviceIntent.setAction(KeychainIntentService.ACTION_GENERATE_DEFAULT_RSA_KEYS);

                // fill values for this action
                Bundle data = new Bundle();
                data.putString(KeychainIntentService.GENERATE_KEY_SYMMETRIC_PASSPHRASE, mCurrentPassphrase);

                serviceIntent.putExtra(KeychainIntentService.EXTRA_DATA, data);

                // Message is received after generating is done in KeychainIntentService
                KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this,
                        getResources().getQuantityString(R.plurals.progress_generating, 1),
                        ProgressDialog.STYLE_HORIZONTAL, true,

                        new DialogInterface.OnCancelListener() {
                            @Override
                            public void onCancel(DialogInterface dialog) {
                                // Stop key generation on cancel
                                stopService(serviceIntent);
                                EditKeyActivity.this.setResult(Activity.RESULT_CANCELED);
                                EditKeyActivity.this.finish();
                            }
                        }) {

                    @Override
                    public void handleMessage(Message message) {
                        // handle messages by standard KeychainIntentServiceHandler first
                        super.handleMessage(message);

                        if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
                            // get new key from data bundle returned from service
                            Bundle data = message.getData();

                            ArrayList<UncachedSecretKey> newKeys = PgpConversionHelper.BytesToPGPSecretKeyList(
                                    data.getByteArray(KeychainIntentService.RESULT_NEW_KEY));

                            ArrayList<Integer> keyUsageFlags = data
                                    .getIntegerArrayList(KeychainIntentService.RESULT_KEY_USAGES);

                            if (newKeys.size() == keyUsageFlags.size()) {
                                for (int i = 0; i < newKeys.size(); ++i) {
                                    mKeys.add(newKeys.get(i));
                                    mKeysUsages.add(keyUsageFlags.get(i));
                                }
                            }

                            buildLayout(true);
                        }
                    }
                };

                // Create a new Messenger for the communication back
                Messenger messenger = new Messenger(saveHandler);
                serviceIntent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger);

                saveHandler.showProgressDialog(this);

                // start service with intent
                startService(serviceIntent);
            }
        }
    } else {
        buildLayout(false);
    }
}

From source file:com.nbplus.vbroadlauncher.BroadcastWebViewActivity.java

public void handleMessage(Message msg) {
    if (msg == null) {
        return;//  w w  w  .  j  ava 2  s .c  om
    }
    switch (msg.what) {
    case HANDLER_MESSAGE_BROWSER_ACTIVITY_CLOSE:
        if (mWebViewClient != null && !mWebViewClient.isClosingByWebApp()) {
            mWebViewClient.onCloseWebApplicationByUser();
        }
        break;
    case HANDLER_MESSAGE_UPDATE_IOT_DEVICE_LIST:
        VBroadcastServer serverInfo = LauncherSettings.getInstance(this).getServerInformation();
        if (serverInfo == null || StringUtils.isEmptyString(serverInfo.getApiServer())) {
            Log.e(TAG, "API server domain is not found !!!");
            return;
        }
        SendIoTDeviceListTask task = new SendIoTDeviceListTask();
        if (task != null) {
            Bundle extras = msg.getData();
            IoTDevicesData data = extras.getParcelable("data");

            task.setBroadcastApiData(this, mHandler,
                    serverInfo.getApiServer() + Constants.API_IOT_UPDATE_DEVICE_LIST, data);
            task.execute();
        }
        break;
    case Constants.HANDLER_MESSAGE_SEND_IOT_DEVICE_LIST_COMPLETE_TASK:
        BaseApiResult result = (BaseApiResult) msg.obj;
        Log.d(TAG, "Device list reg result = " + result.getResultCode());
        if (result != null) {
            if (!StringUtils.isEmptyString(result.getResultCode())) {
                Bundle b = (Bundle) result.getObject();
                IoTDevicesData data = b.getParcelable("data");
                IoTInterface.getInstance().updateBondedWithServerDeviceList(data.getIotDevices());
                mWebViewClient.onUpdateIoTDevices(result.getResultCode());
            } else {
                mWebViewClient.onUpdateIoTDevices("1000"); // Open API .
            }
        }
        break;
    }
}