Skip to content

dcy/fcm_push

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fcm_push

Google FCM push server sdk for Erlang
集成版本:https://github.com/dcy/epush
使用例子:/src/fcm_push_example.erl

Authorization

  • gen_authorization(AppSecret)
  • gen_headers(AppSecret)

push 通用

  • push(Maps)
  • push(AppSecret, Maps)
  • push(AppSecret, Proxy, Maps)
Notification = #{<<"title">> => unicode:characters_to_binary("中文标题"),
                 <<"body">> => unicode:characters_to_binary("中文内容")},
Msg = #{<<"to">> => list_to_binary(?DEVICE_TOKEN), <<"notification">> => Notification},
fcm_push:push(Msg).

notification 通知栏

  • notification(To, Title, Content)
  • notification(AppSecret, To, Title, Content)
  • notification(AppSecret, Proxy, To, Title, Content)
fcm_push:notification(?DEVICE_TOKEN, "中文标题", "中文内容").

data 透传

  • data(To, Data)
  • data(AppSecret, To, Data)
  • data(AppSecret, Proxy, To, Data)
fcm_push:data(?DEVICE_TOKEN, #{<<"hello">> => <<"world">>}).

Todo:

  • topics

Releases

No releases published

Packages

No packages published

Languages