use of androidx.annotation.RequiresApi in project streaming-android by red5pro.
the class SubscribeService method createNotificationChannel.
@RequiresApi(Build.VERSION_CODES.O)
private String createNotificationChannel(String channelId, String channelName) {
NotificationChannel chan = new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_NONE);
chan.setLightColor(Color.BLUE);
chan.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
NotificationManager service = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
service.createNotificationChannel(chan);
return channelId;
}
use of androidx.annotation.RequiresApi in project react-native-push-notification by zo0r.
the class RNPushNotificationHelper method getDeliveredNotifications.
@RequiresApi(api = Build.VERSION_CODES.M)
public WritableArray getDeliveredNotifications() {
WritableArray result = Arguments.createArray();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
return result;
}
NotificationManager notificationManager = notificationManager();
StatusBarNotification[] delivered = notificationManager.getActiveNotifications();
Log.i(LOG_TAG, "Found " + delivered.length + " delivered notifications");
/*
* stay consistent to the return structure in
* https://facebook.github.io/react-native/docs/pushnotificationios.html#getdeliverednotifications
* but there is no such thing as a 'userInfo'
*/
for (StatusBarNotification notification : delivered) {
Notification original = notification.getNotification();
Bundle extras = original.extras;
WritableMap notif = Arguments.createMap();
notif.putString("identifier", "" + notification.getId());
notif.putString("title", extras.getString(Notification.EXTRA_TITLE));
notif.putString("body", extras.getString(Notification.EXTRA_TEXT));
notif.putString("tag", notification.getTag());
notif.putString("group", original.getGroup());
result.pushMap(notif);
}
return result;
}
use of androidx.annotation.RequiresApi in project collect by opendatakit.
the class FixedDatePickerDialog method onCreateDialog.
@RequiresApi(api = Build.VERSION_CODES.N)
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
DatePickerDialog dialog = new DatePickerDialog(requireActivity(), viewModel.getDialogTheme(), viewModel.getDateSetListener(), viewModel.getLocalDateTime().getYear(), viewModel.getLocalDateTime().getMonthOfYear() - 1, viewModel.getLocalDateTime().getDayOfMonth());
if (themeUtils.isSpinnerDatePickerDialogTheme(viewModel.getDialogTheme())) {
dialog.setTitle(requireContext().getString(R.string.select_date));
fixSpinner(requireContext(), dialog, viewModel.getLocalDateTime().getYear(), viewModel.getLocalDateTime().getMonthOfYear() - 1, viewModel.getLocalDateTime().getDayOfMonth());
hidePickersIfNeeded(dialog, viewModel.getLocalDateTime());
// noinspection deprecation
dialog.getDatePicker().setCalendarViewShown(false);
}
return dialog;
}
use of androidx.annotation.RequiresApi in project ExoPlayer by google.
the class MediaCodecInfo method isAudioChannelCountSupportedV21.
/**
* Whether the decoder supports audio with a given channel count.
*
* <p>Must not be called if the device SDK version is less than 21.
*
* @param channelCount The channel count.
* @return Whether the decoder supports audio with the given channel count.
*/
@RequiresApi(21)
public boolean isAudioChannelCountSupportedV21(int channelCount) {
if (capabilities == null) {
logNoSupport("channelCount.caps");
return false;
}
AudioCapabilities audioCapabilities = capabilities.getAudioCapabilities();
if (audioCapabilities == null) {
logNoSupport("channelCount.aCaps");
return false;
}
int maxInputChannelCount = adjustMaxInputChannelCount(name, mimeType, audioCapabilities.getMaxInputChannelCount());
if (maxInputChannelCount < channelCount) {
logNoSupport("channelCount.support, " + channelCount);
return false;
}
return true;
}
use of androidx.annotation.RequiresApi in project ExoPlayer by google.
the class RequirementsWatcher method registerNetworkCallbackV24.
@RequiresApi(24)
private void registerNetworkCallbackV24() {
ConnectivityManager connectivityManager = checkNotNull((ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE));
networkCallback = new NetworkCallback();
connectivityManager.registerDefaultNetworkCallback(networkCallback);
}
Aggregations