Example usage for android.content Intent ACTION_DIAL

List of usage examples for android.content Intent ACTION_DIAL

Introduction

In this page you can find the example usage for android.content Intent ACTION_DIAL.

Prototype

String ACTION_DIAL

To view the source code for android.content Intent ACTION_DIAL.

Click Source Link

Document

Activity Action: Dial a number as specified by the data.

Usage

From source file:com.tingtingapps.securesms.ConversationActivity.java

private void handleDial(Recipient recipient) {
    try {/*from   ww  w.  ja v a2 s .  c o m*/
        if (recipient == null)
            return;

        Intent dialIntent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + recipient.getNumber()));
        startActivity(dialIntent);
    } catch (ActivityNotFoundException anfe) {
        Log.w(TAG, anfe);
        Dialogs.showAlertDialog(this, getString(R.string.ConversationActivity_calls_not_supported),
                getString(R.string.ConversationActivity_this_device_does_not_appear_to_support_dial_actions));
    }
}

From source file:com.mobicage.rogerthat.plugins.messaging.MessagingPlugin.java

public Map<String, String> getButtonActionInfo(ButtonTO button) {
    String buttonAction = null;/*  w w w. jav a  2  s  . c  om*/
    String buttonUrl = null;

    if (button.action != null) {
        if (button.action.startsWith(Message.MC_TEL_PREFIX)) {
            buttonAction = Intent.ACTION_DIAL;
            buttonUrl = ANDROID_TEL_PREFIX + button.action.substring(Message.MC_TEL_PREFIX.length());

        } else if (button.action.startsWith(Message.MC_HTTP_PREFIX)) {
            buttonAction = Intent.ACTION_VIEW;
            buttonUrl = ANDROID_HTTP_PREFIX + button.action.substring(Message.MC_HTTP_PREFIX.length());

        } else if (button.action.startsWith(Message.MC_GEO_PREFIX)) {
            buttonAction = Intent.ACTION_VIEW;
            buttonUrl = ANDROID_GEO_PREFIX + button.action.substring(Message.MC_GEO_PREFIX.length());

        } else if (button.action.startsWith(Message.MC_HTTPS_PREFIX)) {
            buttonAction = Intent.ACTION_VIEW;
            buttonUrl = ANDROID_HTTPS_PREFIX + button.action.substring(Message.MC_HTTPS_PREFIX.length());

        } else if (button.action.startsWith(Message.MC_MAILTO_PREFIX)) {
            buttonAction = Intent.ACTION_VIEW;
            buttonUrl = ANDROID_MAILTO_PREFIX + button.action.substring(Message.MC_MAILTO_PREFIX.length());

        } else if (button.action.startsWith(Message.MC_CONFIRM_PREFIX)) {
            buttonAction = Message.MC_CONFIRM_PREFIX;
            buttonUrl = button.action.substring(Message.MC_CONFIRM_PREFIX.length());
        }
    }

    Map<String, String> info = new HashMap<String, String>();
    info.put("androidAction", buttonAction);
    info.put("androidUrl", buttonUrl);

    return info;
}

From source file:tw.net.ezcall.ui.SipHome.java

private void selectTabWithAction(Intent intent) {
    if (intent != null) {
        String callAction = intent.getAction();
        if (!TextUtils.isEmpty(callAction)) {
            ActionBar ab = getSupportActionBar();
            Tab toSelectTab = null;/*ww  w .j av  a2s  . c  o  m*/
            Integer toSelectId = null;
            if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_DIALER)
                    || callAction.equalsIgnoreCase(Intent.ACTION_DIAL)
                    || callAction.equalsIgnoreCase(Intent.ACTION_VIEW)
                    || callAction.equalsIgnoreCase(Intent.ACTION_SENDTO) /*
                                                                         * TODO
                                                                         * :
                                                                         * sendto
                                                                         * should
                                                                         * im
                                                                         * if
                                                                         * not
                                                                         * csip
                                                                         * ?
                                                                         */) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_DIALER);
                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    Uri data = intent.getData();
                    String nbr = UriUtils.extractNumberFromIntent(intent, this);

                    if (!TextUtils.isEmpty(nbr)) {
                        if (data != null && mDialpadFragment != null) {
                            mDialpadFragment.setTextDialing(true);
                            mDialpadFragment.setTextFieldValue(nbr);
                        } else {
                            initDialerWithText = nbr;
                        }
                    }
                    toSelectId = TAB_ID_DIALER;
                }
            } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_CALLLOG)) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_CALL_LOG);
                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    toSelectId = TAB_ID_CALL_LOG;
                }
            } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_FAVORITES)) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_FAVORITES);
                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    toSelectId = TAB_ID_FAVORITES;
                }
            } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_MESSAGES)) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_MESSAGES);
                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    toSelectId = TAB_ID_MESSAGES;
                }
            }
            if (toSelectTab != null) {
                ab.selectTab(toSelectTab);
                initTabId = toSelectId;
            } else {
                initTabId = 0;
            }

        }
    }
}

