コード例 #1
0
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   CardPresenter cardPresenter = mCardPresenters.get(position);
   PendingIntent pendingIntent = cardPresenter.getPendingIntent();
   if (pendingIntent != null) {
     try {
       pendingIntent.send();
     } catch (CanceledException e) {
       Log.w(TAG, e.getMessage());
     }
   } else {
     Log.w(TAG, "No PendingIntent attached to card!");
   }
 }
コード例 #2
0
  private void openSMSComposer(String message) {
    System.out.println("openSMSComposer");

    // Intent sentIntent = new Intent(Intent.ACTION_VIEW);
    // sentIntent.putExtra("sms_body", message);
    // sentIntent.setType("vnd.android-dir/mms-sms");
    // this.cordova.getActivity().startActivity(sentIntent);

    PendingIntent sentIntent =
        PendingIntent.getActivity(this.cordova.getActivity(), 0, new Intent(Intent.ACTION_VIEW), 0);
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.putExtra("sms_body", message);
    intent.setType("vnd.android-dir/mms-sms");
    // this.cordova.getActivity().startActivity(sentIntent);
    try {
      sentIntent.send(this.cordova.getActivity().getApplicationContext(), 0, intent);
    } catch (CanceledException e) {
      System.out.println(e.getMessage());
      e.printStackTrace();
    }

    System.out.println("sent sms");
  }