-
-
Save Haldir65/b33b895f2c7b25d45304 to your computer and use it in GitHub Desktop.
可以去调用系统闹钟,记得manifest里面加权限
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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