From source file:com.csipsimple.ui.SipHome.java

private void selectTabWithAction(Intent intent) {
    if (intent != null) {
        String callAction = intent.getAction();
        if (!TextUtils.isEmpty(callAction)) {
            ActionBar ab = getSupportActionBar();
            Tab toSelectTab = null;// w w  w .  j  a v  a  2s  . c o m
            Integer toSelectId = null;
            if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_DIALER)
                    || callAction.equalsIgnoreCase(Intent.ACTION_DIAL)
                    || callAction.equalsIgnoreCase(Intent.ACTION_VIEW) || callAction.equalsIgnoreCase(
                            Intent.ACTION_SENDTO) /* TODO : sendto should im if not csip? */) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_DIALER);
                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    Uri data = intent.getData();
                    String nbr = UriUtils.extractNumberFromIntent(intent, this);

                    if (!TextUtils.isEmpty(nbr)) {
                        if (data != null && mDialpadFragment != null) {
                            mDialpadFragment.setTextDialing(true);
                            mDialpadFragment.setTextFieldValue(nbr);
                        } else {
                            initDialerWithText = nbr;
                        }
                    }
                    toSelectId = TAB_ID_DIALER;
                }
            } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_CALLLOG)) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_CALL_LOG);
                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    toSelectId = TAB_ID_CALL_LOG;
                }
            } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_FAVORITES)) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_FAVORITES);
                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    toSelectId = TAB_ID_FAVORITES;
                }
            } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_MESSAGES)) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_MESSAGES);
                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    toSelectId = TAB_ID_MESSAGES;
                }
            }
            if (toSelectTab != null) {
                ab.selectTab(toSelectTab);
                initTabId = toSelectId;
            } else {
                initTabId = 0;
            }

        }
    }
}

From source file:org.sipdroid.sipua.ui.Receiver.java

static Intent createMWIIntent() {
    Intent intent;//from www . j av  a  2  s. c  o m

    if (MWI_account != null)
        intent = new Intent(Intent.ACTION_CALL, Uri.parse(MWI_account.replaceFirst("sip:", "sipdroid:")));
    else
        intent = new Intent(Intent.ACTION_DIAL);
    return intent;
}

From source file:com.sonetel.ui.SipHome.java

private void selectTabWithAction(Intent intent) {
    if (intent != null) {
        String callAction = intent.getAction();
        if (!TextUtils.isEmpty(callAction)) {
            ActionBar ab = getSupportActionBar();
            Tab toSelectTab = null;//  w ww. j  a  v  a  2s. co  m
            Integer toSelectId = null;
            if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_DIALER)
                    || callAction.equalsIgnoreCase(Intent.ACTION_DIAL)) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_DIALER);
                if (pos != null && pos == 1) {
                    toSelectTab = ab.getTabAt(pos);
                    Uri data = intent.getData();
                    if (data != null && mDialpadFragment != null) {
                        String nbr = data.getSchemeSpecificPart();
                        if (!TextUtils.isEmpty(nbr)) {
                            mDialpadFragment.setTextDialing(true);
                            mDialpadFragment.setTextFieldValue(nbr);
                        }
                    }
                    toSelectId = TAB_ID_DIALER;
                } else if (pos != null && pos == 2) {
                    toSelectTab = ab.getTabAt(pos);
                    Uri data = intent.getData();
                    if (data != null && mDialpadFragment != null) {
                        String nbr = data.getSchemeSpecificPart();
                        if (!TextUtils.isEmpty(nbr)) {
                            mDialpadFragment.setTextDialing(false);
                            mDialpadFragment.setTextFieldValue(nbr);
                        }
                    }
                    toSelectId = TAB_ID_CONTACT;
                }
            }
            /* else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_DIALER)
                || callAction.equalsIgnoreCase(Intent.ACTION_DIAL)) {
            Integer pos = mTabsAdapter.getPositionForId(TAB_ID_CONTACT);
            mDialpadFragment.setTextDialing(false);
            if(pos != null) {
                toSelectTab = ab.getTabAt(pos);
                Uri data = intent.getData();
                if(data != null && mDialpadFragment != null) {
                    String nbr = data.getSchemeSpecificPart();
                    if(!TextUtils.isEmpty(nbr)) {
                        mDialpadFragment.setTextDialing(false);
                        mDialpadFragment.setTextFieldValue(nbr);
                    }
                }
                toSelectId = TAB_ID_CONTACT;
            }
             }*/
            else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_CALLLOG)) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_CALL_LOG);
                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    toSelectId = TAB_ID_CALL_LOG;
                }
            } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_FAVORITES)) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_FAVORITES);
                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    toSelectId = TAB_ID_FAVORITES;
                }
            } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_MESSAGES)) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_MESSAGES);
                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    toSelectId = TAB_ID_MESSAGES;
                }
            }
            if (toSelectTab != null) {
                ab.selectTab(toSelectTab);
                initTabId = toSelectId;
            } else {
                initTabId = null;
            }

        }
    }
}

From source file:com.fututel.ui.SipHome.java

private void selectTabWithAction(Intent intent) {
    if (intent != null) {
        String callAction = intent.getAction();
        if (!TextUtils.isEmpty(callAction)) {
            ActionBar ab = getSupportActionBar();
            Tab toSelectTab = null;//from  w w  w . j  av a 2s  .  c o m
            Integer toSelectId = null;
            if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_DIALER)
                    || callAction.equalsIgnoreCase(Intent.ACTION_DIAL)
                    || callAction.equalsIgnoreCase(Intent.ACTION_VIEW) || callAction.equalsIgnoreCase(
                            Intent.ACTION_SENDTO) /* TODO : sendto should im if not csip? */) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_DIALER);
                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    Uri data = intent.getData();
                    String nbr = UriUtils.extractNumberFromIntent(intent, this);

                    if (!TextUtils.isEmpty(nbr)) {
                        if (data != null && mDialpadFragment != null) {
                            mDialpadFragment.setTextDialing(true);
                            mDialpadFragment.setTextFieldValue(nbr);
                        } else {
                            initDialerWithText = nbr;
                        }
                    }
                    toSelectId = TAB_ID_DIALER;
                }
            } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_CALLLOG)) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_CALL_LOG);
                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    toSelectId = TAB_ID_CALL_LOG;
                }
            } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_FAVORITES)) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_FAVORITES);
                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    toSelectId = TAB_ID_FAVORITES;
                }
            } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_MESSAGES)) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_MESSAGES);
                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    toSelectId = TAB_ID_MESSAGES;
                }
            } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_CHAT)) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_CHAT);
                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    toSelectId = TAB_ID_CHAT;
                }
            }
            if (toSelectTab != null) {
                ab.selectTab(toSelectTab);
                initTabId = toSelectId;
            } else {
                initTabId = 0;
            }

        }
    }
}

From source file:com.newcell.calltext.ui.SipHome.java

private void selectTabWithAction(Intent intent) {
    if (intent != null) {
        String callAction = intent.getAction();

        if (!TextUtils.isEmpty(callAction)) {

            ActionBar ab = getSupportActionBar();
            Tab toSelectTab = null;/*from  w ww . j  ava2 s  .co  m*/
            Integer toSelectId = null;
            if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_DIALER)
                    || callAction.equalsIgnoreCase(Intent.ACTION_DIAL)
                    || callAction.equalsIgnoreCase(Intent.ACTION_VIEW)) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_DIALER);
                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    Uri data = intent.getData();
                    String nbr = UriUtils.extractNumberFromIntent(intent, this);

                    if (!TextUtils.isEmpty(nbr)) {
                        if (data != null && mDialpadFragment != null) {
                            mDialpadFragment.setTextDialing(true);
                            mDialpadFragment.setTextFieldValue(nbr);
                        } else {
                            initDialerWithText = nbr;
                        }
                    }
                    toSelectId = TAB_ID_DIALER;
                }
            } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_CALLLOG)) {
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_CALL_LOG);
                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    toSelectId = TAB_ID_CALL_LOG;
                }
            } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_MESSAGES)
                    || callAction.equalsIgnoreCase(Intent.ACTION_SENDTO)) {
                Uri callUri = intent.getData();
                Integer pos = mTabsAdapter.getPositionForId(TAB_ID_MESSAGES);

                if (pos != null) {
                    toSelectTab = ab.getTabAt(pos);
                    toSelectId = TAB_ID_MESSAGES;

                    if (callUri != null) {
                        String phoneNumber = callUri.getEncodedSchemeSpecificPart();
                        // User selected 'Send text message' from a contact in their contact list
                        // Switch to the messaging tab, and then open up the MessageFragment to them

                        // Open up a new MessageFragment to the contact they selected
                        Bundle b = MessageFragment.getArguments(phoneNumber, null);
                        Intent it = new Intent(this, MessageActivity.class);
                        it.putExtras(b);
                        startActivity(it);
                    }
                }
            }
            if (toSelectTab != null) {
                ab.selectTab(toSelectTab);
                initTabId = toSelectId;
            } else {
                initTabId = 0;
            }

        }
    }
}

