Sapient
Company
Programming
The following code snippet will create a new alarm in Android. In order to invoke the ACTION_SET_ALARM intent, your app must have the SET_ALARM permission. Which of the followinig options correctly sets the SET_ALARM permission?
public void createAlarm(String message, int hour, int minutes){
Intent intent = new Intent(AlarmClock.ACTION_SET_ALARM)
.putExtra(AlarmClock.EXTRA_MESSAGE, message)
.putExtra(AlarmClock.EXTRA_HOUR, hour)
.putExtra(AlarmClock.EXTRA_MINUTES, minutes);
if(intent.resolveActivity(getPackageManager()) != null){
startActivity(intent);
}
}
1)
2)
3)
Read Solution (Total 1)
-
- com.android.alarm.permission.SET_ALARM
Link- https://developer.android.com/reference/android/provider/AlarmClock.html - 7 years agoHelpfull: Yes(0) No(0)
Sapient Other Question