Sign In Register

How can we help you today?

Start a new topic

Friend Message does not receive when player is offline.

Hello GameSparks Support.

I'm having trouble getting Friend Message when player is offline in Unity3d. When player is online, receiving messages works fine. 

Below is my Code.

1. SendMessage:


 

public void sendMsg()
 {
 new SendFriendMessageRequest()
 .SetFriendIds(friendID)
 .SetMessage(messageInput.text).SetDurable(true)
 .Send((response) => {

 if (response.HasErrors)
 {
 Debug.Log("Message sending failed");

 } else {


 Debug.Log("Nabeel - Message sent successful");
 }

 });
 }

 


2. Receive Message:

 

void Awake()
 {
 FriendMessage.Listener += messageInfo;
 }

public void messageInfo(GameSparks.Api.Messages.FriendMessage message)
 {
 GameObject mp = (GameObject)Instantiate(messagePrefab);

 mp.GetComponent<Message>().msg = message.Who + " sent you " + message.Message;

 }

 

1 Comment

Hi Nabeel,


For someone to receive a message offline you would need to integrate with a push notification provider. we have a guide on how to do this with FCM here.


Regards,

Liam

Login to post a comment