Hi,
I am trying to create a cloud script that can notify your friends you join the game. I did something like this:
var result = server.GetFriendsList(request); if(result.Friends) { for (var i = 0; i < result.Friends.length; i++) { var currId = result.Friends[i].FriendPlayFabId; var request = { Recipient: currId, Subject:"Your friend's joined the run!", Message: name + " joined the game!" }; try { var notifyResult = server.SendPushNotification(request); //log.info(notifyResult); } catch (e) { //var msg = "Error: " + JSON.stringify(e); //log.info(msg); } } }
It partly works, but I want to avoid errors for friends whose don't have any device connected to recieve notification. Try/Catch didn't help, I still get error for each friend without device connected. I just implement registration for push notifications, so in product version every player shoud have a device connected. But I still want to solve this for situation that there is no device registered.
And I have a second question: Is there way to notify all friends with the same notification without sending notifications in a loop? Because in this situation, I reached CloudScript execution API requests limit quickly and I have to split calls for many friends.
Or is there a way to send notification directly from unity API without using cloud script?
Thanks,
Regy