Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

[HELP]Unity Push Notification

Discussion in 'General Discussion' started by Katliyam61, Apr 18, 2016.

  1. Katliyam61

    Katliyam61

    Joined:
    Jan 30, 2016
    Posts:
    7
    Hi guys,

    I want push notification like Whatsapp. For that , plugin listen to server. if server change any variable , run c# codes in Unity. I can do it ?
     
  2. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,435
  3. Marceta

    Marceta

    Joined:
    Aug 5, 2013
    Posts:
    176
    ChiliGuaya and theANMATOR2b like this.
  4. Katliyam61

    Katliyam61

    Joined:
    Jan 30, 2016
    Posts:
    7
    Thx for reply friends ,

    @Marceta I know onesignal but that system not automatic. I don't want use controller panel. I want plugin listener mysql database if server change variable , run function on unity. Onesignal can do it ?

    @andymads hi , i want work on android & ios.
     
  5. Marceta

    Marceta

    Joined:
    Aug 5, 2013
    Posts:
    176
    @Katliyam61
    It can be done with OneSignal, check the docs.
     
  6. Katliyam61

    Katliyam61

    Joined:
    Jan 30, 2016
    Posts:
    7
    I could not find anything about it, can you help me? Can you give a class name or a link?
     
  7. Marceta

    Marceta

    Joined:
    Aug 5, 2013
    Posts:
    176
    I'm not exactly sure what are you trying to do, you need to explain it a bit more. But let's assume you are working on tournament leaderboard and you want to notify all players in that tournament about new change of positions. So if you have somewhere method on server side which insert/update rows in tournament table you can make simple notification and send it only to those players. Also you can send data trough notification. Using that data which players receive you can do whaterver you want, call some method in game, use stuff from data, etc...

    https://documentation.onesignal.com/docs/notifications-create-notification
     
  8. Katliyam61

    Katliyam61

    Joined:
    Jan 30, 2016
    Posts:
    7
    Player send message other player > server read message and save , send notification to player. i want all player listen to mysql database in background. if have a new message , send notification to device
     
  9. Katliyam61

    Katliyam61

    Joined:
    Jan 30, 2016
    Posts:
    7
    Edit ,

    Player send message (save variable to mysql database with php) to other player > All player listen mysql database in loop with 5 seconds , if have a new message , send notification to himself
     
  10. Marceta

    Marceta

    Joined:
    Aug 5, 2013
    Posts:
    176
    Well from my perspective you don't need that 5 seconds loop and if you somehow really need it, then i suggest you to check Node.js and websockets or Firebase as final solution. But since problem is simple do it like this, when you write that message to database using your php code just create and send notification to that user about new message. I have almost same logic in my latest game and one signal handle it well without much delay or any kind of problem.
     
  11. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,677
    Yeah Unity should have no part in this chain if you are only talking about mobile push notifications. If player sends a message to another player then the webservice/server that is adding the message to database should call the push service same time when adding a row to database and even then only if the message receiver is offline.

    Players should never ever be connected to push server or database and should only use webservice/game server.
     
  12. Yukichu

    Yukichu

    Joined:
    Apr 2, 2013
    Posts:
    417
    AWS Lambda and SNS? I agree this doesn't have much to do with Unity, and having it directly tied into the database seems weird. You have to update the database somehow, right? It doesn't just happen on its own.
     
  13. Katliyam61

    Katliyam61

    Joined:
    Jan 30, 2016
    Posts:
    7
    Hi friends , thx for reply

    @Ostwind , Yes i guess this is what I want. Sorry my english is low. How use webservice ? Could you give information about the webservice ?

    @Yukichu i don't know AWS Lambda and SNS. i want plugin run in background and listen to database. if any player send a message to us , sent notification to us from plugin
     
  14. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,677
    You need to make one and making one depends totally on what your web server supports and which tech you choose. You can google something like "unity rest service", "unity soap service" or "unity nodejs mysql" etc.
     
  15. kumar3087

    kumar3087

    Joined:
    May 12, 2014
    Posts:
    2
    I am trying this too, a year ago it was working fine,
    but now its not, the notification does't deliver in time, I mean it takes hours to display on target device if app is not running, but if its running, then right away.
    Do you know why?
     
  16. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    3,791
    Why don't you contact OneSignal support instead of resurrecting a thread nobody has posted in in over two years?
     
    Marceta likes this.