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.drinviewer.droiddrinviewer.DrinViewerBroadcastReceiver.java

/**
 * Starts the alarm repeater after a disconnection from a WiFi network.
 * The alarm is firing request to discover server at regular time interval
 * //from w ww  . j  av a 2s.  c  om
 * @param context The context to use
 * @return true on success
 */
private boolean startAlarmRepeater(Context context) {

    boolean returnValue = false;

    // Gets the Binder to the DiscoverServerService
    IBinder b = peekService(context, new Intent(context, DiscoverServerService.class));
    DiscoverServerApi discoverServerApi = DiscoverServerApi.Stub.asInterface(b);

    // start the alarm repeater only if the api exists and the discover process in not running
    try {
        if (b != null && discoverServerApi != null && !discoverServerApi.isRunning()) {
            // Get the alarm manager
            if (alarmManager == null)
                alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
            // Instantiate the intent and set its action
            Intent i = new Intent(context, this.getClass());
            i.setAction(context.getResources().getString(R.string.broadcast_startdiscovery));
            // send the wifiBroadcastAddress together with the intent
            i.putExtra("wifiBroadcastAddress", wifiBroadcastAddress);
            // Get the broadcast
            PendingIntent pending = PendingIntent.getBroadcast(context, 0, i,
                    PendingIntent.FLAG_CANCEL_CURRENT);
            if (pending != null) {
                Calendar cal = Calendar.getInstance();
                // cancel the alarm
                alarmManager.cancel(pending);
                // Run the intent immediately and schedule repeating at fixed time intervals
                context.sendBroadcast(i);
                alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP,
                        cal.getTimeInMillis() + DroidDrinViewerConstants.DISCOVER_REPEAT_TIME,
                        DroidDrinViewerConstants.DISCOVER_REPEAT_TIME, pending);
                returnValue = true;
            }
        }
    } catch (RemoteException e) {
        e.printStackTrace();
        returnValue = false;
    }
    return returnValue;
}

From source file:de.luhmer.owncloudnewsreader.services.OwnCloudSyncService.java

private void finishedSync() {
    TeslaUnreadManager.PublishUnreadCount(this);
    WidgetProvider.UpdateWidget(this);

    syncRunning = false;//from  w  w w .j  av a 2 s.c  om
    syncStopWatch.stop();
    Log.v(TAG, "Time needed (synchronization): " + syncStopWatch.toString());

    SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(OwnCloudSyncService.this);
    int newItemsCount = mPrefs.getInt(Constants.LAST_UPDATE_NEW_ITEMS_COUNT_STRING, 0);
    if (newItemsCount > 0) {
        ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
        List<ActivityManager.RunningTaskInfo> runningTaskInfo = am.getRunningTasks(1);

        ComponentName componentInfo = runningTaskInfo.get(0).topActivity;
        if (!componentInfo.getPackageName().equals("de.luhmer.owncloudnewsreader")) {
            Resources res = getResources();
            String tickerText = res.getQuantityString(R.plurals.notification_new_items_ticker, newItemsCount,
                    newItemsCount);
            String contentText = res.getQuantityString(R.plurals.notification_new_items_text, newItemsCount,
                    newItemsCount);
            String title = getString(R.string.app_name);

            if (mPrefs.getBoolean(SettingsActivity.CB_SHOW_NOTIFICATION_NEW_ARTICLES_STRING, true))//Default is true
                NotificationManagerNewsReader.getInstance(OwnCloudSyncService.this).ShowMessage(title,
                        tickerText, contentText);
        }
    }

    List<IOwnCloudSyncServiceCallback> callbackList = getCallBackItemsAndBeginBroadcast();
    for (IOwnCloudSyncServiceCallback icb : callbackList) {
        try {
            icb.finishedSync();
            //icb.finishedSyncOfItems();
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
    callbacks.finishBroadcast();
}

From source file:com.eurecalab.eureca.fragments.SettingsFragment.java

private void upgradePro() {
    try {/*ww w . j  a  va  2s. co m*/
        Bundle buyIntentBundle = mService.getBuyIntent(GenericConstants.BILLING_VERSION,
                getActivity().getPackageName(), GenericConstants.PREMIUM_VERSION_SKU, "inapp",
                "bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ");

        PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
        if (pendingIntent != null) {
            getActivity().startIntentSenderForResult(pendingIntent.getIntentSender(),
                    GenericConstants.PURCHASE_REQUEST_CODE, new Intent(), 0, 0, 0);
        } else {
            Snackbar.make(upgrade, R.string.item_already_purchased, Snackbar.LENGTH_LONG).show();
        }
    } catch (RemoteException e) {
        e.printStackTrace();
    } catch (IntentSender.SendIntentException e) {
        e.printStackTrace();
    }
}

From source file:org.gateshipone.odyssey.fragments.AllTracksFragment.java

/**
 * Call the PBS to play the selected track.
 * A previous playlist will be cleared.// ww w.  j a  va  2 s.  c om
 *
 * @param position the position of the selected track in the adapter
 */
private void playTrack(int position) {
    // clear playlist and play current track

    try {
        mServiceConnection.getPBS().clearPlaylist();
        enqueueTrack(position, false);
        mServiceConnection.getPBS().jumpTo(0);
    } catch (RemoteException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
}

From source file:org.gateshipone.odyssey.fragments.GenericAlbumsFragment.java

/**
 * Call the PBS to enqueue the selected album.
 *
 * @param position the position of the selected album in the adapter
 *///from   w  ww . j a  v  a2 s.co m
protected void enqueueAlbum(int position) {
    // identify current album

    AlbumModel clickedAlbum = (AlbumModel) mAdapter.getItem(position);
    String albumKey = clickedAlbum.getAlbumKey();

    // enqueue album
    try {
        mServiceConnection.getPBS().enqueueAlbum(albumKey);
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:com.morlunk.mumbleclient.channel.actionmode.UserActionModeCallback.java

@Override
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
    super.onCreateActionMode(actionMode, menu);
    TintedMenuInflater inflater = new TintedMenuInflater(mContext, actionMode.getMenuInflater());
    inflater.inflate(R.menu.context_user, menu);

    actionMode.setTitle(mUser.getName());
    actionMode.setSubtitle(R.string.current_chat_target);

    try {/*from  w  w w.  j ava2  s.  co  m*/
        // Request permissions update from server, if we don't have channel permissions
        Channel channel = mService.getChannel(mUser.getChannelId());
        if (channel != null && channel.getPermissions() == 0)
            mService.requestPermissions(mUser.getChannelId());
    } catch (RemoteException e) {
        e.printStackTrace();
    }

    return true;
}

From source file:com.omniwearhaptics.api.OmniWearHelper.java

public OmniWearHelper(final Context context, OnOmniWearEventListener eventListener,
        OnOmniWearLogListener logListener) {

    mParent = context;/*from   w  w w  . j  av a2 s  .c o  m*/
    mOnOmniWearEventListener = eventListener;
    mOnOmniWearLogListener = logListener;
    Intent intent = new Intent();
    intent.setClassName("com.omniwearhaptics.omniwearbtbridge",
            "com.omniwearhaptics.omniwearbtbridge.OmniWearService");
    permissionsCheck();

    // Connect to the OmniWear service.
    mServiceConnection = new ServiceConnection() {

        // When the service is bound, try to connect to the device.
        public void onServiceConnected(ComponentName name, IBinder service) {

            // Create the interface.
            mOmniWearInterface = IOmniWear.Stub.asInterface(service);

            // Register the callback.
            if (mCallback != null) {
                try {
                    if (mOmniWearInterface != null) {
                        mOmniWearInterface.registerCallback(mCallback);
                        mCallback.onOmniWearEvent(EVENT_SERVICE_BOUND);
                    }
                } catch (RemoteException e) {
                    e.printStackTrace();
                }
            } else {
                Log.w(TAG, "mCallback is null in searchForOmniWearDevice");
            }
        }

        public void onServiceDisconnected(ComponentName name) {
            try {
                mOmniWearInterface.unregisterCallback();
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
    };
    context.bindService(intent, mServiceConnection, Context.BIND_AUTO_CREATE);
}

From source file:org.gateshipone.odyssey.fragments.GenericAlbumsFragment.java

/**
 * Call the PBS to play the selected album.
 * A previous playlist will be cleared.//from   w ww . j  a va  2 s  .c  o  m
 *
 * @param position the position of the selected album in the adapter
 */
protected void playAlbum(int position) {
    // Remove old tracks
    try {
        mServiceConnection.getPBS().clearPlaylist();
    } catch (RemoteException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }

    // get and enqueue albumtracks
    enqueueAlbum(position);

    // play album
    try {
        mServiceConnection.getPBS().jumpTo(0);
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:fr.mixit.android.ui.HomeActivity.java

protected void init() {
    if (mIsBound && mIsServiceReady) {
        final Message msg = Message.obtain(null, MixItService.MSG_INIT, 0, 0);
        msg.replyTo = mMessenger;//from  ww w.  ja  v  a  2  s. c om
        final Bundle b = new Bundle();
        msg.setData(b);
        try {
            mService.send(msg);
            setRefreshMode(true);
            if (!mIsFirstInitDone) {
                showProgress();
            }

        } catch (final RemoteException e) {
            e.printStackTrace();
        }
    }
}

From source file:com.subzero.runners.android.AndroidLauncher.java

@Override
public void makePurchase(String itemID, Preferences pref) {
    this.pref = pref;
    try {//  w w w .  ja va2  s.c o  m
        Bundle buyIntentBundle = mService.getBuyIntent(3, getPackageName(), itemID, "inapp", null);
        PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
        startIntentSenderForResult(pendingIntent.getIntentSender(), 1001, new Intent(), Integer.valueOf(0),
                Integer.valueOf(0), Integer.valueOf(0));
    } catch (RemoteException e) {
        e.printStackTrace();
    } catch (SendIntentException e) {
        e.printStackTrace();
    }
}