Example usage for android.os RemoteException getMessage

List of usage examples for android.os RemoteException getMessage

Introduction

In this page you can find the example usage for android.os RemoteException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.nokia.example.pepperfarm.iap.Payment.java

public boolean isBillingAvailable() {

    boolean isAvailable = false;

    try {/*  w  w  w .  j  a  v  a 2  s.c  o  m*/

        int responseCode = RESULT_ERR;

        if (npayAvailable)
            responseCode = npay.isBillingSupported(API_VERSION, activity.getPackageName(), ITEM_TYPE_INAPP);

        switch (responseCode) {
        case RESULT_OK:
            isAvailable = true;
            break;
        case RESULT_NO_SIM_CARD:
            errorAlert("No SIM. Please Insert SIM card.");
            break;
        case RESULT_ERR:
            errorAlert("Nokia In-App Payment Enabler is not available.");
            break;
        default:
            errorAlert("Billing is not supported. " + responseCode);
            break;
        }
    } catch (RemoteException e) {
        Log.e("isBillingAvailable", e.getMessage(), e);
        errorAlert("Billing is not supported. " + e.getMessage());
    }
    return isAvailable;
}

From source file:edu.vuum.mocca.ui.story.CreateStoryFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // Get the EditTexts
    titleET = (EditText) getView().findViewById(R.id.story_create_value_title);
    bodyET = (EditText) getView().findViewById(R.id.story_create_value_body);
    audioCaptureButton = (Button) getView().findViewById(R.id.story_create_value_audio_link);
    videoCaptureButton = (Button) getView().findViewById(R.id.story_create_value_video_button);
    imageNameET = (EditText) getView().findViewById(R.id.story_create_value_image_name);
    imageCaptureButton = (Button) getView().findViewById(R.id.story_create_value_image_button);
    storyTimeET = (TextView) getView().findViewById(R.id.story_create_value_story_time);
    locationButton = (Button) getView().findViewById(R.id.story_create_value_location_button);

    imageLocation = (TextView) getView().findViewById(R.id.story_create_value_image_location);
    videoLocation = (TextView) getView().findViewById(R.id.story_create_value_video_location);
    audioLocation = (TextView) getView().findViewById(R.id.story_create_value_audio_location);

    latitudeValue = (TextView) getView().findViewById(R.id.story_create_value_latitude);
    longitudeValue = (TextView) getView().findViewById(R.id.story_create_value_longitude);

    buttonClear = (Button) getView().findViewById(R.id.story_create_button_reset);
    buttonCancel = (Button) getView().findViewById(R.id.story_create_button_cancel);
    buttonCreate = (Button) getView().findViewById(R.id.story_create_button_save);

    buttonClear.setOnClickListener(new OnClickListener() {
        @Override//from ww w  .  j  a v  a  2 s  . co  m
        public void onClick(View v) {
            titleET.setText("" + "");
            bodyET.setText("" + "");
            videoCaptureButton.setText("" + "");
            imageNameET.setText("" + "");
            imageCaptureButton.setText("" + "");
            storyTimeET.setText("" + 0);
            locationButton.setText("" + 0);
        }
    });

    buttonCancel.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (getResources().getBoolean(R.bool.isTablet) == true) {
                // put
                mOpener.openViewStoryFragment(0);
            } else {
                getActivity().finish(); // same as hitting 'back' button
            }
        }
    });
    buttonCreate.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            // local Editables
            Editable titleCreateable = titleET.getText();
            Editable bodyCreateable = bodyET.getText();
            Editable imageNameCreateable = imageNameET.getText();
            String storyTimeCreateable = storyTimeET.getText().toString();

            // Try to parse the date into long format
            try {
                date = StoryData.FORMAT.parse(storyTimeCreateable.toString());
            } catch (ParseException e1) {
                // TODO Auto-generated catch block
                Log.e("CreateStoryFragment", "Date was not parsable, reverting to current time");
                date = new Date();
            }

            // For future expansion: The loginId and storyId need to be generated by the system
            long loginId = 0;
            long storyId = 0;
            String title = "";
            String body = "";
            String audioLink = "";
            String videoLink = "";
            String imageName = "";
            String imageData = "";
            long storyTime = 0;
            double latitude = 0;
            double longitude = 0;

            // pull values from Editables
            title = String.valueOf(titleCreateable.toString());
            body = String.valueOf(bodyCreateable.toString());
            if (audioPath != null)
                audioLink = audioPath;
            if (fileUri != null)
                videoLink = fileUri.toString();
            imageName = String.valueOf(imageNameCreateable.toString());
            if (imagePathFinal != null)
                imageData = imagePathFinal.toString();
            if (loc != null) {
                latitude = loc.getLatitude();
                longitude = loc.getLongitude();
            }
            storyTime = date.getTime();
            Log.i(LOG_TAG, String.valueOf(storyTime));

            // new StoryData object with above info
            StoryData newData = new StoryData(-1,
                    // -1 row index, because there is no way to know which
                    // row it will go into
                    loginId, storyId, title, body, audioLink, videoLink, imageName, imageData, "", 0, storyTime,
                    latitude, longitude);
            Log.d(CreateStoryFragment.class.getCanonicalName(), "imageName" + imageNameET.getText());

            Log.d(CreateStoryFragment.class.getCanonicalName(), "newStoryData:" + newData);

            // insert it through Resolver to be put into ContentProvider
            try {
                resolver.insert(newData);
            } catch (RemoteException e) {
                Log.e(LOG_TAG, "Caught RemoteException => " + e.getMessage());
                e.printStackTrace();
            }
            // return back to proper state
            if (getResources().getBoolean(R.bool.isTablet) == true) {
                // put
                mOpener.openViewStoryFragment(0);
            } else {
                getActivity().finish(); // same as hitting 'back' button
            }
        }
    });

}

