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:com.forktech.cmerge.ui.ContactsListFragment.java

private void mergeContacts() {
    ArrayList<Integer> list = (ArrayList<Integer>) getContacts();
    int numOfContacts = list.size();

    if (numOfContacts < 2) {
        Toast.makeText(getActivity(), "Atleast select two contacts to merge", Toast.LENGTH_SHORT).show();
        return;/* w w  w  . j a v a  2s  .com*/
    }
    mAdapter.clearChecks(true);
    for (int i = 0; i < numOfContacts - 1; i++) {
        ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();

        ops.add(ContentProviderOperation.newUpdate(ContactsContract.AggregationExceptions.CONTENT_URI)
                .withValue(ContactsContract.AggregationExceptions.TYPE,
                        ContactsContract.AggregationExceptions.TYPE_KEEP_TOGETHER)
                .withValue(ContactsContract.AggregationExceptions.RAW_CONTACT_ID1, getContacts().get(0))
                .withValue(ContactsContract.AggregationExceptions.RAW_CONTACT_ID2, getContacts().get(i + 1))
                .build());
        // Log.e("", Arrays.deepToString(getContacts().toArray()));

        try {
            ContentProviderResult[] result = getActivity().getContentResolver()
                    .applyBatch(ContactsContract.AUTHORITY, ops);
            Log.e("",
                    "result length : " + result.length + " :: " + result[0].uri + result[0].describeContents());
        } catch (RemoteException e) {
            e.printStackTrace();
        } catch (OperationApplicationException e) {
            e.printStackTrace();
        }
    }
}

From source file:de.luhmer.owncloudnewsreader.NewsReaderListActivity.java