From source file:com.youti.chat.activity.ChatActivity.java

/**
 * ?//from   w w w  . j a  v  a  2 s  .c o m
 * 
 * @param view
 */
@Override
public void onClick(View view) {
    String st1 = getResources().getString(R.string.not_connect_to_server);
    int id = view.getId();
    if (id == R.id.btn_send) {// ??(?)
        String s = mEditTextContent.getText().toString();
        sendText(s);
    } else if (id == R.id.btn_take_picture) {
        selectPicFromCamera();// 
    } else if (id == R.id.btn_picture) {
        selectPicFromLocal(); // 
    } else if (id == R.id.btn_location) { // ?
        startActivityForResult(new Intent(this, BaiduMapActivity.class), REQUEST_CODE_MAP);
    } else if (id == R.id.iv_emoticons_normal) { // 
        more.setVisibility(View.VISIBLE);
        iv_emoticons_normal.setVisibility(View.INVISIBLE);
        iv_emoticons_checked.setVisibility(View.VISIBLE);
        btnContainer.setVisibility(View.GONE);
        emojiIconContainer.setVisibility(View.VISIBLE);
        hideKeyboard();
    } else if (id == R.id.iv_emoticons_checked) { // ??
        iv_emoticons_normal.setVisibility(View.VISIBLE);
        iv_emoticons_checked.setVisibility(View.INVISIBLE);
        btnContainer.setVisibility(View.VISIBLE);
        emojiIconContainer.setVisibility(View.GONE);
        more.setVisibility(View.GONE);

    } else if (id == R.id.btn_video) {
        // ?
        Intent intent = new Intent(ChatActivity.this, ImageGridActivity.class);
        startActivityForResult(intent, REQUEST_CODE_SELECT_VIDEO);
    } else if (id == R.id.bt_phone400) {
        Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel://400-696-8080"));
        startActivity(intent);
    } else if (id == R.id.bt_online) {
        if (YoutiApplication.getInstance().myPreference.getHasLogin()) {
            Bundle b = new Bundle();
            b.putString(Constants.KEY_CHAT_USERNAME, Constants.CHAT_KEFU_NAME);
            b.putString(Constants.KEY_CHAT_TEL, Constants.CHAT_KEFU_NAME1);
            b.putInt("chatType", 1);
            IntentJumpUtils.nextActivity(ChatActivity.class, this, b);
        } else {
            IntentJumpUtils.nextActivity(LoginActivity.class, this, null);
        }
    } /*else if (id == R.id.bt_phone400) { // 
                
        selectFileFromLocal();
      } else if (id == R.id.btn_voice_call) { // ?
        if (!EMChatManager.getInstance().isConnected())
      Toast.makeText(this, st1, 0).show();
        else
      startActivity(new Intent(ChatActivity.this, VoiceCallActivity.class).putExtra("username",toTel).putExtra("isComingCall", false));
      } else if (id == R.id.btn_video_call) { // ?
        if (!EMChatManager.getInstance().isConnected())
      Toast.makeText(this, st1, 0).show();
        else
      startActivity(new Intent(this, VideoCallActivity.class).putExtra("username", toTel).putExtra(
            "isComingCall", false));
      }*/
}

From source file:com.android.contacts.activities.DialtactsActivity.java

/** Returns true if the given intent contains a phone number to populate the dialer with */
private boolean isDialIntent(Intent intent) {
    final String action = intent.getAction();
    if (Intent.ACTION_DIAL.equals(action) || ACTION_TOUCH_DIALER.equals(action)) {
        return true;
    }//from   w  ww  .  j  av  a 2  s .c o  m
    if (Intent.ACTION_VIEW.equals(action)) {
        final Uri data = intent.getData();
        if (data != null && Constants.SCHEME_TEL.equals(data.getScheme())) {
            return true;
        }
    }
    return false;
}