[go: nahoru, domu]

Skip to content

华为push 最新的golang 华为推送接口

Notifications You must be signed in to change notification settings

wangriyu/huaweiPush

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

hwpush

Huawei HMS SDK: https://developer.huawei.com/consumer/cn/service/hms/catalog/huaweipush_agent.html?page=hmssdk_huaweipush_api_reference_agent_s2



// 示例代码
package main

import (
	"fmt"
	huawei "github.com/wangriyu/huaweiPush"
)

func main() {
	ClientId := "***"
	ClientSecret := "***"
	AppPkgName := "***"
	client := huawei.NewClient(ClientId, ClientSecret, AppPkgName)

    deviceToken := "***"
    extra := struct {
        SessionID   int `json:"session_id"`
        SessionType int `json:"session_type"`
    }{123456, 789}

	payload := huawei.NewMessage().SetContent("huawei-content").SetTitle("huawei-title").SetAppPkgName(client.AppPkgName).SetCustomize([]map[string]interface{}{{"extra": extra}})
	result := client.PushMsg(deviceToken, payload.Json())
	fmt.Printf("result: %+v\n", result)
}

About

华为push 最新的golang 华为推送接口

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages