Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Push Notifications on Unity Android?

Discussion in 'Android' started by NathanWarden, Mar 6, 2012.

  1. NathanWarden

    NathanWarden

    Joined:
    Oct 4, 2005
    Posts:
    663
    Hey all,

    I've been doing research for several days now, and I can't seem to find anyone explaining how to do Push Notifications on Android either by plugin, or linking the Library or whatever.

    Has anyone done Push on Android?

    Thanks,
    Nathan
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Androids push works a bit very different compared to the iOS one

    what do you want in detail? I assume remote push notifcations right as local push isn't really needed on android, it has no '1 app only running' dogma (or more precisely: thats what services are for on android)
     
  3. Tseng

    Tseng

    Joined:
    Nov 29, 2010
    Posts:
    1,217
    typically you send push notifications from within Java code. Just make a method which takes 2 string parameters (or 3 if you want icon), us that to send the notification. Then just use JNI from within Unity to call that method.

    Same goes for Intents etc. It's to much of a pain in the ass, to make every thing via JNI calls from Unity3d
     
  4. NathanWarden

    NathanWarden

    Joined:
    Oct 4, 2005
    Posts:
    663
    Hey guys,

    Thanks for the info. Basically what I want to do in short detail is:

    1. I send a message through my app up to the server.
    2. The server (Urban Airship) will push the notification to the Android phone.
    3. User gets a notification that they got a message regardless of if app has been opened

    Thanks a ton again,
    Nathan
     
  5. umarali

    umarali

    Joined:
    Jan 2, 2013
    Posts:
    2
    Hi All,
    can you help me a bit more to send notification to user.
    I want to send notification to user from my app using unity(android) on an event.
     
    Last edited: Jan 2, 2013
  6. lnjuanj

    lnjuanj

    Joined:
    Jan 2, 2013
    Posts:
    3
    Last edited: Jan 2, 2013
  7. bernardfrancois

    bernardfrancois

    Joined:
    Oct 29, 2009
    Posts:
    373
    Have you tried PushWoosh? I wonder if they support actual push notifications rather than local notifications only. They don't say anything about setting up a php/mysql server in their short documentation, for instance...
     
  8. ryanmillerca

    ryanmillerca

    Joined:
    Aug 12, 2012
    Posts:
    143
    Hey Nathan, I'm looking for Android push as well, did you find a solution?

    Seems like the thing to do is go through GCM (Google Cloud Messaging) and even with that, I think your app needs to be open in order for a message to be received.
     
  9. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    Just in case anyone is still looking for information on how to set up Remote Notifications in Android, I have an asset in the Asset Store that deals with this -and with iOS Push Notifications:

    u3d.as/content/carlos-fernandez-musoles/easy-cross-platform-notifications

    http://forum.unity3d.com/threads/185452-Easy-Cross-Platform-Notifications-available-now!


    It contains everything you may need to set up your own Notification System, and it works cross-platform (from Android to iOS and vice versa).

    Hope it helps!

    Cheers,
    Carlos.
     
    Last edited: Jun 10, 2013
  10. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Hi, I want to do the following on my Android game (and eventually on iOS too). Notify the player of my game that his "energy" has refilled so he can play again with a push notification. This "shouldn't" require PHP or a database at all, just some timer code in the game with a non-dynamic message. Do I have to use Urban Airship or one of those services? If so, does this cost money on a recurring basis? If the answer is different for iOS, same question there.
     
  11. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    Please check my answer to your query on the original post:

    http://forum.unity3d.com/threads/185452-Easy-Cross-Platform-Notifications-available-now!

    The answer basically depends on how your game knows a certain player has refilled energy. If it is remotely -i.e. in a server you own- then you could use remote notifications and my package ECPN is designed to help you set this up. If this is a timer -as I think is what you are using- then you should use local notifications, which certainly are in no need of using any servers -and I am afraid services like Urban Airship will be on the remote notification approach.
     
  12. pimpin

    pimpin

    Joined:
    Nov 11, 2012
    Posts:
    6
  13. vishnu_garg

    vishnu_garg

    Joined:
    Sep 10, 2013
    Posts:
    1
    Hey , You can easily integrate Push Notification on Android device using App42 API.
    1. App42 API support to Push Notification on cross platform.
    2 . You can refer this blog
    to integrate Push Notification in Unity using Android.
     
    akkiDev likes this.
  14. gdeglin

    gdeglin

    Joined:
    Mar 7, 2013
    Posts:
    78
  15. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hey,
    Now there is a new asset available in the Asset Store - UTNotifications. It works seamlessly with both the scheduled and push notifications for Android (Google Play based & Amazon devices) and iOS. It's an asset and not a service like GameThrive so it's very customisable - the complete source code is provided for both the client & server sides (the server side is needed for push notifications only). As one of its developers I would be glad to assist you with its integration. Here is an API Reference: http://universal-tools.github.io/UTNotifications/html/annotated.html (the asset also includes the detailed step-by-step manual).
    There is more here: http://forum.unity3d.com/threads/re...-platform-push-notifications-and-more.333045/
     
    Last edited: Jun 14, 2015
  16. tonyDai

    tonyDai

    Joined:
    Sep 27, 2014
    Posts:
    17
  17. marsoups

    marsoups

    Joined:
    Jan 7, 2013
    Posts:
    11
    Does anybody have any info on how to retrieve the registration ID through native code via unity ? We don't want to use a third party and wish to retrieve this ID to send to an existing third party server to handle the push notification. Thanks if anyone can advise!

    The google play service API for //unity is limited and doesn't allow API calls as such that are required to obtain this.
     
  18. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi marsoups,
    Unity doesn't support GCM directly indeed so if you want to avoid usage of any 3rd party code, you'll have to add this support yourself using Native Plugins.
    But you can also use client-side 3rd party solution, such as our UTNotifications. It assumes that you use your own server to send push notifications (but goes with a DemoServer written in Java that you can use as a reference and to check that a configuration is correct). It provides a convenient cross-platform client API for APNS (Apple Push Notification Service), GCM (Google Cloud Messaging) & ADM (Amazon Device Messaging). It is completely open source (including the native plugins) so you can change all you wish as you like. We are always glad to assist you: universal.tools.contact@gmail.com.
     
  19. darkguy2008

    darkguy2008

    Joined:
    Mar 26, 2020
    Posts:
    8
    Hi Yuriy, I'm kinda interested in UTNotifications but I find it kinda pricey. Do you know if it has firebase integration? I need a way to reliably send local notifications (though push could work, as well) in both Android & iOS. Does UTNotification does it? Otherwise, what is the best way to do this in 2019? thanks!...
     
  20. Aligdev

    Aligdev

    Joined:
    Mar 9, 2016
    Posts:
    35