From source file:com.ariesmcrae.mymemories.ui.story.CreateStoryFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // Get the EditTexts
    titleET = (EditText) getView().findViewById(R.id.story_create_value_title);
    bodyET = (EditText) getView().findViewById(R.id.story_create_value_body);
    audioCaptureButton = (Button) getView().findViewById(R.id.story_create_value_audio_link);
    videoCaptureButton = (Button) getView().findViewById(R.id.story_create_value_video_button);
    imageNameET = (EditText) getView().findViewById(R.id.story_create_value_image_name);
    imageCaptureButton = (Button) getView().findViewById(R.id.story_create_value_image_button);
    storyTimeET = (TextView) getView().findViewById(R.id.story_create_value_story_time);
    locationButton = (Button) getView().findViewById(R.id.story_create_value_location_button);

    imageLocation = (TextView) getView().findViewById(R.id.story_create_value_image_location);
    videoLocation = (TextView) getView().findViewById(R.id.story_create_value_video_location);
    audioLocation = (TextView) getView().findViewById(R.id.story_create_value_audio_location);

    latitudeValue = (TextView) getView().findViewById(R.id.story_create_value_latitude);
    longitudeValue = (TextView) getView().findViewById(R.id.story_create_value_longitude);

    buttonClear = (Button) getView().findViewById(R.id.story_create_button_reset);
    buttonCancel = (Button) getView().findViewById(R.id.story_create_button_cancel);
    buttonCreate = (Button) getView().findViewById(R.id.story_create_button_save);

    buttonClear.setOnClickListener(new OnClickListener() {
        @Override// w  w  w  .j a  va 2 s . c  o m
        public void onClick(View v) {
            titleET.setText("" + "");
            bodyET.setText("" + "");
            imageNameET.setText("" + "");
            imageLocation.setText("" + "");
            videoLocation.setText("" + "");
            audioLocation.setText("" + "");
            storyTimeET.setText("Click text to set");
            latitudeValue.setText("" + "0");
            longitudeValue.setText("" + "0");
        }
    });

    buttonCancel.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (getResources().getBoolean(R.bool.isTablet) == true) {
                // put
                mOpener.openViewStoryFragment(0);
            } else {
                getActivity().finish(); // same as hitting 'back' button
            }
        }
    });
    buttonCreate.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            // local Editables
            Editable titleCreateable = titleET.getText();
            Editable bodyCreateable = bodyET.getText();
            Editable imageNameCreateable = imageNameET.getText();
            String storyTimeCreateable = storyTimeET.getText().toString();

            // Try to parse the date into long format
            try {
                date = StoryData.FORMAT.parse(storyTimeCreateable.toString());
            } catch (ParseException e1) {
                Log.e("CreateStoryFragment", "Date was not parsable, reverting to current time");
                date = new Date();
            }

            // For future expansion: The loginId and storyId need to be
            // generated by the system
            long loginId = 0;
            long storyId = 0;
            String title = "";
            String body = "";
            String audioLink = "";
            String videoLink = "";
            String imageName = "";
            String imageData = "";
            long storyTime = 0;
            double latitude = 0;
            double longitude = 0;

            // pull values from Editables
            title = String.valueOf(titleCreateable.toString());
            body = String.valueOf(bodyCreateable.toString());
            if (audioPath != null)
                audioLink = audioPath;
            if (fileUri != null)
                videoLink = fileUri.toString();
            imageName = String.valueOf(imageNameCreateable.toString());
            if (imagePathFinal != null)
                imageData = imagePathFinal.toString();
            if (loc != null) {
                latitude = loc.getLatitude();
                longitude = loc.getLongitude();
            }
            storyTime = date.getTime();
            Log.i(LOG_TAG, String.valueOf(storyTime));

            // new StoryData object with above info
            StoryData newData = new StoryData(-1,
                    // -1 row index, because there is no way to know which
                    // row it will go into
                    loginId, storyId, title, body, audioLink, videoLink, imageName, imageData, "", 0, storyTime,
                    latitude, longitude);
            Log.d(CreateStoryFragment.class.getCanonicalName(), "imageName" + imageNameET.getText());

            Log.d(CreateStoryFragment.class.getCanonicalName(), "newStoryData:" + newData);

            // insert it through Resolver to be put into ContentProvider
            try {
                resolver.insert(newData);
            } catch (RemoteException e) {
                Log.e(LOG_TAG, "Caught RemoteException => " + e.getMessage());
                e.printStackTrace();
            }
            // return back to proper state
            if (getResources().getBoolean(R.bool.isTablet) == true) {
                // put
                mOpener.openViewStoryFragment(0);
            } else {
                getActivity().finish(); // same as hitting 'back' button
            }
        }
    });

}

From source file:com.renard.ocr.OCRActivity.java

private void saveDocument(final Pix pix, final String hocrString, final String utf8String,
        final boolean checkSd) {
    //      if (checkSd && !Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
    //         waitForSdCard(pix, hocrString, utf8String);
    //      } else {

    Util.startBackgroundJob(OCRActivity.this, "", getText(R.string.saving_document).toString(), new Runnable() {

        @Override//  w  w w. j  av a  2  s.  c o  m
        public void run() {
            File imageFile = null;
            Uri documentUri = null;
            try {
                if (checkSd) {
                    imageFile = saveImage(pix);
                }
                documentUri = saveDocumentToDB(imageFile, hocrString, utf8String);
                Util.createThumbnail(OCRActivity.this, imageFile,
                        Integer.valueOf(documentUri.getLastPathSegment()));
            } catch (RemoteException e) {
                e.printStackTrace();
                Log.e(TAG, e.getMessage());
                e.printStackTrace();
                runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        Toast.makeText(getApplicationContext(), getText(R.string.error_create_file),
                                Toast.LENGTH_LONG).show();
                    }
                });
            } catch (IOException e) {
                e.printStackTrace();
                Log.e(TAG, e.getMessage());
                runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        Toast.makeText(getApplicationContext(), getText(R.string.error_create_file),
                                Toast.LENGTH_LONG).show();
                    }
                });
            } finally {
                if (pix != null) {
                    pix.recycle();
                }
                if (documentUri != null) {
                    Intent i = new Intent(OCRActivity.this, DocumentActivity.class);
                    i.putExtra(DocumentActivity.EXTRA_ASK_FOR_TITLE, true);
                    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    i.setData(documentUri);
                    startActivity(i);
                    finish();
                }
            }
        }
    }, new Handler());
    //   }

}

From source file:org.onepf.oms.appstore.SamsungAppsBillingService.java

@Override
public Inventory queryInventory(boolean querySkuDetails, List<String> moreItemSkus, List<String> moreSubsSkus)
        throws IabException {
    Inventory inventory = new Inventory();

    Date date = new Date();
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd", Locale.getDefault());
    String today = simpleDateFormat.format(date);

    /* Get all itemGroupIds from existing skus */
    Set<String> itemGroupIds = new HashSet<String>();
    List<String> storeSkus = OpenIabHelper.getAllStoreSkus(OpenIabHelper.NAME_SAMSUNG);
    for (String sku : storeSkus) {
        itemGroupIds.add(getItemGroupId(sku));
    }//from www.ja  va  2 s  . com

    /* Query getItemsInbox for each itemGroupId */
    for (String itemGroupId : itemGroupIds) {
        int startNum = 1;
        int endNum = ITEM_RESPONSE_COUNT;
        Bundle itemInbox;
        do {
            itemInbox = null;
            try {
                if (isDebugLog())
                    Log.d(TAG, "getItemsInbox, startNum = " + startNum + ", endNum = " + endNum);
                itemInbox = mIapConnector.getItemsInbox(activity.getPackageName(), itemGroupId, startNum,
                        endNum, "19700101", today);
            } catch (RemoteException e) {
                Log.e(TAG, "Samsung getItemsInbox: " + e.getMessage());
            }
            startNum += ITEM_RESPONSE_COUNT;
            endNum += ITEM_RESPONSE_COUNT;
        } while (processItemsBundle(itemInbox, itemGroupId, inventory, querySkuDetails, true, false, null));
    }
    if (querySkuDetails) {
        Set<String> queryItemGroupIds = new HashSet<String>();
        Set<String> queryItemIds = new HashSet<String>();
        if (moreItemSkus != null) {
            for (String sku : moreItemSkus) {
                queryItemGroupIds.add(getItemGroupId(sku));
                queryItemIds.add(getItemId(sku));
            }
        }
        if (moreSubsSkus != null) {
            for (String sku : moreSubsSkus) {
                queryItemGroupIds.add(getItemGroupId(sku));
                queryItemIds.add(getItemId(sku));
            }
        }
        if (!queryItemIds.isEmpty()) {
            for (String itemGroupId : queryItemGroupIds) {
                int startNum = 1;
                int endNum = ITEM_RESPONSE_COUNT;
                Bundle itemList;
                do {
                    itemList = null;
                    try {
                        itemList = mIapConnector.getItemList(CURRENT_MODE, activity.getPackageName(),
                                itemGroupId, startNum, endNum, ITEM_TYPE_ALL);
                    } catch (RemoteException e) {
                        Log.e(TAG, "Samsung getItemList: " + e.getMessage());
                    }
                    startNum += ITEM_RESPONSE_COUNT;
                    endNum += ITEM_RESPONSE_COUNT;
                } while (processItemsBundle(itemList, itemGroupId, inventory, querySkuDetails, false, true,
                        queryItemIds));
            }
        }
    }
    return inventory;
}

From source file:com.drinviewer.droiddrinviewer.ServerListFragment.java

/**
 * Runs the server discovery protocol, if the
 * service is not doing an update by itself.
 * Called by the Refresh List menu item/*w w  w.  j  ava 2s .  co m*/
 * 
 */
public void doDiscover() {

    boolean doDiscover = true;

    try {
        if (discoverServerApi != null) {
            // force a discover only if the service is not doing it already
            doDiscover = !discoverServerApi.isRunning();
        } else {
            doDiscover = true;
        }
    } catch (RemoteException e) {
        // on remote error, don't run the discover process
        doDiscover = false;
        Toast.makeText(mActivity.getBaseContext(), e.getMessage(), Toast.LENGTH_LONG).show();
    } finally {
        if (doDiscover) {
            // run the discover by sending a message broadcast_startdiscovery to the DrinViewerBroadcastReceiver
            Intent intent = new Intent(mActivity, DrinViewerBroadcastReceiver.class);
            intent.setAction(getResources().getString(R.string.broadcast_startdiscovery));
            mActivity.sendBroadcast(intent);
        }
    }
}

From source file:com.nps.micro.MainActivity.java

private void unbindFromUsbService() {
    if (isBoundToService) {
        Log.d(TAG, "Unbinding nps usb service...");
        // If we have received the service, and hence registered with it,
        // then now is the time to unregister.
        if (messengerService != null) {
            try {
                Message msg = Message.obtain(null, UsbService.MSG_UNREGISTER_CLIENT);
                msg.replyTo = messengerService;
                messengerService.send(msg);
            } catch (RemoteException e) {
                Log.d(TAG, "Cannot unregister client from service: " + e.getMessage());
                // There is nothing special we need to do if the service has
                // crashed.
            }// ww w . j  a v  a  2s  .c  om
        }
        // Detach our existing connection.
        unbindService(usbServiceConnection);
        isBoundToService = false;
    }
}

From source file:com.somexapps.wyre.services.MediaService.java

private void initMediaSessions() {
    // Initialize player
    mediaPlayer = new MediaPlayer();

    // Add listener to handle completion of song
    mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
        @Override//from  w w  w .  j  a v a 2  s .c o m
        public void onCompletion(MediaPlayer mp) {
            // Send intent to play next song in MediaService list
            Intent nextSong = new Intent(getApplicationContext(), MediaService.class);
            nextSong.setAction(ACTION_NEXT);
            startService(nextSong);
        }
    });

    // Set up session and controller
    // Create the media session
    mediaSession = new MediaSessionCompat(this, MEDIA_SESSION_TAG, mediaSessionComponentName, null);

    // Set up controller
    try {
        mediaController = new MediaControllerCompat(getApplicationContext(), mediaSession.getSessionToken());
    } catch (RemoteException e) {
        Log.e(TAG, "Unable to set up media controller: " + e.getMessage());
    }

    // Set up callbacks for media session
    mediaSession.setCallback(new MediaSessionCompat.Callback() {
        @Override
        public void onPlay() {
            super.onPlay();
            Log.d(TAG, "Playing media");
            buildNotification(generateAction(R.drawable.ic_pause_white_36dp,
                    getString(R.string.media_service_notification_pause), ACTION_PAUSE));
        }

        @Override
        public void onPause() {
            super.onPause();
            Log.d(TAG, "Pausing media");
            buildNotification(generateAction(R.drawable.ic_play_arrow_white_36dp,
                    getString(R.string.media_service_notification_play), ACTION_PLAY));
        }

        @Override
        public void onSkipToNext() {
            super.onSkipToNext();
            Log.d(TAG, "Skipping to next song");

            // Update the notification with the next song info
            buildNotification(generateAction(R.drawable.ic_pause_white_36dp,
                    getString(R.string.media_service_notification_pause), ACTION_PAUSE));
        }

        @Override
        public void onSkipToPrevious() {
            super.onSkipToPrevious();
            Log.d(TAG, "Skipping to previous song");

            // Update the notification with the previous song info
            buildNotification(generateAction(R.drawable.ic_pause_white_36dp,
                    getString(R.string.media_service_notification_pause), ACTION_PAUSE));
        }

        @Override
        public void onFastForward() {
            super.onFastForward();
        }

        @Override
        public void onRewind() {
            super.onRewind();
        }

        @Override
        public void onStop() {
            super.onStop();
        }

        @Override
        public void onSeekTo(long pos) {
            super.onSeekTo(pos);
        }

        @Override
        public void onSetRating(RatingCompat rating) {
            super.onSetRating(rating);
        }
    });
}

From source file:org.droid2droid.internal.AbstractRemoteAndroidImpl.java

@Override
public boolean unbindService(ServiceConnection conn) {
    synchronized (mBinders) {
        Binded binder = mBinders.get(conn);
        if (binder != null) {
            if (D)
                Log.d(TAG_CLIENT_BIND, PREFIX_LOG + "UnBindOID...");
            Parcel data = Parcel.obtain();
            Parcel reply = Parcel.obtain();
            try {

                try {
                    data.writeInt(System.identityHashCode(conn));
                    transactRemoteAndroid(getConnectionId(), UNBIND_SRV, data, reply, 0, mExecuteTimeout);
                    if (D)
                        Log.d(TAG_CLIENT_BIND, PREFIX_LOG + "UnBindOID ok");
                } catch (RemoteException e) {
                    if (W && !D)
                        Log.w(TAG_CLIENT_BIND, "Error when unbind (" + e.getMessage() + ")");
                    if (D)
                        Log.w(TAG_CLIENT_BIND, "Errer when unbind", e);
                }//w w w.jav  a2 s.  c  o  m
            } finally {
                if (data != null)
                    data.recycle();
                if (reply != null)
                    reply.recycle();
            }
            mBinders.remove(conn);
        } else
            return false;
    }

    return true;
}

From source file:bucci.dev.freestyle.TimerActivity.java

private void sendMessageToService(int messageType) {
    if (DEBUG)/*from w w  w  .  j  a va 2  s  .co m*/
        Log.d(TAG, "sendMessageToService(" + messageType + ")");
    Message msg = Message.obtain();
    msg.what = messageType;
    switch (messageType) {
    case MSG_START_TIMER:
        if (isTimerResumed())
            msg.obj = timeLeft;
        else
            msg.obj = startTime;
        break;
    case MSG_STOP_TIMER:
        if (DEBUG)
            Log.i(TAG, "startTime: " + startTime);
        msg.obj = startTime;
        break;
    }

    try {
        service.send(msg);
    } catch (RemoteException e) {
        if (DEBUG)
            Log.e(TAG, "sendMessage RemoteException, e: " + e.getMessage());
        e.printStackTrace();
    }
}