Activity总是要来回跳转的,发现积累个ACTION列表是必要的...
1. 电话
(1) 拔打一个号码,号码为传入参数
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
if (tm.getCallState() == TelephonyManager.CALL_STATE_IDLE) { //其实,这个可以不要的,只是判断一下当前phone的状态,如果为IDLE,才允许呼叫~
Intent callIntent = new Intent(Intent.ACTION_CALL_PRIVILEGED,Uri.fromParts("tel", mNumber, null));
startActivity(callIntent);
}
|
2. 短信
(1) 发送短信给一个号码,号码为传入参数
Intent SMSIntent = new Intent(Intent.ACTION_SENDTO,
Uri.fromParts(Constants.SCHEME_SMSTO, Number, null));
startActivity(SMSIntent);
|
(2) 通过短信将一个内容发送出去,内容为传入参数
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("text/plain");
sendIntent.putExtra("sms_body", "sms body");
|
//这个。。有可能系统会让选择用蓝牙还是信息
3.
附:2.2源码中的ACTION定义
androidsrc> grep ACTION_ frameworks/base/core/java/android/content/Intent.java | grep String
public static final String ACTION_MAIN = "android.intent.action.MAIN";
public static final String ACTION_VIEW = "android.intent.action.VIEW";
public static final String ACTION_DEFAULT = ACTION_VIEW;
public static final String ACTION_ATTACH_DATA = "android.intent.action.ATTACH_DATA";
public static final String ACTION_EDIT = "android.intent.action.EDIT";
public static final String ACTION_INSERT_OR_EDIT = "android.intent.action.INSERT_OR_EDIT";
public static final String ACTION_PICK = "android.intent.action.PICK";
public static final String ACTION_CREATE_SHORTCUT = "android.intent.action.CREATE_SHORTCUT";
public static final String ACTION_CHOOSER = "android.intent.action.CHOOSER";
public static final String ACTION_GET_CONTENT = "android.intent.action.GET_CONTENT";
public static final String ACTION_DIAL = "android.intent.action.DIAL";
public static final String ACTION_CALL = "android.intent.action.CALL";
public static final String ACTION_CALL_EMERGENCY = "android.intent.action.CALL_EMERGENCY";
public static final String ACTION_CALL_PRIVILEGED = "android.intent.action.CALL_PRIVILEGED";
public static final String ACTION_IP_CALL_PRIVILEGED = "android.intent.action.IP_CALL_PRIVILEGED";
public static final String ACTION_SENDTO = "android.intent.action.SENDTO";
public static final String ACTION_SEND = "android.intent.action.SEND";
public static final String ACTION_SEND_MULTIPLE = "android.intent.action.SEND_MULTIPLE";
public static final String ACTION_ANSWER = "android.intent.action.ANSWER";
public static final String ACTION_INSERT = "android.intent.action.INSERT";
public static final String ACTION_DELETE = "android.intent.action.DELETE";
public static final String ACTION_RUN = "android.intent.action.RUN";
public static final String ACTION_SYNC = "android.intent.action.SYNC";
public static final String ACTION_PICK_ACTIVITY = "android.intent.action.PICK_ACTIVITY";
public static final String ACTION_SEARCH = "android.intent.action.SEARCH";
public static final String ACTION_SYSTEM_TUTORIAL = "android.intent.action.SYSTEM_TUTORIAL";
public static final String ACTION_WEB_SEARCH = "android.intent.action.WEB_SEARCH";
public static final String ACTION_ALL_APPS = "android.intent.action.ALL_APPS";
public static final String ACTION_SET_WALLPAPER = "android.intent.action.SET_WALLPAPER";
public static final String ACTION_BUG_REPORT = "android.intent.action.BUG_REPORT";
public static final String ACTION_FACTORY_TEST = "android.intent.action.FACTORY_TEST";
public static final String ACTION_CALL_BUTTON = "android.intent.action.CALL_BUTTON";
public static final String ACTION_VOICE_COMMAND = "android.intent.action.VOICE_COMMAND";
public static final String ACTION_SEARCH_LONG_PRESS = "android.intent.action.SEARCH_LONG_PRESS";
public static final String ACTION_APP_ERROR = "android.intent.action.APP_ERROR";
public static final String ACTION_POWER_USAGE_SUMMARY = "android.intent.action.POWER_USAGE_SUMMARY";
public static final String ACTION_UPGRADE_SETUP = "android.intent.action.UPGRADE_SETUP";
public static final String ACTION_SCREEN_OFF = "android.intent.action.SCREEN_OFF";
public static final String ACTION_SCREEN_ON = "android.intent.action.SCREEN_ON";
public static final String ACTION_USER_PRESENT = "android.intent.action.USER_PRESENT";
public static final String ACTION_TIME_TICK = "android.intent.action.TIME_TICK";
public static final String ACTION_TIME_CHANGED = "android.intent.action.TIME_SET";
public static final String ACTION_DATE_CHANGED = "android.intent.action.DATE_CHANGED";
public static final String ACTION_TIMEZONE_CHANGED = "android.intent.action.TIMEZONE_CHANGED";
public static final String ACTION_ALARM_CHANGED = "android.intent.action.ALARM_CHANGED";
public static final String ACTION_SYNC_STATE_CHANGED
public static final String ACTION_BOOT_COMPLETED = "android.intent.action.BOOT_COMPLETED";
public static final String ACTION_CLOSE_SYSTEM_DIALOGS = "android.intent.action.CLOSE_SYSTEM_DIALOGS";
public static final String ACTION_PACKAGE_INSTALL = "android.intent.action.PACKAGE_INSTALL";
public static final String ACTION_PACKAGE_ADDED = "android.intent.action.PACKAGE_ADDED";
public static final String ACTION_PACKAGE_REPLACED = "android.intent.action.PACKAGE_REPLACED";
public static final String ACTION_PACKAGE_REMOVED = "android.intent.action.PACKAGE_REMOVED";
public static final String ACTION_PACKAGE_CHANGED = "android.intent.action.PACKAGE_CHANGED";
public static final String ACTION_QUERY_PACKAGE_RESTART = "android.intent.action.QUERY_PACKAGE_RESTART";
public static final String ACTION_PACKAGE_RESTARTED = "android.intent.action.PACKAGE_RESTARTED";
public static final String ACTION_PACKAGE_DATA_CLEARED = "android.intent.action.PACKAGE_DATA_CLEARED";
public static final String ACTION_UID_REMOVED = "android.intent.action.UID_REMOVED";
public static final String ACTION_EXTERNAL_APPLICATIONS_AVAILABLE =
public static final String ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE =
public static final String ACTION_WALLPAPER_CHANGED = "android.intent.action.WALLPAPER_CHANGED";
public static final String ACTION_CONFIGURATION_CHANGED = "android.intent.action.CONFIGURATION_CHANGED";
public static final String ACTION_LOCALE_CHANGED = "android.intent.action.LOCALE_CHANGED";
public static final String ACTION_BATTERY_CHANGED = "android.intent.action.BATTERY_CHANGED";
public static final String ACTION_BATTERY_LOW = "android.intent.action.BATTERY_LOW";
public static final String ACTION_BATTERY_OKAY = "android.intent.action.BATTERY_OKAY";
public static final String ACTION_POWER_CONNECTED = "android.intent.action.ACTION_POWER_CONNECTED";
public static final String ACTION_POWER_DISCONNECTED =
public static final String ACTION_SHUTDOWN = "android.intent.action.ACTION_SHUTDOWN";
public static final String ACTION_REQUEST_SHUTDOWN = "android.intent.action.ACTION_REQUEST_SHUTDOWN";
public static final String ACTION_DEVICE_STORAGE_LOW = "android.intent.action.DEVICE_STORAGE_LOW";
public static final String ACTION_DEVICE_STORAGE_OK = "android.intent.action.DEVICE_STORAGE_OK";
public static final String ACTION_MANAGE_PACKAGE_STORAGE = "android.intent.action.MANAGE_PACKAGE_STORAGE";
public static final String ACTION_UMS_CONNECTED = "android.intent.action.UMS_CONNECTED";
public static final String ACTION_UMS_DISCONNECTED = "android.intent.action.UMS_DISCONNECTED";
public static final String ACTION_MEDIA_REMOVED = "android.intent.action.MEDIA_REMOVED";
public static final String ACTION_MEDIA_UNMOUNTED = "android.intent.action.MEDIA_UNMOUNTED";
public static final String ACTION_MEDIA_CHECKING = "android.intent.action.MEDIA_CHECKING";
public static final String ACTION_MEDIA_NOFS = "android.intent.action.MEDIA_NOFS";
public static final String ACTION_MEDIA_MOUNTED = "android.intent.action.MEDIA_MOUNTED";
public static final String ACTION_MEDIA_SHARED = "android.intent.action.MEDIA_SHARED";
public static final String ACTION_MEDIA_UNSHARED = "android.intent.action.MEDIA_UNSHARED";
public static final String ACTION_MEDIA_BAD_REMOVAL = "android.intent.action.MEDIA_BAD_REMOVAL";
public static final String ACTION_MEDIA_UNMOUNTABLE = "android.intent.action.MEDIA_UNMOUNTABLE";
public static final String ACTION_MEDIA_EJECT = "android.intent.action.MEDIA_EJECT";
public static final String ACTION_MEDIA_SCANNER_STARTED = "android.intent.action.MEDIA_SCANNER_STARTED";
public static final String ACTION_MEDIA_SCANNER_FINISHED = "android.intent.action.MEDIA_SCANNER_FINISHED";
public static final String ACTION_MEDIA_SCANNER_SCAN_FILE = "android.intent.action.MEDIA_SCANNER_SCAN_FILE";
public static final String ACTION_MEDIA_BUTTON = "android.intent.action.MEDIA_BUTTON";
public static final String ACTION_CAMERA_BUTTON = "android.intent.action.CAMERA_BUTTON";
public static final String ACTION_GTALK_SERVICE_CONNECTED =
public static final String ACTION_GTALK_SERVICE_DISCONNECTED =
public static final String ACTION_INPUT_METHOD_CHANGED =
public static final String ACTION_AIRPLANE_MODE_CHANGED = "android.intent.action.AIRPLANE_MODE";
public static final String ACTION_PROVIDER_CHANGED =
public static final String ACTION_HEADSET_PLUG =
public static final String ACTION_NEW_OUTGOING_CALL =
public static final String ACTION_REBOOT =
public static final String ACTION_DOCK_EVENT =
public static final String ACTION_REMOTE_INTENT =
public static final String ACTION_PRE_BOOT_COMPLETED =
|
阅读(7064) | 评论(0) | 转发(0) |