특정 신호가 감지 될 때 잠긴 화면에 알림이 표시되는 알림 메서드를 작성하려고합니다. 기호 클래스를 찾을 수 없습니다. NotificationManagerCompat
public void showNotification(Beacon beacon) {
Resources r = getResources();
int random = (int)System.currentTimeMillis();
Notification notification = new NotificationCompat.Builder(this)
.setSmallIcon(android.R.drawable.ic_popup_reminder)
.setContentTitle("Beacons Found")
.setContentText(beacon.getID().toString())
.setVisibility(0) // allow notification to appear on locked screen
.setAutoCancel(true)
.build();
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(random, notification);
}
내가 위의 코드를 가지고,하지만 난 그것을 실행할 때 말한다 "변수 SetVisibility 기호를 찾을 수 없습니다"나의 이해는 내가 다음 코드 (0) .setVisibility을 포함 할 필요가 있다는 것입니다. 나는 온라인으로 어떤 연구를하고 내가이 가져와야 할 것 같다
import android.support.v4.app.NotificationManagerCompat;
을하지만이 import 문을 포함 할 경우, 그것은
어떻게해야합니까에게 "NotificationManagerCompat 심볼 클래스를 찾을 수 없습니다"말할 것? 이미 프로젝트에 새 모듈을 추가하기 때문에