[안드로이드] Android 8.1 SDK 27 FCM PUSH 알림 문제


안드로이드 8.1 오레오 이상 버전에서 푸쉬는 오는데 알림 소리가 안울리는 문제가 있네요~

import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Build;
import android.os.PowerManager;
import android.support.v4.app.NotificationCompat;
import android.util.Log;

import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;

public class FCMMessageService extends FirebaseMessagingService {
private static final String TAG = "FCMMessageService";
static String registration_id = null;

@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
if (remoteMessage.getData().size() > 0) {
sendNotification(remoteMessage.getData().get("message"));
}
}

private void sendNotification(String messageBody) {
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent,
PendingIntent.FLAG_ONE_SHOT);

Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = null;
NotificationManager notificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
String channelId = "default_channel_id";
String channelDescription = "Default Channel";
NotificationChannel notificationChannel = notificationManager.getNotificationChannel(channelId);
if (notificationChannel == null) {
int importance = NotificationManager.IMPORTANCE_HIGH;
notificationChannel = new NotificationChannel(channelId, channelDescription, importance);
notificationChannel.setLightColor(Color.GREEN);
notificationChannel.enableVibration(true);
notificationManager.createNotificationChannel(notificationChannel);
}
notificationBuilder = new NotificationCompat.Builder(this, channelId);
} else {
notificationBuilder = new NotificationCompat.Builder(this);
}
notificationBuilder
.setSmallIcon(R.drawable.noti_icon)
.setContentTitle(getString(R.string.app_name))
.setContentText(messageBody)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent);

PowerManager pm = (PowerManager) this.getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wakelock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, TAG);
wakelock.acquire(5000);
notificationManager.notify(0, notificationBuilder.build());
}
}

SDK 버전이 올라갈때 마다 가지가지 하네요~ ㅎ


블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,

[시놀로지] DSM HTTPS 보안인증서 발급


브라우저로 Synology DSM 에 접속시 http 로 접근하면 아무래도 보안에 취약합니다.

https 를 사용하여야 하는데 유효하지 않은 인증서라고 나오는게 보기가 싫습니다.

보안인증서를 letsencrypt 로 무료발급 하는 방법입니다.

[시놀로지] DSM HTTPS 보안인증서 발급


위와 같이 설정하고 브라우저로 https 로 접속하면 아래처럼 "인증서 정보가 부족하므로 이 인증서를 확인할 수 없습니다." 라고 나옵니다.

[시놀로지] DSM HTTPS 보안인증서 발급


제어판 => 보안 => 인증서 탭으로 이동하여 추가 버튼을 누릅니다.

[시놀로지] DSM HTTPS 보안인증서 발급


새 인증서 추가나 기존 인증서 교체를 선택하고 다음을 누릅니다.

[시놀로지] DSM HTTPS 보안인증서 발급

저는 새 인증서 추가를 선택하였습니다.


Let's Encrypt에서 인증서 얻기를 선택하고 기본 인증서로 설정을 체크하고 다음을 누릅니다.

[시놀로지] DSM HTTPS 보안인증서 발급


도메인 이름과 이메일을 입력하고 적용을 누릅니다.

[시놀로지] DSM HTTPS 보안인증서 발급

도메인은 ddns 를 사용하면 됩니다.


구성을 눌러서 시스템 기본 설정에서 synology.com 대신에 발급된 인증서를 연결하여 줍니다.

[시놀로지] DSM HTTPS 보안인증서 발급

확인을 누르면 웹서비스가 재시작 되고 정상적인 인증서로 접속이 됩니다.



블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,

[윈도우10] 시놀로지 iSCSI 가상디스크 연결 방법


Synology DSM 에 iSCSI Manager 가 있습니다.

필요한 가상디스크의 사이즈 만큼 LUN 을 특정 볼륨에 생성하고 윈도우와 연결에 사용할 Target 을 생성합니다.

[윈도우10] 시놀로지 iSCSI 가상디스크 연결 방법

IQN은 iqn.YYYY-MM.com.synology:디바이스.식별ID 이런씩으로 만들면 됩니다.

암호화가 필요하다면 CHAP 활성화를 체크하고 계정과 비밀번호를 12~16자 사이로 입력합니다.


이제 윈도우에서 iSCSI 초기자를 실행합니다.

[윈도우10] 시놀로지 iSCSI 가상디스크 연결 방법

포털 검색을 클릭해서 NAS 서버의 IP 주소를 입력하고 확인을 누릅니다.

iscsi 는 3260 TCP Port 를 사용하는데 로컬에서만 동작이 됩니다.

포트포워딩을 설정해도 외부 네트워크에서는 접속이 안되더군요~


[윈도우10] 시놀로지 iSCSI 가상디스크 연결 방법

대상 탭으로 가면 위에서 설정한 타겟이 보입니다.

연결을 누릅니다.


[윈도우10] 시놀로지 iSCSI 가상디스크 연결 방법

CHAP 을 활성화 했다면 고급을 눌러서 로그온 정보를 입력합니다.


[윈도우10] 시놀로지 iSCSI 가상디스크 연결 방법

CHAP 로그온 정보 사용을 체크하고 해당 이름과 대상 암호를 입력하고 확인을 누릅니다.


[윈도우10] 시놀로지 iSCSI 가상디스크 연결 방법

이제 연결이 되었으면 컴퓨터 관리의 저장소 디스크 관리로 갑니다.


[윈도우10] 시놀로지 iSCSI 가상디스크 연결 방법

파티션을 생성하고 사용하면 됩니다.



블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,