Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Sample app that shows the different notification services.

NotificationsYou must be signed in to change notification settings

alvareztech/android-notifications

Repository files navigation

Sample app that shows the different notification services.

HMS

Client

implementation'com.huawei.hms:push:5.0.2.300'

Common errors

getToken failed, com.huawei.hms.common.ApiException: 907135702: certificate fingerprint empty

Solution: Add fingerprint to Huawei web console.

HMSSDK_HmsInstanceIdEx: TokenTask failed, ErrorCode: 800100000 getToken failed, com.huawei.hms.common.ApiException: 907122036: no right

Solution: Updateagconnect-services.json configuration file.

Server

Get Token

Request
POST https://oauth-login.cloud.huawei.com/oauth2/v3/tokenHost: oauth-login.cloud.huawei.comContent-Type: application/x-www-form-urlencoded
  • grant_type:client_credentials
  • client_secret: Your Client Secret
  • client_id: Your Client ID
Response
{"access_token":"CgB6e3x9pzAkPR...","expires_in":3600,"token_type":"Bearer"}

Send Message

Request
POST https://push-api.cloud.huawei.com/v1/[appid]/messages:sendAuthorization: Bearer CgB6e3x9pzAkPRPDoctuJ...
{"validate_only":false,"message": {"notification": {"title":"Title 1","body":"Body 1"        },"android": {"notification": {"title":"Android Title 1","body":"Android Body 1","click_action": {"type":1,"intent":"#Intent;compo=com.rvr/.Activity;S.W=U;end"                }            }        },"token": ["client_token_1","client_token_2"        ]    }}
Response
{"code":"80000000","msg":"Success","requestId":"160209653167346065000206"}

Resources

About

Sample app that shows the different notification services.

Topics

Resources

Stars

Watchers

Forks

Languages


[8]ページ先頭

©2009-2025 Movatter.jp