Amazon SNS: How to get EndpointArn by token(registrationId) using amazon .net sdk?

前端 未结 2 1204
独厮守ぢ
独厮守ぢ 2021-02-05 09:40

I am trying to get EndpointArn by registration id using aws .net sdk. But i couldn\'t find a nice way to do it.

My first attempt was running CreatePlatformEndpointReque

2条回答
  •  独厮守ぢ
    2021-02-05 09:53

    According to the AWS Blog at https://mobile.awsblog.com/post/Tx223MJB0XKV9RU/Mobile-token-management-with-Amazon-SNS, they also recommend that app side stores the ARN.

    retrieve the latest token from the mobile OS
    if (endpoint arn not stored)
        # first time registration
        call CreatePlatformEndpoint
        store returned endpoint arn
    endif
    
    call GetEndpointAttributes on the endpoint arn 
    
    if (getting attributes encountered NotFound exception)
        #endpoint was deleted 
        call CreatePlatformEndpoint
        store returned endpoint arn
    else 
        if (token in endpoint does not match latest) or 
            (GetEndpointAttributes shows endpoint as disabled)
            call SetEndpointAttributes to set the 
                         latest token and enable the endpoint
        endif
    endif
    

提交回复
热议问题