Apple在erlang / ejabberd中推送非英语消息的通知

时间:2015-12-01 08:03:29

标签: erlang apple-push-notifications ejabberd

如果我将语言设置为非英语,我没有得到正确的消息顺序。非英语单词即将推出,但顺序不正确。 如果我需要额外的订单,请提供帮助和建议。

代码段如下:

send_ios_msg(Token,Badge1,Type,Msg,ENUM,Groupid,Groupname,Sender_list_without_resource,Content_list,Socket) ->

  Msg_final =list_to_binary(Msg),

  Msg_final_binarytolist = binary_to_list(Msg_final),

  %%Preparing Payload
  Payload = mochijson:encode({struct,[{"aps", {struct, [{"alert", Msg_final},{"content-available",Badge1}]}}, {"acme1", Type},{"acme2", Msg}, {"acme3", ENUM},{"acme4", Groupid}, {"acme5", Groupname},{"acme6", Sender_list_without_resource}, {"acme7", Content_list}]}),

  %%Converting Payload to binary
  BPayload = erlang:list_to_binary(Payload),  

  %%Fetching length of payload
  PayloadLen = erlang:byte_size(BPayload),

  %%Converting hexadecimal token to binary
  BToken = hexstr_to_bin(Token),

  %%Fetching length of token
  BTokenLength = erlang:byte_size(BToken),
  SomeID= 1,

  %%time stamp
  {MSeconds,Seconds,_} = erlang:now(),
  Expiry = MSeconds * 1000000 + Seconds + 3600*1,

  %%Constructing APNS packet
  Packet = <<1:8, SomeID:32/big, Expiry:32/big, BTokenLength:16/big, BToken/binary, PayloadLen:16/big, BPayload/binary>>,

  %Sending data over SSL
  ssl:send(Socket, Packet).

0 个答案:

没有答案