알람 시간이 되고 푸시알람이 뜨는 거 까지 했는 데 진동 울리는 부분에서 어려워 하고 있습니다ㅠㅠ
푸시 알람이 뜨는 과 동시에 진동이 울리고 진동은 이 푸시 알람을 클릭해서 이 어플리케이션으로 들어갈
때 까지 울릴 수 있게 하는 기능도 추가하고 싶은데 가능할까요?
고수님들 도움을 주세요ㅠㅠ
만약 이게 어렵다면 짧게 나마(한 2~3초 정도) 푸시 알람과 함께 진동이 화면이 꺼진 상태에서도
울릴 수 있도록 하고 싶습니다. 도와주세요 ㅠㅠ
public class Reciever extends BroadcastReceiver {
public static final int NOTIFICATION_ID = 1;
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "Alarm received!", Toast.LENGTH_LONG).show();
NotificationCompat.Builder builder =
new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.alarm)
.setContentTitle("알람 입니다.")
.setSubText("subtext")
.setContentText("지정하신 알람 시간 입니다.");
Intent aIntent = new Intent(context, MainActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(context ,0, aIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(contentIntent);
NotificationManager notificationManager = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(NOTIFICATION_ID,builder.build());
}
}