/*
* 常规
*
*/
//***发送 SMS
// AndroidManifest.xml must have the following permission:
// <uses-permission android:name="android.permission.SEND_SMS"/>
SmsManager m = SmsManager.getDefault();
String destinationNumber ="0123456789";
String text = "Hello, MOTO!";
m.sendTextMessage(destinationNumber, null, text, null, null);
//***显示 Toast
Toast.makeText(this, "Put your message here", Toast.LENGTH_SHORT).show();
//***状态栏通知
int notificationID = 10;
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// Create the notification
Notification notification = new Notification(R.drawable.yourIconId, "Put your notification text here", System.currentTimeMillis());
// Create the notification expanded message
// When the user clicks on it, it opens your activity
Intent intent = new Intent(this, YourActivityName.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
notification.setLatestEventInfo(this, "Put your title here", "Put your text here", pendingIntent);
// Show notification
notificationManager.notify(notificationID, notification);
//***在给定时间内振动手机
// AndroidManifest.xml must have the following permission:
// <uses-permission android:name="android.permission.VIBRATE"/>
// Vibrate for 1000 miliseconds
Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vibrator.vibrate(1000);
//***在开/关模式后振动手机
// AndroidManifest.xml must have the following permission:
//<uses-permission android:name="android.permission.VIBRATE"/>
// Vibrate in a Pattern with 0ms off(start immediately), 200ms on, 100ms off, 100ms on, 500ms off, 500ms on,
// repeating the pattern starting from index 4 - 100ms on.
// Note that you'll have to call vibrator.cancel() in order to stop vibrator.
// Change second parameter to -1 if you want play the pattern only once.
Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vibrator.vibrate(new long[] {0, 200, 100, 100, 500, 500}, 4);