INNER CODE UNIT · Java
createStopAction
rom1v/sndcpy · app/src/main/java/com/rom1v/sndcpy/RecordService.java:116
private Notification.Action createStopAction() {
Intent stopIntent = createStopIntent();
PendingIntent stopPendingIntent = PendingIntent.getService(this, 0, stopIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE);
Icon stopIcon = Icon.createWithResource(this, R.drawable.ic_close_24dp);
String stopString = getString(R.string.action_stop);
Notification.Action.Builder actionBuilder = new Notification.Action.Builder(stopIcon, stopString, stopPendingIntent);
return actionBuilder.build();
}
private static LocalSocket connect() throws IOException {
LocalServerSocket localServerSocket = new LocalServerSocket(SOCKET_NAME);
try {
return localServerSocket.accept();
} finally {
localServerSocket.close();
}
}