Calendar c = Calendar.getInstance(); // 年 月-1 日 时 分 秒 if (date != null) { int year = date.getYear() + 1900; int day = date.getDate(); int month = date.getMonth(); int hour = date.getHours(); int minutes = date.getMinutes(); int seconds = date.getSeconds(); c.set(year, month, day, hour, minutes, seconds); } AlarmManager am = (AlarmManager) LoginActivity.this .getSystemService(Context.ALARM_SERVICE); am.setTime(c.getTimeInMillis());我是这么修改的 没有问题
我这个是从服务器获取时间 然后修改设备时间执行这句代码am.setTime(c.getTimeInMillis());,报如下异常,有没遇到过呢? 06-29 19:32:35.703: E/AndroidRuntime(14289): java.lang.SecurityException: setTime: Neither user 10060 nor current process has android.permission.SET_TIME.
// 年 月-1 日 时 分 秒
if (date != null) {
int year = date.getYear() + 1900;
int day = date.getDate();
int month = date.getMonth();
int hour = date.getHours();
int minutes = date.getMinutes();
int seconds = date.getSeconds();
c.set(year, month, day, hour, minutes, seconds);
}
AlarmManager am = (AlarmManager) LoginActivity.this
.getSystemService(Context.ALARM_SERVICE);
am.setTime(c.getTimeInMillis());我是这么修改的 没有问题
06-29 19:32:35.703: E/AndroidRuntime(14289): java.lang.SecurityException: setTime: Neither user 10060 nor current process has android.permission.SET_TIME.