Skip to content

Instantly share code, notes, and snippets.

@Haldir65
Created March 1, 2016 10:36
Show Gist options
  • Save Haldir65/b33b895f2c7b25d45304 to your computer and use it in GitHub Desktop.
Save Haldir65/b33b895f2c7b25d45304 to your computer and use it in GitHub Desktop.
可以去调用系统闹钟,记得manifest里面加权限
public final static String ACTION_SET_ALARM = "android.intent.action.SET_ALARM";
public static final String EXTRA_HOUR = "android.intent.extra.alarm.HOUR";
public static final String EXTRA_MESSAGE = "android.intent.extra.alarm.MESSAGE";
public static final String EXTRA_MINUTES = "android.intent.extra.alarm.MINUTES";
public static final String EXTRA_SKIP_UI = "android.intent.extra.alarm.SKIP_U";
Intent i = new Intent(ACTION_SET_ALARM);
i.putExtra(EXTRA_HOUR, 9);
i.putExtra(EXTRA_MINUTES,41);
i.putExtra(EXTRA_MESSAGE, "Good");
i.putExtra(EXTRA_SKIP_UI, false); this.startActivity(i);
//权限需要加上
<uses-permission android:name="com.android.alarm.permission.SET_ALARM"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment