List of usage examples for android.os RemoteException printStackTrace
public void printStackTrace()
From source file:com.segma.trim.InAppBillingUtilities.InAppBillingHelper.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. */// w ww. j a va 2 s .com public void startSetup(final OnInAppBillingSetupFinishedListener 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.onInAppBillingSetupFinished( new InAppBillingResult(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 = mService.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 = 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); mSubscriptionsSupported = false; mSubscriptionUpdateSupported = false; } } mSetupDone = true; } catch (RemoteException e) { if (listener != null) { listener.onInAppBillingSetupFinished(new InAppBillingResult(IABHELPER_REMOTE_EXCEPTION, "RemoteException while setting up in-app billing.")); } e.printStackTrace(); return; } if (listener != null) { listener.onInAppBillingSetupFinished( new InAppBillingResult(BILLING_RESPONSE_RESULT_OK, "Setup successful.")); } } }; Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND"); serviceIntent.setPackage("com.android.vending"); List<ResolveInfo> intentServices = mContext.getPackageManager().queryIntentServices(serviceIntent, 0); if (intentServices != null && !intentServices.isEmpty()) { // service available to handle that Intent mContext.bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE); isServiceBinded = true; } else { // no service available to handle that Intent if (listener != null) { listener.onInAppBillingSetupFinished(new InAppBillingResult( BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE, "Billing service unavailable on device.")); } } }
From source file:com.mediatek.systemupdate.HttpManager.java
private void notifySysoper(int actionType) { try {/*from ww w . j a v a 2 s. com*/ switch (actionType) { case MSG_DELETE_COMMANDFILE: Message msg = Message.obtain(null, MSG_DELETE_COMMANDFILE); msg.replyTo = mMessenger; Bundle data = new Bundle(); if (data == null) { return; } data.putString(CMD_FILE_KEY, COMMAND_FILE); msg.setData(data); if (mService != null) { mService.send(msg); } break; default: break; } } catch (RemoteException e) { e.printStackTrace(); } }
From source file:bulat.diet.helper_sport.utils.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. * // w w w . j av a 2 s . c o m * @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. 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"); try { if (mContext != null && !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.")); } } } catch (Exception e) { e.printStackTrace(); } }
From source file:org.gateshipone.odyssey.views.NowPlayingView.java
/** * Called after the layout inflater is finished. * Sets all global view variables to the ones inflatd. *///from ww w . j a v a 2 s. co m @Override protected void onFinishInflate() { super.onFinishInflate(); // Get both main views (header and bottom part) mHeaderView = findViewById(R.id.now_playing_headerLayout); mMainView = findViewById(R.id.now_playing_bodyLayout); // header buttons mTopPlayPauseButton = (ImageButton) findViewById(R.id.now_playing_topPlayPauseButton); mTopPlaylistButton = (ImageButton) findViewById(R.id.now_playing_topPlaylistButton); ImageButton topMenuButton = (ImageButton) findViewById(R.id.now_playing_topMenuButton); // bottom buttons mBottomRepeatButton = (ImageButton) findViewById(R.id.now_playing_bottomRepeatButton); mBottomPlayPauseButton = (ImageButton) findViewById(R.id.now_playing_bottomPlayPauseButton); mBottomRandomButton = (ImageButton) findViewById(R.id.now_playing_bottomRandomButton); ImageButton bottomPreviousButton = (ImageButton) findViewById(R.id.now_playing_bottomPreviousButton); ImageButton bottomNextButton = (ImageButton) findViewById(R.id.now_playing_bottomNextButton); // Main cover image mCoverImage = (ImageView) findViewById(R.id.now_playing_cover); // Small header cover image mTopCoverImage = (ImageView) findViewById(R.id.now_playing_topCover); // View with the ListView of the playlist mPlaylistView = (CurrentPlaylistView) findViewById(R.id.now_playing_playlist); // view switcher for cover and playlist view mViewSwitcher = (ViewSwitcher) findViewById(R.id.now_playing_view_switcher); // Button container for the buttons shown if dragged up mDraggedUpButtons = (LinearLayout) findViewById(R.id.now_playing_layout_dragged_up); // Button container for the buttons shown if dragged down mDraggedDownButtons = (LinearLayout) findViewById(R.id.now_playing_layout_dragged_down); // textviews mTrackTitle = (TextView) findViewById(R.id.now_playing_track_title); // For marquee scrolling the TextView need selected == true mTrackTitle.setSelected(true); mTrackSubtitle = (TextView) findViewById(R.id.now_playing_track_subtitle); // For marquee scrolling the TextView need selected == true mTrackSubtitle.setSelected(true); // Textviews directly under the seekbar mElapsedTime = (TextView) findViewById(R.id.now_playing_elapsedTime); mDuration = (TextView) findViewById(R.id.now_playing_duration); mHeaderTextLayout = (LinearLayout) findViewById(R.id.now_playing_header_textLayout); // seekbar (position) mPositionSeekbar = (SeekBar) findViewById(R.id.now_playing_seekBar); mPositionSeekbar.setOnSeekBarChangeListener(this); // set dragging part default to bottom mDragOffset = 1.0f; mDraggedUpButtons.setVisibility(INVISIBLE); mDraggedDownButtons.setVisibility(VISIBLE); mDraggedUpButtons.setAlpha(0.0f); // add listener to top playpause button mTopPlayPauseButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { try { mServiceConnection.getPBS().togglePause(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); // Add listeners to top playlist button mTopPlaylistButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // get color for playlist button int color; if (mViewSwitcher.getCurrentView() != mPlaylistView) { color = ThemeUtils.getThemeColor(getContext(), R.attr.colorAccent); } else { color = ThemeUtils.getThemeColor(getContext(), R.attr.odyssey_color_text_accent); } // tint the button mTopPlaylistButton.setImageTintList(ColorStateList.valueOf(color)); // toggle between cover and playlistview mViewSwitcher.showNext(); // report the change of the view if (mDragStatusReceiver != null) { // set view status if (mViewSwitcher.getCurrentView() == mCoverImage) { // cover image is shown mDragStatusReceiver .onSwitchedViews(NowPlayingDragStatusReceiver.VIEW_SWITCHER_STATUS.COVER_VIEW); } else { // playlist view is shown mDragStatusReceiver .onSwitchedViews(NowPlayingDragStatusReceiver.VIEW_SWITCHER_STATUS.PLAYLIST_VIEW); } } } }); // Add listener to top menu button topMenuButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showAdditionalOptionsMenu(v); } }); // Add listener to bottom repeat button mBottomRepeatButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { try { mServiceConnection.getPBS().toggleRepeat(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); // Add listener to bottom previous button bottomPreviousButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { try { mServiceConnection.getPBS().previous(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); // Add listener to bottom playpause button mBottomPlayPauseButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { try { mServiceConnection.getPBS().togglePause(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); // Add listener to bottom next button bottomNextButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { try { mServiceConnection.getPBS().next(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); // Add listener to bottom random button mBottomRandomButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { try { mServiceConnection.getPBS().toggleRandom(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); mCoverLoader = new CoverBitmapLoader(getContext(), new CoverReceiverClass()); invalidate(); }
From source file:org.yammp.app.MusicPlaybackActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem item = menu.findItem(EQUALIZER); if (item != null) item.setVisible(EqualizerWrapper.isSupported()); item = menu.findItem(ADD_TO_FAVORITES); try {// ww w .j a v a2s . c o m if (item != null && mService != null) item.setIcon(mService.isFavorite(mService.getAudioId()) ? R.drawable.ic_menu_star : R.drawable.ic_menu_star_off); } catch (RemoteException e) { e.printStackTrace(); } return super.onPrepareOptionsMenu(menu); }
From source file:org.yammp.app.MusicPlaybackActivity.java
private void updateTrackInfo(boolean animation) { if (mService == null) { finish();/*from w ww . j av a2 s . co m*/ return; } try { mTrackName.setText(mService.getTrackName()); if (mService.getArtistName() != null && !MediaStore.UNKNOWN_STRING.equals(mService.getArtistName())) { mTrackDetail.setText(mService.getArtistName()); } else if (mService.getAlbumName() != null && !MediaStore.UNKNOWN_STRING.equals(mService.getAlbumName())) { mTrackDetail.setText(mService.getAlbumName()); } else { mTrackDetail.setText(R.string.unknown_artist); } if (mColorAnalyser != null) { mColorAnalyser.cancel(true); } mColorAnalyser = new AsyncColorAnalyser(); mColorAnalyser.execute(); mDuration = mService.duration(); mTotalTime.setText(MusicUtils.makeTimeString(this, mDuration / 1000)); } catch (RemoteException e) { e.printStackTrace(); finish(); } }
From source file:org.yammp.app.MusicPlaybackActivity.java
private long refreshNow() { if (mService == null) return 500; try {//from w ww.j ava 2 s. c o m long pos = mPosOverride < 0 ? mService.position() : mPosOverride; long remaining = 1000 - pos % 1000; if (pos >= 0 && mDuration > 0) { mCurrentTime.setText(MusicUtils.makeTimeString(this, pos / 1000)); if (mService.isPlaying()) { mCurrentTime.setVisibility(View.VISIBLE); } else { // blink the counter // If the progress bar is still been dragged, then we do not // want to blink the // currentTime. It would cause flickering due to change in // the visibility. if (mFromTouch) { mCurrentTime.setVisibility(View.VISIBLE); } else { int vis = mCurrentTime.getVisibility(); mCurrentTime.setVisibility(vis == View.INVISIBLE ? View.VISIBLE : View.INVISIBLE); } remaining = 500; } // Normalize our progress along the progress bar's scale setSupportProgress((int) ((Window.PROGRESS_END - Window.PROGRESS_START) * pos / mDuration)); } else { mCurrentTime.setText("--:--"); setSupportProgress(Window.PROGRESS_END - Window.PROGRESS_START); } // return the number of milliseconds until the next full second, so // the counter can be updated at just the right time return remaining; } catch (RemoteException e) { e.printStackTrace(); } return 500; }
From source file:org.videolan.vlc.PlaybackService.java
private void executeUpdateProgress() { for (IPlaybackServiceCallback callback : mCallback.keySet()) { try {// w ww. ja v a 2 s.c om callback.updateProgress(); } catch (RemoteException e) { e.printStackTrace(); } } }
From source file:org.videolan.vlc.PlaybackService.java
private void executeOnMediaPlayedAdded() { final MediaWrapper media = getCurrentMedia(); for (IPlaybackServiceCallback callback : mCallback.keySet()) { try {/*from w ww . j a va 2 s. c o m*/ callback.onMediaPlayedAdded(media, 0); } catch (RemoteException e) { e.printStackTrace(); } } }
From source file:org.videolan.vlc.PlaybackService.java
private void executeUpdate(Boolean updateWidget) { for (IPlaybackServiceCallback callback : mCallback.keySet()) { try {/*from w ww . j a va 2 s . c o m*/ callback.update(); } catch (RemoteException e) { e.printStackTrace(); } } if (updateWidget) updateWidget(); }