INNER CODE UNIT · Java
start
rom1v/sndcpy · app/src/main/java/com/rom1v/sndcpy/RecordService.java:51
public static void start(Context context, Intent data) {
Intent intent = new Intent(context, RecordService.class);
intent.setAction(ACTION_RECORD);
intent.putExtra(EXTRA_MEDIA_PROJECTION_DATA, data);
context.startForegroundService(intent);
}
@Override
public void onCreate() {
super.onCreate();
Notification notification = createNotification(false);
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, getString(R.string.app_name), NotificationManager.IMPORTANCE_NONE);
getNotificationManager().createNotificationChannel(channel);
startForeground(NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION);
}