Example usage for android.os RemoteException printStackTrace

List of usage examples for android.os RemoteException printStackTrace

Introduction

In this page you can find the example usage for android.os RemoteException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:ch.nexuscomputing.android.osciprimeics.OsciPrimeService.java

@Override
public void onSourceSamples(int[] ch1, int[] ch2, int[] previewCh1, int[] previewCh2, int len, int found,
        float offch1, float offch2) {
    if (mCalibrateNextTime.get()) {
        L.d("calibrating");
        mApplication.getActiveCalibration().getCh1Offsets()[mApplication.pAttenuationSettingCh1] = offch1;
        mApplication.getActiveCalibration().getCh2Offsets()[mApplication.pAttenuationSettingCh2] = offch2;
    }/*w  w w.  j  a va2  s  .c  o  m*/
    mCalibrateNextTime.set(false);
    mApplication.copyData(ch1, ch2, previewCh1, previewCh2, found);
    if (mNetworkSink != null) {
        mNetworkSink.onSamples(ch1, ch2, found);
    }
    if (mApplication.pMode == OsciPrimeApplication.MODE_SINGLESHOT && found >= 0) {
        if (mState == RUNNING)// resample?
            mState = TERMINATING;// like when STOP message is received by
                                 // the
                                 // messenger
        stop();
    }
    if (mActivityMessenger != null) {
        try {
            mActivityMessenger.send(Message.obtain(null, OsciPrimeICSActivity.SAMPLES));
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    Stats.stat(mApplication);
}

From source file:com.ds.owl.dsdormitory.RecoBackgroundRangingService.java

private void startRangingWithRegion(RECOBeaconRegion region) {
    Log.i("BackRangingService", "startRangingWithRegion()");

    try {/*from  w w w  .j  av  a  2s  .  c o  m*/
        mRecoManager.startRangingBeaconsInRegion(region);
    } catch (RemoteException e) {
        Log.e("BackRangingService",
                "RemoteException has occured while executing RECOManager.startRangingBeaconsInRegion()");
        e.printStackTrace();
    } catch (NullPointerException e) {
        Log.e("BackRangingService",
                "NullPointerException has occured while executing RECOManager.startRangingBeaconsInRegion()");
        e.printStackTrace();
    }
}

From source file:com.example.kbpark.kbbeacon.RecoBackgroundRangingService.java

private void startMonitoring() {
    Log.i("BackRangingService", "startMonitoring()");

    mRecoManager.setScanPeriod(this.mScanDuration);
    mRecoManager.setSleepPeriod(this.mSleepDuration);

    for (RECOBeaconRegion region : mRegions) {
        try {/*from w  ww  .j  av a  2s .  c  o m*/
            mRecoManager.startMonitoringForRegion(region); // monitoring call back   .
        } catch (RemoteException e) {
            Log.e("BackRangingService",
                    "RemoteException has occured while executing RECOManager.startMonitoringForRegion()");
            e.printStackTrace();
        } catch (NullPointerException e) {
            Log.e("BackRangingService",
                    "NullPointerException has occured while executing RECOManager.startMonitoringForRegion()");
            e.printStackTrace();
        }
    }
}

From source file:ch.ethz.coss.nervousnet.sample.SampleAppActivity.java

protected void update() {
    try {/*from  w w  w. jav  a 2s .  c  om*/
        int index = vPager.getCurrentItem();
        Log.d("SampleAppActivity", "Inside update : index  = " + index);

        switch (index) {
        case 0:
            updateStatus((SensorReading) mService.getAccelerometerReading(), index);
            break;
        case 1:
            updateStatus((SensorReading) mService.getBatteryReading(), index);
            break;
        case 2:
            // beacons
            break;
        case 3:
            updateStatus((SensorReading) mService.getConnectivityReading(), index);
            break;
        case 4:
            updateStatus((SensorReading) mService.getGyroReading(), index);
            break;
        case 5:
            // HUmidity
            break;
        case 6:
            updateStatus((SensorReading) mService.getLocationReading(), index);
            break;
        case 7:
            updateStatus((SensorReading) mService.getLightReading(), index);
            break;
        case 8:
            // Magnetic
            break;
        case 9:
            updateStatus((SensorReading) mService.getNoiseReading(), index);
            break;

        }

        vPager.getAdapter().notifyDataSetChanged();

    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:com.drinviewer.droiddrinviewer.ServerListFragment.java

/**
 * Connection to the DiscoverServerService
 * Method that implements the ServiceConnection
 */// w w  w.j a v a  2  s. c  om
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
    // that's how we get the client side of the IPC connection
    if (discoverServerApi == null) {
        discoverServerApi = DiscoverServerApi.Stub.asInterface(service);

        try {
            if (discoverServerApi.isRunning()) {
                /**
                 *  if the service is doing a discovery, just set the
                 *  discoverServerProgress visibility to visible. 
                 *  The service will call the listener when it has finished
                 */
                if (mustUpdateUI && mActivity != null) {
                    mActivity.getMessageHandler().sendEmptyMessage(DroidDrinViewerConstants.MSG_DISCOVER_START);
                }
            } else {
                /**
                 *  sends a message to the DrinViewerBroadcastReceiver to start the discovery repeat
                 *  this fires an immediate discovery, so there's no need to call the doDiscover method
                 */
                Intent i = new Intent(mActivity.getBaseContext(), DrinViewerBroadcastReceiver.class);
                i.setAction(getResources().getString(R.string.broadcast_startalarmrepeater));
                i.putExtra("forcegetbroadcast", true);
                mActivity.sendBroadcast(i);
            }

            discoverServerApi.addListener(hostUpdatedListener);

        } catch (RemoteException e) {
            // ignore
            e.printStackTrace();
        }
    }
}

From source file:com.renard.ocr.OCRActivity.java

private void saveDocument(final Pix pix, final String hocrString, final String utf8String,
        final boolean checkSd) {
    //      if (checkSd && !Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
    //         waitForSdCard(pix, hocrString, utf8String);
    //      } else {

    Util.startBackgroundJob(OCRActivity.this, "", getText(R.string.saving_document).toString(), new Runnable() {

        @Override//w ww .j av a 2  s  . c  o m
        public void run() {
            File imageFile = null;
            Uri documentUri = null;
            try {
                if (checkSd) {
                    imageFile = saveImage(pix);
                }
                documentUri = saveDocumentToDB(imageFile, hocrString, utf8String);
                Util.createThumbnail(OCRActivity.this, imageFile,
                        Integer.valueOf(documentUri.getLastPathSegment()));
            } catch (RemoteException e) {
                e.printStackTrace();
                Log.e(TAG, e.getMessage());
                e.printStackTrace();
                runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        Toast.makeText(getApplicationContext(), getText(R.string.error_create_file),
                                Toast.LENGTH_LONG).show();
                    }
                });
            } catch (IOException e) {
                e.printStackTrace();
                Log.e(TAG, e.getMessage());
                runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        Toast.makeText(getApplicationContext(), getText(R.string.error_create_file),
                                Toast.LENGTH_LONG).show();
                    }
                });
            } finally {
                if (pix != null) {
                    pix.recycle();
                }
                if (documentUri != null) {
                    Intent i = new Intent(OCRActivity.this, DocumentActivity.class);
                    i.putExtra(DocumentActivity.EXTRA_ASK_FOR_TITLE, true);
                    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    i.setData(documentUri);
                    startActivity(i);
                    finish();
                }
            }
        }
    }, new Handler());
    //   }

}

From source file:com.a3did.partner.recosample.RecoBackgroundRangingService.java

private void startRangingWithRegion(RECOBeaconRegion region) {
    Log.i("BackRangingService", "startRangingWithRegion()");

    /**//from  w  w w .ja  v  a2s .c o m
     * There is a known android bug that some android devices scan BLE devices only once. (link: http://code.google.com/p/android/issues/detail?id=65863)
     * To resolve the bug in our SDK, you can use setDiscontinuousScan() method of the RECOBeaconManager.
     * This method is to set whether the device scans BLE devices continuously or discontinuously.
     * The default is set as FALSE. Please set TRUE only for specific devices.
     *
     * mRecoManager.setDiscontinuousScan(true);
     */

    try {
        mRecoManager.startRangingBeaconsInRegion(region);
    } catch (RemoteException e) {
        Log.e("BackRangingService",
                "RemoteException has occured while executing RECOManager.startRangingBeaconsInRegion()");
        e.printStackTrace();
    } catch (NullPointerException e) {
        Log.e("BackRangingService",
                "NullPointerException has occured while executing RECOManager.startRangingBeaconsInRegion()");
        e.printStackTrace();
    }
}

From source file:com.ds.owl.dsdormitory.RecoBackgroundRangingService.java

private void stopMonitoring() {
    Log.i("BackRangingService", "stopMonitoring()");

    for (RECOBeaconRegion region : mRegions) {
        try {//from   www.j  a v a2  s . c om
            mRecoManager.stopMonitoringForRegion(region);
        } catch (RemoteException e) {
            Log.e("BackRangingService",
                    "RemoteException has occured while executing RECOManager.stopMonitoringForRegion()");
            e.printStackTrace();
        } catch (NullPointerException e) {
            Log.e("BackRangingService",
                    "NullPointerException has occured while executing RECOManager.stopMonitoringForRegion()");
            e.printStackTrace();
        }
    }
}

From source file:me.henrytao.smoothappbarlayoutdemo.activity.BaseActivity.java

private void requestItemsForPurchase(final AsyncCallback<List<PurchaseItem>> callback) {
    if (mPurchaseItems != null && mPurchaseItems.size() > 0) {
        if (callback != null) {
            callback.onSuccess(mPurchaseItems);
        }/*  ww w  .j  a v a2  s  . c  om*/
        return;
    }
    new AsyncTask<IInAppBillingService, Void, AsyncResult<List<PurchaseItem>>>() {

        @Override
        protected AsyncResult<List<PurchaseItem>> doInBackground(IInAppBillingService... params) {
            List<PurchaseItem> result = new ArrayList<>();
            Throwable exception = null;
            IInAppBillingService billingService = params[0];

            if (billingService == null) {
                exception = new Exception("Unknow");
            } else {
                ArrayList<String> skuList = new ArrayList<>(Arrays.asList(DONATE_ITEMS));
                Bundle querySkus = new Bundle();
                querySkus.putStringArrayList("ITEM_ID_LIST", skuList);
                try {
                    Bundle skuDetails = billingService.getSkuDetails(3, getPackageName(), "inapp", querySkus);
                    int response = skuDetails.getInt("RESPONSE_CODE");
                    if (response == 0) {
                        ArrayList<String> responseList = skuDetails.getStringArrayList("DETAILS_LIST");
                        PurchaseItem purchaseItem;
                        for (String item : responseList) {
                            purchaseItem = new PurchaseItem(new JSONObject(item));
                            if (purchaseItem.isValid()) {
                                result.add(purchaseItem);
                            }
                        }
                    }
                } catch (RemoteException e) {
                    e.printStackTrace();
                    exception = e;
                } catch (JSONException e) {
                    e.printStackTrace();
                    exception = e;
                }
            }
            return new AsyncResult<>(result, exception);
        }

        @Override
        protected void onPostExecute(AsyncResult<List<PurchaseItem>> result) {
            if (!isFinishing() && callback != null) {
                Throwable error = result.getError();
                if (error == null && (result.getResult() == null || result.getResult().size() == 0)) {
                    error = new Exception("Unknow");
                }
                if (error != null) {
                    callback.onError(error);
                } else {
                    mPurchaseItems = result.getResult();
                    Collections.sort(mPurchaseItems, new Comparator<PurchaseItem>() {
                        @Override
                        public int compare(PurchaseItem lhs, PurchaseItem rhs) {
                            return (int) ((lhs.getPriceAmountMicros() - rhs.getPriceAmountMicros()) / 1000);
                        }
                    });
                    callback.onSuccess(mPurchaseItems);
                }
            }
        }
    }.execute(mBillingService);
}

From source file:com.github.michalbednarski.intentslab.editor.BundleAdapter.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    final AdapterView.AdapterContextMenuInfo aMenuInfo = (AdapterView.AdapterContextMenuInfo) menuInfo;
    if (aMenuInfo.position == mKeysCount) {
        return;//from   w  ww .  j a v a 2s  .c o m
    }
    menu.add(mOwnerFragment.getString(R.string.delete))
            .setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                @Override
                public boolean onMenuItemClick(MenuItem item) {
                    final String key = mKeys[aMenuInfo.position];
                    if (mUseSandbox) {
                        try {
                            mSandboxedBundle.remove(key);
                        } catch (RemoteException e) {
                            e.printStackTrace(); // TODO: resandbox bundle
                        }
                    } else {
                        mBundle.remove(key);
                    }
                    updateKeySet();
                    notifyDataSetChanged();
                    return true;
                }
            });
}