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:org.videolan.vlc.MediaService.java

private void executeUpdate(Boolean updateWidget) {
    for (IMediaServiceCallback callback : mCallback.keySet()) {
        try {/*w  w w.  j  a  va  2s  . c o  m*/
            callback.update();
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
    if (updateWidget)
        updateWidget(this);
}

From source file:com.cdvdev.subscriptiondemo.helpers.IabHelper.java

/**
 * Setup in-app billing//from  ww w .ja va  2 s .c  o  m
 */
public void startSetup(final OnIabSetupFinishListener finishListener) {
    logDebug("Starting in-app billing setup.");
    checkNotDisposed();
    // If already set up, can't do it again.
    if (mSetupDone)
        throw new IllegalStateException("IAB helper is already set up.");

    // Binding to IInAppBillingService
    mServiceConnection = new ServiceConnection() {
        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            if (mDisposed)
                return;
            logDebug("Billing service connected.");
            mIInAppBillingService = IInAppBillingService.Stub.asInterface(service);
            String packageName = mContext.getPackageName();

            try {
                logDebug("Checking for in-app billing 3 support.");
                //check for in-app billing v3 support
                int response = mIInAppBillingService.isBillingSupported(3, packageName, ITEM_TYPE_INAPP);
                if (response != BILLING_RESPONSE_RESULT_OK) {
                    if (finishListener != null) {
                        finishListener.onIabSetupFinished(
                                new IabResult(response, "Error checking for billing v3 support."));
                    }

                    // if in-app purchases aren't supported, neither are subscriptions
                    mSubscriptionsSupported = false;
                    mSubscriptionUpdateSupported = false;
                    return;
                } else {
                    logDebug("In-app billing version 3 supported for " + packageName);
                }

                // Check for v5 subscriptions support. This is needed for
                // getBuyIntentToReplaceSku which allows for subscription update
                response = mIInAppBillingService.isBillingSupported(5, packageName, ITEM_TYPE_SUBS);
                if (response == BILLING_RESPONSE_RESULT_OK) {
                    logDebug("Subscription re-signup AVAILABLE.");
                    mSubscriptionUpdateSupported = true;
                } else {
                    logDebug("Subscription re-signup not available.");
                    mSubscriptionUpdateSupported = false;
                }

                if (mSubscriptionUpdateSupported) {
                    mSubscriptionsSupported = true;
                } else {
                    // check for v3 subscriptions support
                    response = mIInAppBillingService.isBillingSupported(3, packageName, ITEM_TYPE_SUBS);
                    if (response == BILLING_RESPONSE_RESULT_OK) {
                        logDebug("Subscriptions AVAILABLE.");
                        mSubscriptionsSupported = true;
                    } else {
                        logDebug("Subscriptions NOT AVAILABLE. Response: " + response);
                        mSubscriptionsSupported = false;
                        mSubscriptionUpdateSupported = false;
                    }
                }

                mSetupDone = true;

            } catch (RemoteException e) {
                if (finishListener != null) {
                    finishListener.onIabSetupFinished(new IabResult(IABHELPER_REMOTE_EXCEPTION,
                            "RemoteException while setting up in-app billing."));
                }
                e.printStackTrace();
                return;
            }

            if (finishListener != null) {
                finishListener
                        .onIabSetupFinished(new IabResult(BILLING_RESPONSE_RESULT_OK, "Setup successful."));
            }
        }

        @Override
        public void onServiceDisconnected(ComponentName name) {
            logDebug("Billing service disconnected.");
            mIInAppBillingService = null;
        }
    };

    //create service
    Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
    serviceIntent.setPackage("com.android.vending");
    if (!mContext.getPackageManager().queryIntentServices(serviceIntent, 0).isEmpty()) {
        mContext.bindService(serviceIntent, mServiceConnection, Context.BIND_AUTO_CREATE);
    } else {
        // no service available to handle that Intent
        if (finishListener != null) {
            finishListener.onIabSetupFinished(new IabResult(BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE,
                    "Billing service unavailable on device."));
        }
    }

}

From source file:com.hexypixel.hexyplugin.IabHelper.java

public void startSetup(final OnIabSetupFinishedListener listener, int market) {
    // If already set up, can't do it again.
    checkNotDisposed();//from  www .j  a va2s .co m
    if (mSetupDone)
        throw new IllegalStateException("IAB helper is already set up.");

    // Connection to IAB service
    logDebug("Starting in-app billing setup.");
    mServiceConn = new ServiceConnection() {
        @Override
        public void onServiceDisconnected(ComponentName name) {
            logDebug("Billing service disconnected.");
            mService = null;
        }

        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            if (mDisposed)
                return;
            logDebug("Billing service connected.");
            mService = IInAppBillingService.Stub.asInterface(service);
            String packageName = mContext.getPackageName();
            try {
                logDebug("Checking for in-app billing 3 support.");

                // check for in-app billing v3 support
                int response = mService.isBillingSupported(3, packageName, ITEM_TYPE_INAPP);
                if (response != BILLING_RESPONSE_RESULT_OK) {
                    if (listener != null)
                        listener.onIabSetupFinished(
                                new IabResult(response, "Error checking for billing v3 support."));

                    // if in-app purchases aren't supported, neither are subscriptions.
                    mSubscriptionsSupported = false;
                    return;
                }
                logDebug("In-app billing version 3 supported for " + packageName);

                // check for v3 subscriptions support
                response = mService.isBillingSupported(3, packageName, ITEM_TYPE_SUBS);
                if (response == BILLING_RESPONSE_RESULT_OK) {
                    logDebug("Subscriptions AVAILABLE.");
                    mSubscriptionsSupported = true;
                } else {
                    logDebug("Subscriptions NOT AVAILABLE. Response: " + response);
                }

                mSetupDone = true;
            } catch (RemoteException e) {
                if (listener != null) {
                    listener.onIabSetupFinished(new IabResult(IABHELPER_REMOTE_EXCEPTION,
                            "RemoteException while setting up in-app billing."));
                }
                e.printStackTrace();
                return;
            }

            if (listener != null) {
                listener.onIabSetupFinished(new IabResult(BILLING_RESPONSE_RESULT_OK, "Setup successful."));
            }
        }
    };

    Intent serviceIntent = new Intent(getMarketAction(market));
    serviceIntent.setPackage(getMarketNamespace(market));
    if (!mContext.getPackageManager().queryIntentServices(serviceIntent, 0).isEmpty()) {
        // service available to handle that Intent
        mContext.bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE);
    } else {
        // no service available to handle that Intent
        if (listener != null) {
            listener.onIabSetupFinished(new IabResult(BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE,
                    "Billing service unavailable on device."));
        }
    }
}