@Override
protected void onStop() {
    if (_ownCloudSyncService != null) {
        try {/*from  ww  w.j av  a2  s  .c  o  m*/
            _ownCloudSyncService.unregisterCallback(callback);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
    unbindService(mConnection);
    mConnection = null;
    super.onStop();
}

From source file:de.luhmer.owncloudnewsreader.NewsReaderListActivity.java

public void UpdateButtonLayout() {
    try {/*ww  w  .  j a v  a2 s  . com*/
        NewsReaderListFragment newsReaderListFragment = getSlidingListFragment();
        NewsReaderDetailFragment newsReaderDetailFragment = getNewsReaderDetailFragment();

        if (newsReaderListFragment != null && newsReaderDetailFragment != null
                && _ownCloudSyncService != null) {
            IOwnCloudSyncService _Reader = _ownCloudSyncService;

            boolean isSyncRunning = _Reader.isSyncRunning();

            newsReaderListFragment.setRefreshing(isSyncRunning);
            newsReaderDetailFragment.swipeRefresh.setRefreshing(isSyncRunning);
        }
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}

From source file:org.scratch.microwebserver.MicrowebserverService.java

public void connectDispatcher() {
    final Intent i = new Intent("org.scratch.microwebserver");
    i.setComponent(new ComponentName("org.scratch.microwebserver",
            "org.scratch.microwebserver.RemoteDispatcherService"));

    dispatchConn = new ServiceConnection() {
        public void onServiceConnected(ComponentName className, IBinder service) {
            // This is called when the connection with the service has been
            // established, giving us the service object we can use to
            // interact with the service.  We are communicating with our
            // service through an IDL interface, so get a client-side
            // representation of that from the raw service object.
            disptachMessenger = new Messenger(service);

            // We want to monitor the service for as long as we are
            // connected to it.
            try {
                System.err.println("SEND SERVER HELLO");

                Message msg = new Message();
                msg.what = MessageTypes.MSG_SERVER_HELLO.ordinal();
                msg.replyTo = mMessenger;

                disptachMessenger.send(msg);

            } catch (RemoteException e) {
                // In this case the service has crashed before we could even
                // do anything with it; we can count on soon being
                // disconnected (and then reconnected if it can be restarted)
                // so there is no need to do anything here.
                //HANDLE !!!
                e.printStackTrace();
            }//from www  .  ja  v a  2  s .  co m

            // As part of the sample, tell the user what happened.
            //Toast.makeText(Binding.this, "remote service connected",Toast.LENGTH_SHORT).show();
        }

        public void onServiceDisconnected(ComponentName className) {
            // This is called when the connection with the service has been
            // unexpectedly disconnected -- that is, its process crashed.
            disptachMessenger = null;

            // As part of the sample, tell the user what happened.
            //                Toast.makeText(Binding.this, R.string.remote_service_disconnected,
            //                        Toast.LENGTH_SHORT).show();
        }
    };

    bindService(i, dispatchConn, Context.BIND_AUTO_CREATE);
}

From source file:net.sf.aria2.MainActivity.java

private boolean changeAriaServiceState(Preference p) {
    if (p.isEnabled()) {
        // it looks unsightly when current session overlaps with previous one...
        ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)).cancel(R.id.nf_status);

        pref.setEnabled(false);/*from w w  w .j av  a 2s .com*/
        uiThreadHandler.postDelayed(() -> pref.setEnabled(true), 4000);

        if (pref.isChecked()) {
            try {
                serviceLink.askToStop();
            } catch (RemoteException e) {
                // likely service process dying during the call
                // let's hope, that onSerivceDisconnected will fix it for us
                e.printStackTrace();

                setPrefEnabled(false);
            }
        } else {
            final Intent intent;
            try {
                intent = new ConfigBuilder(this).constructServiceCommand(new Intent(sericeMoniker))
                        .putExtra(Config.EXTRA_INTERACTIVE, true);

                if (startService(intent) == null)
                    setPrefEnabled(false);
            } catch (Exception e) {
                Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
            }
        }
    }

    return true;
}

From source file:de.luhmer.owncloudnewsreader.NewsReaderListActivity.java

public void startSync() {
    SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(this);

    if (mPrefs.getString(SettingsActivity.EDT_OWNCLOUDROOTPATH_STRING, null) == null)
        StartLoginFragment(this);
    else {// w  ww .  j  a  v a  2s  . c om
        try {
            if (!_ownCloudSyncService.isSyncRunning()) {
                new PostDelayHandler(this).stopRunningPostDelayHandler();//Stop pending sync handler

                Bundle accBundle = new Bundle();
                accBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
                AccountManager mAccountManager = AccountManager.get(this);
                Account[] accounts = mAccountManager.getAccounts();
                for (Account acc : accounts)
                    if (acc.type.equals(AccountGeneral.ACCOUNT_TYPE))
                        ContentResolver.requestSync(acc, AccountGeneral.ACCOUNT_TYPE, accBundle);
                //http://stackoverflow.com/questions/5253858/why-does-contentresolver-requestsync-not-trigger-a-sync
            } else {
                UpdateButtonLayout();
            }
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
}

From source file:com.soomla.store.billing.nokia.NokiaIabHelper.java

/**
 * See parent/*w  ww .ja  v a 2  s  .  c  om*/
 */
protected void startSetupInner() {
    SoomlaUtils.LogDebug(TAG, "startSetupInner launched");
    mServiceConn = new ServiceConnection() {
        @Override
        public void onServiceDisconnected(ComponentName name) {
            SoomlaUtils.LogDebug(TAG, "Billing service disconnected.");
            mService = null;
        }

        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            SoomlaUtils.LogDebug(TAG, "Billing service connected.");
            mService = INokiaIAPService.Stub.asInterface(service);
            String packageName = SoomlaApp.getAppContext().getPackageName();
            try {
                SoomlaUtils.LogDebug(TAG, "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 != IabResult.BILLING_RESPONSE_RESULT_OK) {
                    setupFailed(new IabResult(response, "Error checking for billing v3 support."));
                    return;
                }
                SoomlaUtils.LogDebug(TAG, "In-app billing version 3 supported for " + packageName);

                setupSuccess();
            } catch (RemoteException e) {
                setupFailed(new IabResult(IabResult.IABHELPER_REMOTE_EXCEPTION,
                        "RemoteException while setting up in-app billing."));
                e.printStackTrace();
            }
        }
    };

    SoomlaApp.getAppContext().bindService(new Intent("com.nokia.payment.iapenabler.InAppBillingService.BIND"),
            mServiceConn, Context.BIND_AUTO_CREATE);
}

From source file:de.dcja.prettygreatmusicplayer.MusicPlaybackService.java

private void sendUpdateToClients() {
    List<Messenger> toRemove = new ArrayList<Messenger>();
    synchronized (mClients) {
        for (Messenger client : mClients) {
            Message msg = Message.obtain(null, MSG_SERVICE_STATUS);
            try {
                client.send(msg);/*  w ww  .  java2 s. co m*/
            } catch (RemoteException e) {
                e.printStackTrace();
                toRemove.add(client);
            }
        }

        for (Messenger remove : toRemove) {
            mClients.remove(remove);
        }
    }
}

From source file:com.sentaroh.android.TaskAutomation.ActivityTaskStatus.java

private void unsetCallbackListener() {
    try {/*from  ww w  .  j  ava 2s .  c o  m*/
        svcServer.removeCallBack(svcClientCallback);
    } catch (RemoteException e) {
        e.printStackTrace();
        util.addLogMsg("E", "unsetCallbackListener error :", e.toString());
    }
}

From source file:com.soomla.store.billing.google.GoogleIabHelper.java

/**
 * See parent//from   ww  w  .j  a  v  a  2 s.  c o  m
 */
protected void startSetupInner() {
    mServiceConn = new ServiceConnection() {
        @Override
        public void onServiceDisconnected(ComponentName name) {
            SoomlaUtils.LogDebug(TAG, "Billing service disconnected.");
            mService = null;
        }

        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            SoomlaUtils.LogDebug(TAG, "Billing service connected.");
            mService = IInAppBillingService.Stub.asInterface(service);
            String packageName = SoomlaApp.getAppContext().getPackageName();
            try {
                SoomlaUtils.LogDebug(TAG, "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 != IabResult.BILLING_RESPONSE_RESULT_OK) {
                    setupFailed(new IabResult(response, "Error checking for billing v3 support."));
                    return;
                }
                SoomlaUtils.LogDebug(TAG, "In-app billing version 3 supported for " + packageName);

                setupSuccess();
            } catch (RemoteException e) {
                setupFailed(new IabResult(IabResult.IABHELPER_REMOTE_EXCEPTION,
                        "RemoteException while setting up in-app billing."));
                e.printStackTrace();
            }
        }
    };

    Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
    serviceIntent.setPackage("com.android.vending");
    List<ResolveInfo> intentServices = SoomlaApp.getAppContext().getPackageManager()
            .queryIntentServices(serviceIntent, 0);
    if (intentServices != null && !intentServices.isEmpty()) {
        // service available to handle that Intent
        SoomlaApp.getAppContext().bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE);
    } else {
        // no service available to handle that Intent
        setupFailed(new IabResult(IabResult.BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE,
                "Billing service unavailable on device."));
    }
}