0

Hi I am building one Android App.which takes input from user in DatePicker and TimePicker and set the Device Time or Modile Time.

This is the code I am using

            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);

In manifest.xml file I hve chanes the permission also.

Changes in manifest file

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

Why this not working? I am using android 4.22

Tejas
  • 358
  • 5
  • 23

1 Answers1

0

Changing device time is not available for apps on non-rooted devices. And it does not work for you because of this:

android:protectionLevel="signature|system"

which means only apps that are system apps or signed with system certificate are granted this permission. You are not.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141