From source file:me.trashout.fragment.DashboardFragment.java

private void setHunterMode(boolean hunterMode, long durationTime, long huntingTime) {
    this.hunterMode = hunterMode;

    if (this.hunterMode) {
        startHuntingMode(durationTime, huntingTime);
        dashboardTrashHunterOnLayout.setVisibility(View.VISIBLE);
        dashboardTrashHunterBtn.setText(R.string.trashHunter_stopHunting);
        dashboardTrashHunterTitleDescription.setText(R.string.trashHunter_turnedOnInfo);
    } else {//from  ww  w . j  a  v  a  2  s. com
        dashboardTrashHunterOnLayout.setVisibility(View.GONE);
        dashboardTrashHunterBtn.setText(R.string.trashHunter_startHunting);
        dashboardTrashHunterTitleDescription.setText(R.string.trashHunter_text);

        if (countDownTimer != null) {
            countDownTimer.cancel();
            countDownTimer = null;
        }

        if (mTrashHunterBound) {
            try {
                mService.removeOnTrashHunterChangeListener(onTrashHunterChangeListener);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
            getActivity().unbindService(svcConn);
            mTrashHunterBound = false;
        }

        Intent i = new Intent(getContext(), TrashHunterService.class);
        getActivity().stopService(i);

        PreferencesHandler.setTrashHunterState(getContext(), null);
    }
}

From source file:org.videolan.myvlc.core.mediaController.AudioService.java

private synchronized void loadLastPlaylist() {
    if (!Util.hasExternalStorage())
        return;/*  w  w  w  .ja va  2s .  c o m*/

    String line;
    FileInputStream input;
    BufferedReader br;
    int rowCount = 0;

    int position = 0;
    String currentMedia;
    List<String> mediaPathList = new ArrayList<String>();

    try {
        // read CurrentMedia
        //            input = new FileInputStream(AudioUtil.CACHE_DIR + "/" + "CurrentMedia.txt");
        //            br = new BufferedReader(new InputStreamReader(input));
        //            currentMedia = br.readLine();
        //            mShuffling = "1".equals(br.readLine());
        //            br.close();
        //            input.close();
        //
        //            // read MediaList
        //            input = new FileInputStream(AudioUtil.CACHE_DIR + "/" + "MediaList.txt");
        //            br = new BufferedReader(new InputStreamReader(input));
        //            while ((line = br.readLine()) != null) {
        //                mediaPathList.add(line);
        //                if (line.equals(currentMedia))
        //                    position = rowCount;
        //                rowCount++;
        //            }
        //            br.close();
        //            input.close();

        // load playlist
        mInterface.load(mediaPathList, position, false, false);
        //        } catch (IOException e) {
        //            e.printStackTrace();
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}

From source file:se.springworks.android.utils.iab.IabHelper.java

@Override
public void startSetup(final OnIabSetupFinishedListener listener) {
    // If already set up, can't do it again.
    checkNotDisposed();//from   w ww  .  jav  a2s.co m
    if (mSetupDone) {
        //         throw new IllegalStateException("IAB helper is already set up.");         
        if (listener != null) {
            listener.onIabSetupFinished(new IabResult(BILLING_RESPONSE_RESULT_OK, "Setup successful."));
        }
        return;
    }

    // Connection to IAB service
    logDebug("Starting in-app billing setup.");
    mServiceConn = new ServiceConnection() {
        @Override
        public void onServiceDisconnected(ComponentName name) {
            logDebug("Billing service disconnected.");
            mService = null;
        }

        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            logDebug("Billing service connected.");
            mService = IInAppBillingService.Stub.asInterface(service);
            String packageName = mContext.getPackageName();
            try {
                logDebug("Checking for in-app billing 3 support.");

                // check for in-app billing v3 support
                int response = mService.isBillingSupported(3, packageName, ITEM_TYPE_INAPP);
                if (response != BILLING_RESPONSE_RESULT_OK) {
                    if (listener != null)
                        listener.onIabSetupFinished(
                                new IabResult(response, "Error checking for billing v3 support."));

                    // if in-app purchases aren't supported, neither are
                    // subscriptions.
                    mSubscriptionsSupported = false;
                    return;
                }
                logDebug("In-app billing version 3 supported for " + packageName);

                // check for v3 subscriptions support
                response = mService.isBillingSupported(3, packageName, ITEM_TYPE_SUBS);
                if (response == BILLING_RESPONSE_RESULT_OK) {
                    logDebug("Subscriptions AVAILABLE.");
                    mSubscriptionsSupported = true;
                } else {
                    logDebug("Subscriptions NOT AVAILABLE. Response: " + response);
                }

                mSetupDone = true;
            } catch (RemoteException e) {
                if (listener != null) {
                    listener.onIabSetupFinished(new IabResult(IABHELPER_REMOTE_EXCEPTION,
                            "RemoteException while setting up in-app billing."));
                }
                e.printStackTrace();
                return;
            }

            if (listener != null) {
                listener.onIabSetupFinished(new IabResult(BILLING_RESPONSE_RESULT_OK, "Setup successful."));
            }
        }
    };

    Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
    serviceIntent.setPackage("com.android.vending");
    if (!mContext.getPackageManager().queryIntentServices(serviceIntent, 0).isEmpty()) {
        // service available to handle that Intent
        mContext.bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE);
    } else {
        // no service available to handle that Intent
        if (listener != null) {
            listener.onIabSetupFinished(new IabResult(BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE,
                    "Billing service unavailable on device."));
        }
    }
}

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

private synchronized void handleIntents() {
    if (getIntent() == null)
        return;/*from w ww  .ja  v a 2 s .c om*/

    // Get intent, action and MIME type
    Intent intent = getIntent();
    String action = intent.getAction();
    String type = intent.getType();

    if (action == null)
        return;

    if (action.equals("org.torproject.android.REQUEST_HS_PORT")) {

        DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {

            public void onClick(DialogInterface dialog, int which) {
                switch (which) {
                case DialogInterface.BUTTON_POSITIVE:

                    int hsPort = getIntent().getIntExtra("hs_port", -1);

                    enableHiddenServicePort(hsPort);

                    finish();

                    break;

                case DialogInterface.BUTTON_NEGATIVE:
                    //No button clicked
                    finish();
                    break;
                }
            }
        };

        int hsPort = getIntent().getIntExtra("hs_port", -1);

        String requestMsg = getString(R.string.hidden_service_request, hsPort);
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(requestMsg).setPositiveButton("Allow", dialogClickListener)
                .setNegativeButton("Deny", dialogClickListener).show();

    } else if (action.equals("org.torproject.android.START_TOR")) {
        autoStartFromIntent = true;

        try {
            startTor();

            Intent nResult = new Intent();

            //nResult.putExtra("socks", ); //TODO respond with socks, transport, dns, etc

            setResult(RESULT_OK, nResult);

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

    } else if (action.equals(Intent.ACTION_VIEW)) {
        String urlString = intent.getDataString();

        if (urlString != null) {

            if (urlString.toLowerCase().startsWith("bridge://"))

            {
                String newBridgeValue = urlString.substring(9); //remove the bridge protocol piece
                newBridgeValue = URLDecoder.decode(newBridgeValue); //decode the value here

                showAlert("Bridges Updated", "Restart Orbot to use this bridge: " + newBridgeValue, false);

                String bridges = mPrefs.getString(TorConstants.PREF_BRIDGES_LIST, null);

                Editor pEdit = mPrefs.edit();

                if (bridges != null && bridges.trim().length() > 0) {
                    if (bridges.indexOf('\n') != -1)
                        bridges += '\n' + newBridgeValue;
                    else
                        bridges += ',' + newBridgeValue;
                } else
                    bridges = newBridgeValue;

                pEdit.putString(TorConstants.PREF_BRIDGES_LIST, bridges); //set the string to a preference
                pEdit.putBoolean(TorConstants.PREF_BRIDGES_ENABLED, true);

                pEdit.commit();

                setResult(RESULT_OK);
            }
        }
    } else {

        showWizard = mPrefs.getBoolean("show_wizard", showWizard);

        if (showWizard) {
            Editor pEdit = mPrefs.edit();
            pEdit.putBoolean("show_wizard", false);
            pEdit.commit();
            showWizard = false;

            startActivity(new Intent(this, ChooseLocaleWizardActivity.class));

        }

    }

    setIntent(null);

    updateStatus("");

}

From source file:net.sourceforge.servestream.activity.MediaPlayerActivity.java

private void setPager() {
    if (mService == null) {
        return;//from  w  w w  .j  a v a 2  s .  c o m
    }

    try {
        int position = mService.getQueuePosition() + 1;
        mPager.setCurrentItem(position, false);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}

From source file:com.welmo.andengine.utility.inappbilling.IabHelper.java

/**
 * Starts the setup process. This will start up the setup process asynchronously.
 * You will be notified through the listener when the setup process is complete.
 * This method is safe to call from a UI thread.
 *
 * @param listener The listener to notify when the setup process is complete.
 *///from   ww  w  .ja  v  a  2 s .c o  m
public void startSetup(final IAPurchasing listener) {
    // If already set up, can't do it again.
    checkNotDisposed();
    if (mSetupDone)
        throw new IllegalStateException("IAB helper is already set up.");

    // Connection to IAB service
    logDebug("Starting in-app billing setup.");
    mServiceConn = new ServiceConnection() {
        @Override
        public void onServiceDisconnected(ComponentName name) {
            logDebug("Billing service disconnected.");
            mService = null;
        }

        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            if (mDisposed)
                return;
            logDebug("Billing service connected.");
            mService = IInAppBillingService.Stub.asInterface(service);
            String packageName = mContext.getPackageName();
            try {
                logDebug("Checking for in-app billing 3 support.");

                // check for in-app billing v3 support
                int response = mService.isBillingSupported(3, packageName, ITEM_TYPE_INAPP);
                if (response != BILLING_RESPONSE_RESULT_OK) {
                    if (listener != null)
                        listener.onIabSetupFinished(
                                new IabResult(response, "Error checking for billing v3 support."));

                    // if in-app purchases aren't supported, neither are subscriptions.
                    mSubscriptionsSupported = false;
                    return;
                }
                logDebug("In-app billing version 3 supported for " + packageName);

                // check for v3 subscriptions support
                response = mService.isBillingSupported(3, packageName, ITEM_TYPE_SUBS);
                if (response == BILLING_RESPONSE_RESULT_OK) {
                    logDebug("Subscriptions AVAILABLE.");
                    mSubscriptionsSupported = true;
                } else {
                    logDebug("Subscriptions NOT AVAILABLE. Response: " + response);
                }

                mSetupDone = true;
            } catch (RemoteException e) {
                if (listener != null) {
                    listener.onIabSetupFinished(new IabResult(IABHELPER_REMOTE_EXCEPTION,
                            "RemoteException while setting up in-app billing."));
                }
                e.printStackTrace();
                return;
            }

            if (listener != null) {
                listener.onIabSetupFinished(new IabResult(BILLING_RESPONSE_RESULT_OK, "Setup successful."));
            }
        }
    };

    Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
    serviceIntent.setPackage("com.android.vending");
    if (!mContext.getPackageManager().queryIntentServices(serviceIntent, 0).isEmpty()) {
        // service available to handle that Intent
        mContext.bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE);
    } else {
        // no service available to handle that Intent
        if (listener != null) {
            listener.onIabSetupFinished(new IabResult(BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE,
                    "Billing service unavailable on device."));
        }
    }
}

