Notification

설명

  • 진동 및 소리를 통한 알림 관련 API

제약사항

  • Notification API의 플랫폼별 제약사항은 다음과 같다.

Android

notification.beep
  • 환경 설정 > 소리 > 알림음 설정에서 지정한 알림을 재생.

iOS

notification.beep
  • 비프(beep)음 설정을 무시한다.
  • iPhone은 네이티브 beep API가 존재하지 않는다.

# 따라서 PhoneGap에서는 media API를 통한 오디오 파일 재생으로 비프(beep)를 지원한다. # 사용자는 비프(beep)음의 파일을 저장해야 한다.. # 파일은 30초를 넘지 않아야 하며, www/root 밑에 ‘beep.wav’ 이름으로 저장해야 한다.

notification.vibrate
  • time: 미리 설정한 진동 시간을 무시하고 아이폰 설정을 따른다.

환경 설정

Android

  • app/res/xml/config.xml
<plugin name="Notification" value="org.apache.cordova.Notification"/>
  • app/AndroidManifest
<uses-permission android:name="android.permission.VIBRATE" />

iOS

  • App/Supporting Files/config.xml
    <feature name="Notification">
        <param name="ios-package" value="CDVNotification"/>
    </feature>

관련 함수

notification.alert

  • 설정된 경고창(alert) 나 dialog box을 보여준다.
navigator.notification.alert(message, alertCallback, [title], [buttonName])
  • Quick Example :
// Android / BlackBerry WebWorks (OS 5.0 and higher) / iPhone
//
function alertDismissed() {
    // do something
}

navigator.notification.alert(
    'You are the winner!',  // message
    alertDismissed,         // callback
    'Game Over',            // title
    'Done'                  // buttonName
);

notification.confirm

  • 실행 여부를 선택하는 확인형 대화상자.
navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels])
  • Quick Example :
// process the confirmation dialog result
function onConfirm(buttonIndex) {
    alert('You selected button ' + buttonIndex);
}

// Show a custom confirmation dialog
//
function showConfirm() {
    navigator.notification.confirm(
        'You are the winner!',  // message
        onConfirm,              // callback to invoke with index of button pressed
        'Game Over',            // title
        'Restart,Exit'          // buttonLabels
    );
}

notification.beep

  • 단말기의 비프(beep)음을 재생한다.
navigator.notification.beep(times);
  • Quick Example :
// Beep twice!
navigator.notification.beep(2);

notification.vibrate

  • 지정한 시간 동안 단말기의 진동을 울리게 한다.
navigator.notification.vibrate(milliseconds)
  • Quick Example :
// Vibrate for 2.5 seconds
//
navigator.notification.vibrate(2500);

참고 자료

 
egovframework/hyb3.9/hrte/deviceapi/notification.txt · 마지막 수정: 2023/12/21 05:21 (외부 편집기)
 
이 위키의 내용은 다음의 라이센스에 따릅니다 :CC Attribution-Noncommercial-Share Alike 3.0 Unported
전자정부 표준프레임워크 라이센스(바로가기)

전자정부 표준프레임워크 활용의 안정성 보장을 위해 위험성을 지속적으로 모니터링하고 있으나, 오픈소스의 특성상 문제가 발생할 수 있습니다.
전자정부 표준프레임워크는 Apache 2.0 라이선스를 따르고 있는 오픈소스 프로그램입니다. Apache 2.0 라이선스에 따라 표준프레임워크를 활용하여 발생된 업무중단, 컴퓨터 고장 또는 오동작으로 인한 손해 등에 대해서 책임이 없습니다.
Recent changes RSS feed CC Attribution-Noncommercial-Share Alike 3.0 Unported Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki