1 Apple Push Notification Service 2 The Notification Payload 2



Download 42.38 Kb.
Date21.06.2017
Size42.38 Kb.
#21291
Push Notification 정리



1.APNS 2

1.1.Apple Push Notification Service 2

1.2.The Notification Payload 2

1.3.참고 URL 2

1.4.iPhone 관련 ID 2

2.C2DM 3


2.1.Android Cloud to Device Messaging Framework 3

2.2.메시지 발송 3

2.3.참고 URL 4

2.4.Android 관련 ID 4

2.5.Android에서의 UDID 4




  1. APNS

    1. Apple Push Notification Service


  • Apple에서 제공하는 Push Notification 서비스로 아래 그림과 같이 Provider (서비스 서버)가 Client App으로 메시지를 발송할 수 있는 서비스이다.


a remote notification from a provider to a client application



  • Client App은 APNS로부터 deviceToken을 얻어 Provider에 제공한다. 이후 Provider가 메시지를 전송할 때 이 deviceToken을 함께 보내면, APNS가 deviceToken을 사용하여 Client App을 찾아 메시지를 전달한다.


sharing the device token


  • deviceToken은 iOS를 재설치하거나 초기화하면 바뀔 수 있다.
    (http://stackoverflow.com/questions/2751481/are-push-notification-tokens-unique-across-all-apps-for-a-single-device)



    1. The Notification Payload


  • json format, 최대 256 byte

  • 'aps' namespace는 alert, badge (아이콘), sound 노드를 포함할 수 있다.




{

"aps" : {

"alert" : "You got your emails.",

"badge" : 9,

"sound" : "bingbong.aiff"

},

"acme1" : "bar",



"acme2" : 42

}




    1. 참고 URL


  • APNS - Local and Push Notification Programming Guide
    (http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008194-CH1-SW1)



    1. iPhone 관련 ID


  • Bundle ID: ex) com.kt.m2m.smartcar

  • UDID (Unique Device Identifier) : 디바이스 식별 ID (디바이스 SN과 관련, SIM과는 무관) [a-f0-9] * 40 character

  • DeviceToken (APNS) : App이 디바이스에 인스톨 될 때 APNS로부터 받음. Push Notification에 사용. 32 bytes



  1. C2DM

    1. Android Cloud to Device Messaging Framework


  • Google에서 제공하는 Push Notification 서비스로 Third-party Application Server (서비스 서버)가 Android Application으로 메시지를 보낼 수 있다.

  • Google은 C2DM을 통한 메시지 전달을 100% 보장하지는 않는다.

  • 메시지를 받기 위해 Android Application이 실행상태일 필요는 없다.

  • Android 2.2 (Froyo) 이상이고, Android Market이 설치되어 있어야 한다.

  • C2DM은 기존의 Google 서비스 커넥션을 이용하므로, 사용자는 Google 계정을 설정한 상태여야 한다.

  • 메세지는 최대 1024바이트까지 허용 (Payload 데이터가 아닌 전체 메세지 크기임)

  • Google은 Thrid-party 서버가 발송하는 전체 메시지 수와 특정 디바이스로 보내는 메시지 수를 제한한다. (정확하게 얼마나 보내면 제한하는지는 알수 없음.)



    1. 메시지 발송


  • https://android.apis.google.com/c2dm/send 으로 POST방식으로 전송한다.




  • 보내야 하는 파라미터는 아래와 같다.

Field

Description

registration_id

The registration ID retrieved from the Android application on the phone. Required.

collapse_key

An arbitrary string that is used to collapse a group of like messages when the device is offline, so that only the last message gets sent to the client. This is intended to avoid sending too many messages to the phone when it comes back online. Note that since there is no guarantee of the order in which messages get sent, the "last" message may not actually be the last message sent by the application server. Required.

data.

Payload data, expressed as key-value pairs. If present, it will be included in the Intent as application data, with the . There is no limit on the number of key/value pairs, though there is a limit on the total size of the message. Optional.

delay_while_idle

If included, indicates that the message should not be sent immediately if the device is idle. The server will wait for the device to become active, and then only the last message for each collapse_key value will be sent. Optional.

Authorization: GoogleLogin auth=[AUTH_TOKEN]

Header with a ClientLogin Auth token. The cookie must be associated with theac2dm service. R




  • 리턴 값은 아래와 같다

Response

Description

200

Includes body containing:

  • id=[ID of sent message]

  • Error=[error code]

    • QuotaExceeded — Too many messages sent by the sender. Retry after a while.

    • DeviceQuotaExceeded — Too many messages sent by the sender to a specific device. Retry after a while.

    • InvalidRegistration — Missing or bad registration_id. Sender should stop sending messages to this device.

    • NotRegistered — The registration_id is no longer valid, for example user has uninstalled the application or turned off notifications. Sender should stop sending messages to this device.

    • MessageTooBig — The payload of the message is too big, see the limitations. Reduce the size of the message.

    • MissingCollapseKey — Collapse key is required. Include collapse key in the request.

503

Indicates that the server is temporarily unavailable (i.e., because of timeouts, etc ). Sender must retry later, honoring any Retry-After header included in the response. Application servers must implement exponential back off. Senders that create problems risk being blacklisted.

401

Indicates that the ClientLogin AUTH_TOKEN used to validate the sender is invalid.



    1. 참고 URL


  • Android Cloud to Device Messaging Framework
    (http://code.google.com/intl/ko-KR/android/c2dm/index.html)



    1. Android 관련 ID


  • Application ID : ex) com.kt.m2m.smartcar

  • deviceID : 2.5절 참조

  • Registration ID : C2DM서버가 Android application에게 발급해주는 ID. Thrid-party 서버가 C2DM을 통해 메세지를 보낼때 디바이스(device+application)를 식별하는데 사용.

  • Sender Auth Token : Thrid-party 서버가 Google 서비스에 접근할 때 사용하는 인증키.



    1. Android에서의 UDID


  • Android에서 디바이스를 구별하기 위해 다음과 같은 값들을 사용한다.

deviceID

Telephony 서비스가 있어야 함.

READ_PHONE_STATE 필요.

IMEI for GSM, MEID or ESN for CDMA


subscriberID

Telephony 서비스가 있어야 함.

READ_PHONE_STATE 필요.



IMSI for GSM

MAC Address

WiFi를 지원 해야 함. WiFi가 켜져 있어야 함.

Serial Number

Android 2.3(Gingerbread)부터 가능.

ANDROID_ID

제조사에서 지정한 Device Unique ID. Android 2.2(Froyo) 이전 디바이스에서는 100% 신뢰 못함. Android <=2.1 or >=2.3. Only 2.2 has the problems mentioned in the post.

UUID

App 설치 후 처음 실행시 생성.


Download 42.38 Kb.

Share with your friends:




The database is protected by copyright ©ininet.org 2024
send message

    Main page