From source file:br.com.cpb.esperanca.iab.IabHelper.java

/**
 * Starts the setup process. This will start up the setup process asynchronously.
 * You will be notified through the listener when the setup process is complete.
 * This method is safe to call from a UI thread.
 * /*www  .  ja va2  s  .  c om*/
 * THIS WILL NOT WORK ON an EMULATOR, YOU NEED A REAL DEVICE
 * 
 * @param listener
 *            The listener to notify when the setup process is complete.
 */
public void startSetup(final OnIabSetupFinishedListener listener) {
    // If already set up, can't do it again.
    if (mSetupDone)
        throw new IllegalStateException("IAB helper is already set up.");

    // Connection to IAB service
    logDebug("Starting in-app billing setup.");
    mServiceConn = new ServiceConnection() {

        @Override
        public void onServiceDisconnected(ComponentName name) {
            logDebug("Billing service disconnected.");
            mService = null;
        }

        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            logDebug("Billing service connected.");
            mService = IInAppBillingService.Stub.asInterface(service);
            String packageName = mContext.getPackageName();
            try {
                logDebug("Checking for in-app billing 3 support.");
                int response = mService.isBillingSupported(3, packageName, ITEM_TYPE_INAPP);
                if (response != BILLING_RESPONSE_RESULT_OK) {
                    if (listener != null) {
                        listener.onIabSetupFinished(
                                new IabResult(response, "Error checking for billing v3 support."));
                    }
                    return;
                }
                logDebug("In-app billing version 3 supported for " + packageName);
                mSetupDone = true;
            } catch (RemoteException e) {
                if (listener != null) {
                    listener.onIabSetupFinished(new IabResult(IABHELPER_REMOTE_EXCEPTION,
                            "RemoteException while setting up in-app billing."));
                }
                e.printStackTrace();
            }

            if (listener != null) {
                listener.onIabSetupFinished(new IabResult(BILLING_RESPONSE_RESULT_OK, "Setup successful."));
            }
        }
    };
    boolean attempt = mContext.bindService(new Intent("com.android.vending.billing.InAppBillingService.BIND"),
            mServiceConn, Context.BIND_AUTO_CREATE);

    if (!attempt) {
        Log.e(mDebugTag,
                "Failed to bind to Service with name com.android.vending.billing.InAppBillingService.BIND");
    }
}