0

嗨,我正在构建一个 Android App。它在 DatePicker 和 TimePicker 中接受用户的输入,并设置设备时间或模块时间。

这是我正在使用的代码

            int     nHrTime;
    int     nMinTime;
    int     nYear;

    int nMonth;
    int nDay;

    nHrTime     =  DeviceTimePickr.getCurrentHour();
    nMinTime    =  DeviceTimePickr.getCurrentMinute();

    nYear   =  DeviceDatePickr.getYear();
    nMonth      =  DeviceDatePickr.getMonth();
    nDay        =  DeviceDatePickr.getDayOfMonth();

    dDeviceCalendar.set(nYear, nMonth,nDay,nHrTime, nMinTime);

在 manifest.xml 文件中,我也更改了权限。

清单文件的变化

         <uses-permission android:name="android.permission.SET_TIME" 
    android:protectionLevel="signature|system"/>

为什么这不起作用?我正在使用安卓 4.22

4

1 回答 1

0

更改设备时间不适用于非 root 设备上的应用程序。因为这个,它对你不起作用:

android:protectionLevel="signature|system"

这意味着只有系统应用程序或使用系统证书签名的应用程序才被授予此权限。你不是。

于 2014-01-06T12:04:37.057 回答