Skip to content

Instantly share code, notes, and snippets.

@goodzsq
Created September 12, 2014 08:37
Show Gist options
  • Save goodzsq/1319a3744a2e62004d30 to your computer and use it in GitHub Desktop.
Save goodzsq/1319a3744a2e62004d30 to your computer and use it in GitHub Desktop.
android 发送短信
//发送短信
public void sendSMS(String tel, String msg){
PendingIntent paIntent = PendingIntent.getBroadcast(this, 0, new Intent(), 0);
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(tel, null, msg, paIntent, null);
}
//UUID
public String getMyUUID(){
TelephonyManager tm = (TelephonyManager)getBaseContext().getSystemService("phone");
String tmDevice = tm.getDeviceId();
String tmSerial = tm.getSimSerialNumber();
String androidId = Settings.Secure.getString(getContentResolver(), "android_id");
UUID deviceUuid = new UUID(androidId.hashCode(), tmDevice.hashCode() << 32 | tmSerial.hashCode());
String uniqueId = deviceUuid.toString();
return uniqueId;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment