Java Code Examples for android.os.RemoteException#printStackTrace()

The following examples show how to use android.os.RemoteException#printStackTrace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CurrentPlaylistView.java    From odyssey with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Set the PBSServiceConnection object.
 * This will create a new Adapter.
 */
public void registerPBServiceConnection(PlaybackServiceConnection playbackServiceConnection) {
    if(playbackServiceConnection == null) {
        return;
    }
    mPlaybackServiceConnection = playbackServiceConnection;

    mCurrentPlaylistAdapter = new CurrentPlaylistAdapter(mContext, mPlaybackServiceConnection);
    mCurrentPlaylistAdapter.hideArtwork(mHideArtwork);

    mListView.setAdapter(mCurrentPlaylistAdapter);
    mListView.setOnScrollListener(new ScrollSpeedListener(mCurrentPlaylistAdapter));

    // set the selection to the current track, so the list view will positioned appropriately
    try {
        mListView.setSelection(mPlaybackServiceConnection.getPBS().getCurrentIndex());
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
 
Example 2
Source File: ServiceBackedMediaPlayer.java    From K-Sonic with MIT License 6 votes vote down vote up
/**
 * Functions identically to android.media.MediaPlayer.isPlaying()
 * @return True if the track is playing
 */
@Override
public boolean isPlaying() {
	if (pmInterface == null) {
		if (!ConnectPlayMediaService()) {
			ServiceBackedMediaPlayer.this.error(MediaPlayer.MEDIA_ERROR_UNKNOWN, 0);
		}
	}
	if (pmInterface != null) {
		try {
			return pmInterface.isPlaying(ServiceBackedMediaPlayer.this.sessionId);
		} catch (RemoteException e) {
			e.printStackTrace();
			ServiceBackedMediaPlayer.this.error(MediaPlayer.MEDIA_ERROR_UNKNOWN, 0);
		}
	}
	return false;
}
 
Example 3
Source File: ReadSmsService.java    From AutoInputAuthCode with Apache License 2.0 6 votes vote down vote up
/**
 * 发送消息到注册界面
 *
 * @param msgWhat
 * @param msgObj
 */
private void sendMsg2Register(int msgWhat, String msgObj) {
    if (mMessenger != null) {
        Message msg = Message.obtain();
        msg.what = msgWhat;
        msg.obj = msgObj;

        try {
            mMessenger.send(msg);
        } catch (RemoteException e) {
            e.printStackTrace();
        } finally {
            stopSelf();
        }
    }
}
 
Example 4
Source File: ServiceBackedMediaPlayer.java    From K-Sonic with MIT License 6 votes vote down vote up
/**
 * Functions identically to android.media.MediaPlayer.isLooping()
 * @return True if the track is looping
 */
@Override
public boolean isLooping() {
	Log.d(SBMP_TAG, "isLooping() 382");
	if (pmInterface == null) {
		if (!ConnectPlayMediaService()) {
			ServiceBackedMediaPlayer.this.error(MediaPlayer.MEDIA_ERROR_UNKNOWN, 0);
		}
	}
	try {
		return pmInterface.isLooping(ServiceBackedMediaPlayer.this.sessionId);
	} catch (RemoteException e) {
		e.printStackTrace();
		ServiceBackedMediaPlayer.this.error(MediaPlayer.MEDIA_ERROR_UNKNOWN, 0);
	}
	return false;
}
 
Example 5
Source File: ApkInstrumenterActivity.java    From hk with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Ask InstrumentationService to send its configuration.
 */
public void askForConfiguration() {
	if (!mBound) {
		Log.i(TAG, "mBound is null, sendEvent failed");
		return;
	}

	Message msg = Message.obtain(null, InstrumentationService.GetConfiguration);
	msg.replyTo = mMessenger;
	try {
		Log.i(TAG, "Asking configuration if instrumentation service");
		mService.send(msg);
	} catch (RemoteException e) {
		e.printStackTrace();
	}

}
 
Example 6
Source File: MainActivity.java    From Study_Android_Demo with Apache License 2.0 6 votes vote down vote up
public void send(View view){

        //通过Messenger发消息
        Message msgToService = Message.obtain();
        msgToService.what=200;

        //带上参数
//        msgToService.obj = "自古真情留不住";         不行,要序列化
        Bundle bundle = new Bundle();
        bundle.putString("key","自古真情留不住");
        msgToService.setData(bundle);

        //Message有个变量,指定谁来接收返回的消息
        msgToService.replyTo = messengerClient;
        try {
            messengerService.send(msgToService);
        } catch (RemoteException e) {
            e.printStackTrace();
        }


    }
 
Example 7
Source File: CallActivity.java    From yiim_v2 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onClick(View v) {
	try {
		if (v == mCloseCall) {
			getXmppBinder().closeCall();
			stopRingtone();
			CallActivity.call_state = UA_STATE_IDLE;
			finish();
		} else if (v == mAcceptCall) {
			getXmppBinder().acceptCall();
			stopRingtone();
			CallActivity.call_state = UA_STATE_INCALL;
			mAcceptCall.setVisibility(View.GONE);
		}
	} catch (RemoteException e) {
		e.printStackTrace();
	}
}
 
Example 8
Source File: BtHfpManager.java    From apollo-DuerOS with Apache License 2.0 6 votes vote down vote up
public boolean answerCallNative() {
    boolean ret = false;
    if (mBinder != null) {
        try {
            if (mBinder.acceptCall()) {
                LogUtil.d(TAG, "Accept call in success");
                ret = true;
            } else {
                LogUtil.d(TAG, "Accept call in failure");
                ret = false;
            }
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    return ret;
}
 
Example 9
Source File: SongOption.java    From Musicoco with Apache License 2.0 6 votes vote down vote up
private void handleShowMore() {
    if (mDialog.visible()) {
        mDialog.hide();
    } else {
        Song s = null;
        try {
            s = control.currentSong();
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        SongInfo info = mediaManager.getSongInfo(activity, s);
        String title = activity.getString(R.string.song) + ": " + info.getTitle();
        mDialog.setTitle(title);
        mDialog.show();
    }
}
 
Example 10
Source File: BlueManager.java    From BluetoothSocket with Apache License 2.0 5 votes vote down vote up
/**
 * 启动蓝牙Service 端,此方法用于Service 端
 */
public void startService(){
    if (mProxyService != null){
        try {
            mProxyService.startService();
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
}
 
Example 11
Source File: CharacteristicDetailsActivity.java    From BLEService with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void run() {
	try {
		mService.readRemoteRSSI(mDevice.getAddress());	
	} catch (RemoteException rex) {
		rex.printStackTrace();
	}
}
 
Example 12
Source File: BinderServiceConnection.java    From joynr with Apache License 2.0 5 votes vote down vote up
public void onServiceConnected(ComponentName componentName, IBinder service) {

        logger.debug("onServiceConnected {}/{}", componentName.getPackageName(), componentName.getShortClassName());
        io.joynr.android.messaging.binder.JoynrBinder remoteServiceClient = io.joynr.android.messaging.binder.JoynrBinder.Stub.asInterface(
                service);
        try {
            remoteServiceClient.transmit(data);
        } catch (RemoteException error) {
            error.printStackTrace();
            failureAction.execute(error);
        }

        context.unbindService(this);
        successAction.execute();
    }
 
Example 13
Source File: NowPlaying.java    From prettygoodmusicplayer with GNU General Public License v3.0 5 votes vote down vote up
private void playPause(){
	Log.d(TAG, "Play/Pause clicked...");
	Message msg = Message.obtain(null, MusicPlaybackService.MSG_PLAYPAUSE);
	try {
		Log.i(TAG, "Sending a request to start playing!");
		mService.send(msg);
	} catch (RemoteException e) {
		e.printStackTrace();
	}
}
 
Example 14
Source File: BaseController.java    From RePlugin-GameSdk with Apache License 2.0 5 votes vote down vote up
public void exit(Activity ctx,SdkExitCallBack exitCallBack){
	IBinder binder = RePlugin.fetchBinder("funcellplugin", "sdkImpl");
	if(binder == null){
		return;
	}
	IInteractiveService service = IInteractiveService.Stub.asInterface(binder);
	try {
		service.Exit(exitCallBack);
	} catch (RemoteException e) {
		e.printStackTrace();
	}
}
 
Example 15
Source File: BottomNavigationController.java    From Musicoco with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.list_bottom_nav_container:
            ActivityManager.getInstance().startPlayActivity(activity);
            break;
        case R.id.list_play: {
            boolean play = mPlay.isChecked();
            try {
                if (play) {
                    mControl.resume();
                } else mControl.pause();
            } catch (RemoteException e) {
                e.printStackTrace();
            }
            break;
        }
        case R.id.list_list:
            if (listViewsController.visible()) {
                listViewsController.hide();
            } else {
                listViewsController.show();
            }
            break;
        default:
            break;
    }
}
 
Example 16
Source File: VActivityManager.java    From container with GNU General Public License v3.0 5 votes vote down vote up
public void publishService(IBinder token, Intent intent, IBinder service) {
    try {
        getService().publishService(token, intent, service, VUserHandle.myUserId());
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
 
Example 17
Source File: PluginServiceServer.java    From springreplugin with Apache License 2.0 5 votes vote down vote up
private void callConnectedMethodLocked(IServiceConnection conn, ComponentName cn, IBinder b) {
    try {
        conn.connected(cn, b);
    } catch (RemoteException e) {
        if (BuildConfig.DEBUG) {
            e.printStackTrace();
        }
    }
}
 
Example 18
Source File: ContactDataMapper.java    From ContactMerger with Apache License 2.0 5 votes vote down vote up
/**
 * Save a single status update.
 * @param statusUpdate The status update to be stored.
 */
public void persist(StatusUpdate statusUpdate) {
    ContentValues values = new ContentValues();
    try {
        put(values, statusUpdate);
        provider.insert(StatusUpdates.CONTENT_URI, values);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
 
Example 19
Source File: NowPlayingView.java    From odyssey with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Saves the current state as a bookmark. This just calls the PBS and asks him to save the state.
 *
 * @param bookmarkTitle Name of the bookmark to store.
 */
public void createBookmark(String bookmarkTitle) {
    // call pbs and create bookmark with the given title for the current state
    try {
        mServiceConnection.getPBS().createBookmark(bookmarkTitle);
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
 
Example 20
Source File: Shadowsocks.java    From Maying with Apache License 2.0 4 votes vote down vote up
private void updateState(boolean resetConnectionTest) {
    if (mServiceBoundContext.bgService != null) {
        try {
            int state = mServiceBoundContext.bgService.getState();
            switch (state) {
                case Constants.State.CONNECTING:
                    fab.setBackgroundTintList(greyTint);
                    serviceStarted = false;
                    fab.setImageResource(R.drawable.ic_start_busy);
                    preferences.setEnabled(false);
                    fabProgressCircle.show();
                    stat.setVisibility(View.GONE);
                    break;
                case Constants.State.CONNECTED:
                    fab.setBackgroundTintList(greenTint);
                    serviceStarted = true;
                    fab.setImageResource(R.drawable.ic_start_connected);
                    preferences.setEnabled(false);
                    fabProgressCircle.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            hideCircle();
                        }
                    }, 100);
                    stat.setVisibility(View.VISIBLE);
                    if (resetConnectionTest) {
                        if (ShadowsocksApplication.app.isNatEnabled()) {
                            connectionTestText.setVisibility(View.GONE);
                        } else {
                            connectionTestText.setVisibility(View.VISIBLE);
                            connectionTestText.setText(getString(R.string.connection_test_pending));
                        }
                    }
                    break;
                case Constants.State.STOPPING:
                    fab.setBackgroundTintList(greyTint);
                    serviceStarted = false;
                    fab.setImageResource(R.drawable.ic_start_busy);
                    preferences.setEnabled(false);
                    fabProgressCircle.show();
                    stat.setVisibility(View.GONE);
                    break;
                default:
                    fab.setBackgroundTintList(greyTint);
                    serviceStarted = false;
                    fab.setImageResource(R.drawable.ic_start_idle);
                    preferences.setEnabled(true);
                    fabProgressCircle.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            hideCircle();
                        }
                    }, 100);
                    stat.setVisibility(View.GONE);
                    break;
            }
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
}