Cordova에서 SMS 알림 처리

improve this page | report issue

개요

SMS 알림은 푸시 알림의 서브세트이므로 먼저 Cordova의 푸시 알림 학습서를 완료해야 합니다.
Cordova 애플리케이션의 SMS 알림은 iOS 및 Android에 대해 지원됩니다.

전제조건:

다음으로 이동:

알림 API

SMS 알림에서는 디바이스 등록 시 전화번호 값이 전달됩니다.

디바이스 등록

디바이스를 푸시 알림 서비스에 등록합니다.

MFPPush.registerNotificationsCallback(notificationReceived);

function registerDevice() {
    var phoneNumber = prompt("Enter Your 10 digit phone number");
    if(phoneNumber != null && phoneNumber!="" && /^\d+$/.test(phoneNumber)) {
        var options = {};
        options.phoneNumber = phoneNumber;
        MFPPush.registerDevice(options, 
        function(successResponse) {
            alert("Successfully registered");
            enableButtons();
        }, function(failureResponse) {
            alert("Failed to register");
        });
        return true;
    }

    else {
        alert("Failed to register, You have entered invalid number");
    }
}

푸시 디바이스 등록(POST) REST API를 사용하여 디바이스를 등록할 수도 있습니다.

SMS 등록 서블릿 사용

REST API는 등록된 디바이스에 알림을 전송하는 데 사용됩니다. 모든 양식의 알림(태그 & 브로드캐스트 알림 및 인증된 알림)을 전송할 수 있습니다.

알림을 전송하기 위해 REST 엔드포인트에 대한 POST를 사용하여 요청이 작성됩니다. imfpush/v1/apps/<application-identifier>/messages.
예제 URL:

https://myserver.com:443/imfpush/v1/apps/com.sample.sms/messages

모든 푸시 알림 REST API를 검토하려면 사용자 문서에서 REST API 런타임 서비스 주제를 참조하십시오.

알림을 전송하려면 알림 전송 학습서를 참조하십시오.

샘플 애플리케이션의 이미지

샘플 애플리케이션

Cordova 프로젝트를 클릭하여 다운로드하십시오.

참고: 샘플을 실행할 Android 디바이스에 Google Play Services의 최신 버전이 설치되어 있어야 합니다.

샘플 사용법

샘플의 README.md 파일에 있는 지시사항을 따르십시오.

Inclusive terminology note: The Mobile First Platform team is making changes to support the IBM® initiative to replace racially biased and other discriminatory language in our code and content with more inclusive language. While IBM values the use of inclusive language, terms that are outside of IBM's direct influence are sometimes required for the sake of maintaining user understanding. As other industry leaders join IBM in embracing the use of inclusive language, IBM will continue to update the documentation to reflect those changes.
Last modified on May 13, 2020