0
\$\begingroup\$

I have setup Firebase authentication in my game for Android. I need to implement a feature in my Android game, where a user can challenge another player. I need to implement it this way: The user is shown the list of all users registered on Firebase on the Game. To any user, he can tap on a button for respective user to send a challenge. When, he taps, a push notification is to be recieved by that user. When he taps on the notification, he is redirected to a specific part of the game. Maybe a specifc scene for now and he is shown there the Challenger's name. I have explored the Firebase documentation, but it does not provide information for client-client push notifications. Maybe there are other options available like GameSparks and OneSignal. But I don't know if there is a requirement of own Server for implementing it.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Have you considered the potential griefing implications of allowing any user to cause push notifications to be sent to any other user, even if they have no pre-existing relationship (such as being on each others' friends lists or being in a match together currently)? \$\endgroup\$
    – DMGregory
    Mar 17, 2019 at 19:37
  • \$\begingroup\$ @DMGregory I know this is not the ideal way. I'm just working to implement this feature. When I'm done with it, I'll be restricting to only friends. \$\endgroup\$ Mar 17, 2019 at 19:39
  • \$\begingroup\$ Note that every push notification is ultimately initiated server-side. Your user can send a message to a server asking it to trigger a push notification to another user, without the notification ever travelling client-to-client per se. \$\endgroup\$
    – DMGregory
    Mar 17, 2019 at 19:45
  • \$\begingroup\$ Alright... Then my question would be how to implement this 'server' functionality on Firebase. You are welcome to guide me about that in Answer. I've read somewhere I need to write 'function' on firebase. But what will be exactly the way to do it. Or what prequisites I need to know before jumping into it. Note: I'm sorry if my terms disturb you. I'm totally noob with Firebase. \$\endgroup\$ Mar 17, 2019 at 19:49

1 Answer 1

0
\$\begingroup\$

Don't send the notification directly. That isn't possible. However, you can deal with the notifications like this: One user sends the challenge to the other. I'd assume it could be as simple as a string saying that it is a challenge and a couple of strings with information about the sender. Then, all you have to do is tell the receiving end to notify the user every time it receives a challenge. This way, all the code is local, and the information being sent is nice and simple.

In short, send the other device the challenge, which then prompts the user with a notification. The rest is all handled locally. Hope this helps!

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .