• 로그인
  • 장바구니에 상품이 없습니다.

home2 게시판 Flutter 게시판 local notification 오류

local notification 오류

  • 이 주제에는 13개 답변, 3명 참여가 있으며 차정훈5 월 전에 전에 마지막으로 업데이트했습니다.
10 글 보임 - 1 에서 10 까지 (총 14 중에서)
  • 글쓴이
  • #131482

    꺄륵
    참가자
    게시판 찾아보니 showNotification 안에 print 넣어보고 잘 실행되는데도 알림이 안 뜨는거면
    앱 자체 알림을 키라고 해서 앱 알림을 켰습니다.
    
    버튼을 누르면 print문은 잘 실행되는데 여전히 알림이 오지 않습니다..
    • 이 게시글은 꺄륵에 의해 8 월 전에 수정됐습니다.
    #131484

    꺄륵
    참가자
    버튼을 누르면 콘솔에 에러는 아닌데
    E/flutter (28808): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)]
    Unhandled Exception: PlatformException(error, Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference, null, java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
    라는게 뜹니다. 이거 때문일까요?
    #131488

    codingapple
    키 마스터
    initNotification() 함수부터 먼저 실행되고있나 확인해봅시다
    #131703

    꺄륵
    참가자
    개인 사정이 았어서 2주 정도 지난 뒤에 수정 없이 다시 실행해봤는데 왠지 모르게 알림이 잘 뜨네요.
    showNotification2를 추가해봤는데 알림이 오지 않습니다..
    
    
    showNotification2() async {
      tz.initializeTimeZones();
      var androidDetails = const AndroidNotificationDetails(
        '유니크한 알림 ID',
        '알림종류 설명',
        priority: Priority.high,
        importance: Importance.max,
        color: Color.fromARGB(255, 255, 0, 0),
      );
      var iosDetails = const DarwinNotificationDetails(
        presentAlert: true,
        presentBadge: true,
        presentSound: true,
      );
      notifications.zonedSchedule(  // 알림을 원하는 시간에 띄워줌
          2,
          '제목2',
          '내용2',
          // RepeatInterval.daily 해당 메일 알림
          tz.TZDateTime.now(tz.local).add(Duration(seconds: 3)), // 폰의 현재시간 + 3초
          // makeDate(8,30,0),  // 시간 입력하면 이 시간에 알림 뜸
          NotificationDetails(android: androidDetails, iOS: iosDetails),
          androidAllowWhileIdle: true,
          uiLocalNotificationDateInterpretation:
          UILocalNotificationDateInterpretation.absoluteTime,
          matchDateTimeComponents: DateTimeComponents.time // 매일 저 위에 시간에 알림 띄워줌
      );
    } 알림이 왜 오지 않는지 모르겠어요
    #131711

    codingapple
    키 마스터
    showNotification2 쓰는 곳 확인해보거나 
    가상폰에 있는 플러터 앱 지웠다가 다시 띄워서 테스트해봅시다
    #131738

    꺄륵
    참가자
    이것저것 다 해봤는데 showNotification은 알림이 잘 오는 반면에 showNotification2는 여전히 알림이 오지 않습니다..
    #131751

    codingapple
    키 마스터
    showNotification2 안에 print() 쓰면 잘 출력됩니까 timezone 패키지는 import 잘했고 에러메세지는 없습니까
    #131787

    꺄륵
    참가자
    print() 잘 출력되고
    import 'package:timezone/data/latest_all.dart' as tz;
    import 'package:timezone/timezone.dart' as tz; 임포트 했고
    에러 메세지는 전혀 없습니다
    #131798

    codingapple
    키 마스터
    androidAllowWhileIdle: true, 부분 지우고 
    androidScheduleMode: AndroidScheduleMode.exactAllowWhileIdle,
    넣어봅시다
    #131822

    꺄륵
    참가자
    그래도 안됩니다..
10 글 보임 - 1 에서 10 까지 (총 14 중에서)
  • 답변은 로그인 후 가능합니다.

About

현재 월 700명 신규수강중입니다.

  (09:00~20:00) 빠른 상담은 카톡 플러스친구 코딩애플 (링크)
  admin@codingapple.com
  이용약관
ⓒ Codingapple, 강의 예제, 영상 복제 금지
top

© Codingapple, All rights reserved. 슈퍼로켓 에듀케이션 / 서울특별시 강동구 고덕로 19길 30 / 사업자등록번호 : 212-26-14752 온라인 교육학원업 / 통신판매업신고번호 : 제 2017-서울강동-0002 호 / 개인정보관리자 : 박종흠