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

Easy Local Android Notifications

Discussion in 'Assets and Asset Store' started by CarlosFM, Jul 2, 2013.

  1. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    Hi all,

    I apologise for appearing unresponsive for the last few days -Unity forums does not notify me anymore of new messages being posted on this post, so I'll have to keep a closer eye from now on.

    For those of you facing the issue with cancelling notifications before creating them, we just pushed an update to the Asset Store that fixes this and brings some new functionality (specifying your own sound, instead of always playing the default tone).

    I understand it may take a few days for the folks in Unity to approve the package, so if you need the fix immediately, please drop me a line with your invoice number at: carlos.fernandez.musoles (at) gmail (dot) com

    Thank you all!
     
  2. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    @rafimagsi: are you still facing that issue? Does it work if you just set one notification at a time?
     
  3. chandler55

    chandler55

    Joined:
    Jun 8, 2010
    Posts:
    17
    hmmm, with the latest, I'm still having the error unfortunately :( I've been digging for a while though, and what I found is the intent that gets passed to TimedAlarm sometimes loses its extras ( and thus the null pointer exception since it can't find the unityClass) . I have no idea how or why yet. will dig more

     
  4. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    @chandler55: the latest version hasn't been approved yet on the Asset Store. You should try version 1.13 once is out -or if you need it urgently, just drop me an email with your invoice number and I'll send it to you.

    Cheers
     
  5. anshul jhawar

    anshul jhawar

    Joined:
    Sep 8, 2014
    Posts:
    1
    Good job Carlos ... Works like charm ..

    I have one issue though ... I want to know if the notification was shown or not (after a notification is scheduled with a delay). Basically a callback once ELAN fires a notification to the status bar. I wanted to track whether all the notifications scheduled are being displayed or not (Like in case or restart device/ force stop we might lose notifications). Let me know if any such functionality is present.

    Thanks
     
  6. rafimagsi

    rafimagsi

    Joined:
    Oct 27, 2014
    Posts:
    14
    Hello @CharlosFM the version 1.13 is creating problem with Google Ads. After updating ELAN 1.13 in my project it won't let AdMob to show ads and it crashes my app.
    Do you have any idea how to resolve this issue ?
     
  7. Tripwire

    Tripwire

    Joined:
    Oct 12, 2010
    Posts:
    442
    Hi Carlos,

    I'm using this script to send notifications:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using System.Runtime.InteropServices;
    5. using System;
    6.  
    7. public class NotificationManager : MonoBehaviour
    8. {
    9.     public DatabaseManager DM;
    10.     public TranslateExerciseManager TEM;
    11.  
    12.     #if UNITY_IOS
    13.     private CalendarUnit unit;
    14.     private LocalNotification local;
    15.  
    16.     public LocalNotifs notif;
    17.  
    18.     [DllImport ("__Internal")]
    19.     private static extern void _EnableLocalNotificationIOS8();
    20.     #endif
    21.  
    22.     public ELANNotification AndroidNotification;
    23.  
    24.     private void Start()
    25.     {
    26.         #if UNITY_IOS && !UNITY_EDITOR
    27.         _EnableLocalNotificationIOS8();
    28.         #endif
    29.     }
    30.  
    31.     public void CreateNotification()
    32.     {
    33.         if(PlayerPrefs.GetInt("Notif") != 1)
    34.         {
    35.             #if UNITY_IOS && !UNITY_EDITOR
    36.             notif.DeleteLocalNotifications();
    37.             #endif
    38.  
    39.             #if UNITY_ANDROID && !UNITY_EDITOR
    40.             ELANManager.CancelAllNotifications();
    41.             #endif
    42.  
    43.             DateTime date01 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 08, 00, 00);
    44.             DateTime date02 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 13, 00, 00);
    45.             DateTime date03 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 19, 00, 00);
    46.             DateTime temp = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute + 1, 00);
    47.  
    48.             CreatePushNotification(Language.Get("Notification_Header01"), Language.Get("Notification_Message01"), date01, "1");
    49.             CreatePushNotification(Language.Get("Notification_Header01"), Language.Get("Notification_Message01"), date02, "2");
    50.             CreatePushNotification(Language.Get("Notification_Header01"), Language.Get("Notification_Message01"), date03, "3");
    51.             CreatePushNotification("Test", "Test notification", temp, "4");
    52.  
    53.             PlayerPrefs.SetInt("Notif", 1);
    54.         }
    55.     }
    56.  
    57.     public void DeleteLocalNotifications()
    58.     {
    59.         #if UNITY_IOS && !UNITY_EDITOR
    60.         notif.DeleteLocalNotifications();
    61.         #endif
    62.  
    63.         #if UNITY_ANDROID && !UNITY_EDITOR
    64.         ELANManager.CancelAllNotifications();
    65.         #endif
    66.  
    67.         PlayerPrefs.SetInt("Notif", 0);
    68.     }
    69.  
    70.     private void CreatePushNotification(string title, string message, System.DateTime fireDate, string keyValue)
    71.     {
    72.         #if UNITY_IOS && !UNITY_EDITOR
    73.         notif.createCustomLocalNotification(title,  message, keyValue, fireDate, CalendarUnit.Day, 1);
    74.         #endif
    75.  
    76.         //#if UNITY_ANDROID && !UNITY_EDITOR
    77.         Debug.Log("CREATING NOTIFICATIONS!");
    78.  
    79.         AndroidNotification = new ELANNotification();
    80.         AndroidNotification.ID = int.Parse(keyValue);
    81.         AndroidNotification.title = title;
    82.         AndroidNotification.message = message;
    83.         AndroidNotification.fullClassName = "com.devfo.andutils.DevfoUnityPlayerActivity";
    84.         AndroidNotification.advancedNotification = true;
    85.         AndroidNotification.repetitionTypeTime = EnumTimeType.Days;
    86.         AndroidNotification.useSound = true;
    87.         AndroidNotification.useVibration = true;
    88.         AndroidNotification.send();
    89.         //#endif
    90.  
    91.         #if UNITY_EDITOR
    92.         Debug.Log("Notifications only on mobile devices!");
    93.         #endif
    94.     }
    95. }
    The repeating notifications work perfectly. But when I remove all the notifications (DeleteLocalNotifications method), and set the notifications again, It doesn't send the notifications again (i'm talking about the Test notification).

    EDIT:
    I've also found out that when I tap on a notification I get the black screen issue (using Android 5.0 Lollipop and the latest ELAN version). I think it has something to do with my AndroidManifest file. Can you take a look?

    Code (CSharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <manifest
    3.         xmlns:android="http://schemas.android.com/apk/res/android"
    4.         package="nl.synappz.fysiotherappy"
    5.         android:versionName="1.2"
    6.         android:versionCode="2">
    7.      
    8.     <uses-permission android:name="android.permission.INTERNET" />
    9.     <uses-permission android:name="android.permission.VIBRATE"/>
    10.     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    11.  
    12.     <supports-screens
    13.         android:smallScreens="true"
    14.         android:normalScreens="true"
    15.         android:largeScreens="true"
    16.         android:xlargeScreens="true"
    17.         android:anyDensity="true" />
    18.      
    19.     <application
    20.         android:icon="@drawable/app_icon"
    21.         android:label="@string/app_name"
    22.         android:debuggable="false">
    23.                
    24.         <activity
    25.             android:name="com.devfo.andutils.DevfoUnityPlayerActivity"
    26.             android:label="@string/app_name"
    27.             android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
    28.             android:screenOrientation="portrait">
    29.                 <intent-filter>
    30.                     <action android:name="android.intent.action.MAIN" />
    31.                     <category android:name="android.intent.category.LAUNCHER" />
    32.                 </intent-filter>
    33.         </activity>
    34.  
    35.         <activity android:name="com.unity3d.player.VideoPlayer" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:screenOrientation="portrait">
    36.         </activity>
    37.      
    38.         <!-- ELAN java -->
    39.         <service android:enabled="true" android:name="com.CFM.ELAN.ELANAlarmCreator" />
    40.         <receiver android:name="com.CFM.ELAN.TimedAlarm" />
    41.         <!-- end -->
    42.      
    43.     </application>
    44.  
    45. </manifest>
     
    Last edited: Dec 2, 2014
  8. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    @rafimagsi: are you still having problems with the version 1.13 and Google Ads? We haven't changed anything fundamental from version 1.12 to 1.13 other than adding some safeguard clauses here and there, it should not affect Google ads at all. Have you checked that the manifest has not been accidentally overwritten with the update? Another thing you can do is capture the crash in a logcat and send it to me to see what's going on (carlos.fernandez.musoles (at) gmail (dot) com).

    @Tripwire: Have you tried to set the notifications after cancelling them? I mean leave a frame or some specifie amount of time -just speculating about it!
     
  9. Tripwire

    Tripwire

    Joined:
    Oct 12, 2010
    Posts:
    442
    Thx for the reply!

    The user has to set some specific data to get the notifications to work. So there is at least a10 / 20 seconds between cancelling the notification and setting them again. Can you see anything wrong with my script or AndroidManifest file? I still have the black screen issue too.

    This also happens on my Phone which uses Android 4.4.4 (black screen issue)

    EDIT:
    Log file from Eclipse:
    EDIT:
    It seems that it works in Unity 4.6 again (No black screen issues anymore!)
     
    Last edited: Dec 9, 2014
  10. ClockStoneAdmin

    ClockStoneAdmin

    Joined:
    Sep 1, 2012
    Posts:
    56
    I am having a major problem when using the latest ELAN v1.13 in combination with Prime31 plugins which require the use of their UnityPlayer activities (com.prime31.UnityPlayerNativeActivity etc.). When the user presses on the notification the app is not opened correctly, instead I only see a black screen. I have now spent more than a day experimenting around with different manifest parameters but no luck so far. I have set the activity name in your prefab correctly.
    Here you can download my test project, which is an empy project with only ELAN v1.13 imported. As soon as I add the Prime31 activity I get the black screen: https://www.dropbox.com/s/izo3e5smrfcexwv/TestLocalNotifications.zip?dl=0
    In the ZIP file you can also see the logfile when doing the following actions:
    1) launch the test app and schedule a notification in 15 seconds
    2) press the home button and wait 15 seconds
    3) press the notification ->black screen appears

    I have aldo included the APK in the ZIP file.

    Here are my system specs: Unity v4.6.1 with Android SDK 5.0.1, SDK Tools rev 24, Build tools rev 21
    Tested on the following devices: Galaxy S3 with Android 4.3, Galaxy S4 with Android 4.4.2

    Please note that ELAN already worked on some devices in combination with Prime31 with an earlier configuration: Unity 4.5.5 and ELAN v1.12 and Android SDK 4.4. (it worked on the S3, but it didn't work on the S4, same black screen issue here)

    Thank you very much for your help in advance, this issue is actually really urgent for us, as notifications are an important aspect of our new game. As many Android Unity developers are using one or the other Prime31 plugin many of your clients will have the same issue.

    Michael
    ClockStone Software GmbH
     
  11. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    Hi @Clockstone2: I've sent you an email to follow up your case.
     
  12. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    Hi all,

    Digging a little deeper on the infamous "black screen" issue I have found out that if you stick the following tag inside the main activity declaration on your manifest it solves it!

    android:launchMode="singleInstance"

    Make sure that's part of the main activity in your manifest. Let me know if this is working across the board

    Cheers
     
  13. Kyrmaal

    Kyrmaal

    Joined:
    Dec 17, 2014
    Posts:
    2
    It doesn't seem to make any difference to my app, I still have the black screen.

    Nearly the same context as Clockstone2 : prime31 plugin with ELAN 1.13 and Unity 4.6.1.
     
  14. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    Hi,

    It seems to be working for clockstone2. Could you send me your manifest? My email is carlos.fernandez.musoles (at) gmail (dot) com

    If possible could ypu send me a minimal project still showing the issue?

    Cheers
     
  15. Tripwire

    Tripwire

    Joined:
    Oct 12, 2010
    Posts:
    442
    Hi CarlosFM,

    Is there a way to delay a LocalNotification? I've want my notifications only to show up at 8:00, 13:00 and 19:00. The local notifications are firing at those times but when I create them they immediately show up as a notification. So I get 3 notifications immediately after creating the notifications.

    This is the code I use to set the notifications:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using System.Runtime.InteropServices;
    5. using System;
    6. public class NotificationManager : MonoBehaviour
    7. {
    8.     public DatabaseManager DM;
    9.     public TranslateExerciseManager TEM;
    10.     #if UNITY_IOS
    11.     private CalendarUnit unit;
    12.     private LocalNotification local;
    13.     public LocalNotifs notif;
    14.     [DllImport ("__Internal")]
    15.     private static extern void _EnableLocalNotificationIOS8();
    16.     #endif
    17.     public ELANNotification AndroidNotification;
    18.     private void Start()
    19.     {
    20.         #if UNITY_IOS && !UNITY_EDITOR
    21.         _EnableLocalNotificationIOS8();
    22.         #endif
    23.     }
    24.     public void CreateNotification()
    25.     {
    26.         if(PlayerPrefs.GetInt("Notif") != 1)
    27.         {
    28.             #if UNITY_IOS && !UNITY_EDITOR
    29.             notif.DeleteLocalNotifications();
    30.             #endif
    31.             #if UNITY_ANDROID && !UNITY_EDITOR
    32.             ELANManager.CancelAllNotifications();
    33.             #endif
    34.             DateTime date01 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 08, 00, 00);
    35.             DateTime date02 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 13, 00, 00);
    36.             DateTime date03 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 19, 00, 00);
    37.             DateTime temp = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute + 1, 00);
    38.             CreatePushNotification(Language.Get("Notification_Header01"), Language.Get("Notification_Message01"), date01, "1");
    39.             CreatePushNotification(Language.Get("Notification_Header01"), Language.Get("Notification_Message01"), date02, "2");
    40.             CreatePushNotification(Language.Get("Notification_Header01"), Language.Get("Notification_Message01"), date03, "3");
    41.             CreatePushNotification("Test", "Test notification", temp, "4");
    42.             PlayerPrefs.SetInt("Notif", 1);
    43.         }
    44.     }
    45.     public void DeleteLocalNotifications()
    46.     {
    47.         #if UNITY_IOS && !UNITY_EDITOR
    48.         notif.DeleteLocalNotifications();
    49.         #endif
    50.         #if UNITY_ANDROID && !UNITY_EDITOR
    51.         ELANManager.CancelAllNotifications();
    52.         #endif
    53.         PlayerPrefs.SetInt("Notif", 0);
    54.     }
    55.     private void CreatePushNotification(string title, string message, System.DateTime fireDate, string keyValue)
    56.     {
    57.         #if UNITY_IOS && !UNITY_EDITOR
    58.         notif.createCustomLocalNotification(title,  message, keyValue, fireDate, CalendarUnit.Day, 1);
    59.         #endif
    60.         //#if UNITY_ANDROID && !UNITY_EDITOR
    61.         Debug.Log("CREATING NOTIFICATIONS!");
    62.         AndroidNotification = new ELANNotification();
    63.         AndroidNotification.ID = int.Parse(keyValue);
    64.         AndroidNotification.title = title;
    65.         AndroidNotification.message = message;
    66.         AndroidNotification.fullClassName = "com.devfo.andutils.DevfoUnityPlayerActivity";
    67.         AndroidNotification.advancedNotification = true;
    68.         AndroidNotification.repetitionTypeTime = EnumTimeType.Days;
    69.         AndroidNotification.useSound = true;
    70.         AndroidNotification.useVibration = true;
    71.         AndroidNotification.send();
    72.         //#endif
    73.         #if UNITY_EDITOR
    74.         Debug.Log("Notifications only on mobile devices!");
    75.         #endif
    76.     }
    77. }
     
  16. Tripwire

    Tripwire

    Joined:
    Oct 12, 2010
    Posts:
    442
    Carlos?
     
  17. MORKANE

    MORKANE

    Joined:
    Feb 13, 2015
    Posts:
    3
    :):)Hello my friends, I want you to give me the code notices for Android;);)
     
    Last edited: Feb 13, 2015
  18. ClockStone_Helmut

    ClockStone_Helmut

    Joined:
    Feb 23, 2015
    Posts:
    12
    @Tripwire looks like you forgot to set AndroidNotification.delay. Also set AndroidNotification.delayTypeTime in your example.
     
  19. ClockStone_Helmut

    ClockStone_Helmut

    Joined:
    Feb 23, 2015
    Posts:
    12
    @CarlosFM

    with v1.14c we get "Unable to start receiver" because of a NullPointerException

    Code (CSharp):
    1.  
    2. threadid=1: thread exiting with uncaught exception (group=0x41627c08)
    3. java.lang.RuntimeException: Unable to start receiver com.CFM.ELAN.TimedAlarm: java.lang.NullPointerException: name == null
    4.      at android.app.ActivityThread.handleReceiver(ActivityThread.java:2417)
    5.      at android.app.ActivityThread.access$1700(ActivityThread.java:138)
    6.      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1275)
    7.      at android.os.Handler.dispatchMessage(Handler.java:102)
    8.      at android.os.Looper.loop(Looper.java:136)
    9.      at android.app.ActivityThread.main(ActivityThread.java:5034)
    10.      at java.lang.reflect.Method.invokeNative(Native Method)
    11.      at java.lang.reflect.Method.invoke(Method.java:515)
    12.      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
    13.      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
    14.      at dalvik.system.NativeStart.main(Native Method)
    15. Caused by: java.lang.NullPointerException: name == null
    16.      at java.lang.Class.classForName(Native Method)
    17.      at java.lang.Class.forName(Class.java:251)
    18.      at java.lang.Class.forName(Class.java:216)
    19.      at com.CFM.ELAN.TimedAlarm.onReceive(TimedAlarm.java:35)
    20.      at android.app.ActivityThread.handleReceiver(ActivityThread.java:2410)
    21.      ... 10 more
    22.  
    Our log is

    Code (CSharp):
    1.  
    2. [minimizing app]
    3. Scheduling timed loop notification for "Foo" in 25 seconds.
    4. public static void sendParametrizedNotification (ELANNotification notification) --> com.prime31.UnityPlayerNativeActivity
    5. FireNotification --> com.prime31.UnityPlayerNativeActivity
    6. [notification occurs]
    7. [opening app]
    8. [minimizing app]
    9. Cancelling all notifications.
    10. Scheduling timed loop notification for "Foo" in 46 seconds.
    11. public static void sendParametrizedNotification (ELANNotification notification) --> com.prime31.UnityPlayerNativeActivity
    12. FireNotification --> com.prime31.UnityPlayerNativeActivity
    13. [notification occurs]
    14. [opening app]
    15. [crash]
    16.  
    I could not reproduce the crash later. Everything would work fine then.
    Other users reported that the second notification would never get fired and that the app would automatically be focused again after minimizing.
     
  20. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    Hi,

    I have sent an email to follow on this, just wanted to know we are working on it.

    Cheers,
    Carlos
     
  21. Wilbert-Blom

    Wilbert-Blom

    Joined:
    Aug 13, 2011
    Posts:
    109
    Hi,
    I'm thinking about using this Asset. But could you please tell me if the problem with old message removal as posted at the Asset store has been resolved ?

    "It's very important, with notifications, to be able to easily clear notifications set from a previous session so they don't stack up. This plug in offers no simple way of tracking old notifications which could linger. "
     
  22. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    Hi Willbert Blom.

    At the moment there is no built-in function to remove already fired notifications. This is a feature we plan to implement in the future, but as of today we have no timeline for it.

    Let me know if you need more information
     
  23. Dev Chorus

    Dev Chorus

    Joined:
    Nov 1, 2013
    Posts:
    5
    Hi CarlosFM,
    Thanks for your great plugin!
    I have two question with it:
    1. Is it possible to let the alarm manager run when the user force close (force stop) the app?
    eg. automatic restart the service after the force-close?
    2. when tested on Xiaomi(a kind of Chinese phone model) with the demo scene, it turns out that it didn't follow the settings but send the notification every 5 minutes. (no matter what integer sets in the repetition).
    Can you suggest what might be the reason?

    Thanks in advance.
     
  24. Tripwire

    Tripwire

    Joined:
    Oct 12, 2010
    Posts:
    442
    Hi CarlosFM,
    I still can't get the local notifications working correctly. I want to have three local notifications a day on the following times:
    09:00, 13:00 and 19:00

    But when the notification fires, it fires them all at once. I'm testing right now if I need to set some time between sending the notifications. Can you check my code, I'm in a bit of a hurry since I need to send this app to the Google Play store asap.
    Code (CSharp):
    1. AndroidNotification = new ELANNotification();
    2.         AndroidNotification.ID = int.Parse(keyValue);
    3.         AndroidNotification.title = title;
    4.         AndroidNotification.message = message;
    5.         AndroidNotification.fullClassName = "com.devfo.andutils.DevfoUnityPlayerActivity";
    6.         AndroidNotification.advancedNotification = true;
    7.         AndroidNotification.setFireDate(fireDate);
    8.         AndroidNotification.delay = 1;
    9.         AndroidNotification.delayTypeTime = EnumTimeType.Hours;
    10.         AndroidNotification.repetitionTypeTime = EnumTimeType.Days;
    11.         AndroidNotification.useSound = true;
    12.         AndroidNotification.useVibration = true;
    13.         AndroidNotification.send();
    EDIT:
    Changed the delayTypeTime from days to hours maybe this will help. Testing it now.

    EDIT 2:
    Didn't seem to work, I also noticed that on Android 5.0 notifications aren't firing? I'm using the latest Unity 4.6 version
     
    Last edited: Mar 11, 2015
  25. Raykz

    Raykz

    Joined:
    Mar 12, 2015
    Posts:
    1
    Hey so I am using ELAN 1.14c and everything seems to be working fine. Notifications go through, they are delayed exactly how I want them to, they repeat exactly as I want them to and get cancelled correctly but...

    When I click on the notification my app won't open. I read through the thread and noticed that this seemed to happen to a lot of people, I tried most of the solutions others have written (such as checking your MAIN activity name and editing the notifications fullClassName field to that or changing the androidLaunch field in my MAIN activity) but nothing has worked yet.

    I really need to understand what is going on, please help.
     
  26. Tripwire

    Tripwire

    Joined:
    Oct 12, 2010
    Posts:
    442
    Seems like the plugin is dead?
     
  27. RobinBGbanga

    RobinBGbanga

    Joined:
    Oct 20, 2014
    Posts:
    16
    Hi.
    I wanted to update the icon for our app. According to the docs, I replaced the one in Plugins/Android/res. However, the icon didn't update as expected. It just takes the app icon.
    Also, it would be great to be able to specify the icon used by code. In our case, we need different icons based on Android version (since 5.0+ requires white silhouette icons). So optimally, we'd want the colored one for older OS and the white outlines for 5.0.

    Please do let me know if you know how to achieve this.
     
  28. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    Thanks for your message.

    At the moment, if a user forces close the service that runs on the background -not the app, if the app is closed, the alarm should still work- then unfortunately it won't be fired. There is no straightforward solution for this.

    As per the issues you are experiencing, I am not sure, could you share how are you configuring your alarms? I do not get notifications from this forum, so if you want to send me that info to my email I can help you better: carlos.fernandez.musoles (at) gmail (dot) com
     
  29. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    I apologise for not getting back to you sooner.

    If you are setting the alarms all with the same ID, you might get some interferences there. Could you share with me how you are setting the notifications up (all of them). If you can fire me an email I am definitely more responsive there than in here as I do not get notifications from the forum. This is my email: carlos.fernandez.musoles (at) gmail (dot) com
     
  30. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    Could you please share with me some information, as this will help solve your issue:

    - Your android manifest
    - How are you setting your notifications
    - A logcat of the moment when you tap on the notification

    My email address is: carlos.fernandez.musoles (at) gmail (dot) com
     
  31. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    Hello,

    There was an issue with version 1.14 and changing the icon would not have an impact on the notification icon displayed. If you update your plugin to the latest version 1.15 you should be good to go by just modifying the ic_launcher.png file!
     
  32. PsychoPsam

    PsychoPsam

    Joined:
    Aug 1, 2012
    Posts:
    34
    Hi,

    I can't get this to work. I put the notification game object from the demo scene into my scene, set for 15 seconds, send on start and repeat for 1 second, change my android manifest to include this code, run the app and wait 15 seconds and the notification never happens.

    <service android:enabled="true" android:name="com.mycompany.myapp.ELANAlarmCreator" />
    <receiver android:name=“com.mycompany.myapp.TimedAlarm" />

    I’ve tried just the demo scene on the Android as well and setting the time and repeat then pressing Send doesn’t do anything.

    Do I have to use the parametric notification object as well???

    I've also change the class name to match my manifest. So I've put com.unity3d.player.UnityPlayerNativeActivity in the full class name slot in the Notifications game object.

    <activity android:name="com.unity3d.player.UnityPlayerNativeActivity"
    android:label="@String/app_name">
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>

    I have Unity 5.0.2

    Andy H.
     
  33. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    Hi Andy,

    I just responded to you over the email, but just in case someone else is struggling with the same issue, here is my answer:

    Please note that in your manifest, the receiver should be set to my package and not your application package name. So instead of

    Code (csharp):
    1. <receiver android:name=“com.mycompany.myapp.TimedAlarm" />
    you should have

    Code (csharp):
    1.  
    2. <receiver android:name=“com.CFM.ELAN.TimedAlarm" />
    This is because the receiver is a class whose qualified name is com.CFM.ELAN.TimedAlarm. If you change this, once your alarm is set off (at the 15 seconds mark) there is no one to respond to it and hence the notification never gets created.

    Hope this helps.
     
  34. Northmaen

    Northmaen

    Joined:
    Jun 23, 2015
    Posts:
    17
    Hi there ! Does this plugin still working in Unity 5 ? I'm planning to buy it for my project, but i've got a few questions :
    - Does the image for the notification is customizable ?
    - Does the option for removing notification after clicking is present ?
     
  35. SirEltonWacker

    SirEltonWacker

    Joined:
    Jul 21, 2014
    Posts:
    1
    Hey, @CarlosFM !

    I was wondering if there was a way to switch/set the small icon on the notification bar that appears once the notification is triggered.

    Thanks!
     
  36. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    Just purchase the latest version from AssetStore that built using Unity 5.2.x.
    Tested the demo scene on Android Device is not working ( no notification but having vibration only ) with the following log.

    12-30 17:34:07.477: I/Unity(17774): FireNotification --> com.unity3d.player.UnityPlayerActivity
    12-30 17:34:12.517: E/NotificationService(1238): Not posting notification with icon==0: Notification(pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x11 color=0x00000000 vis=PRIVATE)
    12-30 17:34:12.517: E/NotificationService(1238): WARNING: In a future release this will crash the app: com.TestELAN
     
  37. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    In Unity 5.x , it does not copy the Plugins/Android/res/* to Google Android Project.
    At the end, I works on the following Android Plugin Library Folder Structure
    Plugins/Android/ELAN_lib/libs/ELAN.jar <-- Remove *.java
    Plugins/Android/ELAN_lib/res/drawable/ic_launcher.png
    Plugins/Android/ELAN_lib/res/raw/bing.wav
    Plugins/Android/ELAN_lib/AndroidManifest.xml
    Plugins/Android/ELAN_lib/project.properties

    AndroidManifest.xml
    Code (CSharp):
    1.  
    2. <?xml version="1.0" encoding="utf-8"?>
    3. <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.ELAN">
    4.  
    5.     <application android:label="@string/app_name" android:icon="@drawable/app_icon" android:debuggable="true">
    6.         <service android:enabled="true" android:name="com.CFM.ELAN.ELANAlarmCreator" />
    7.         <receiver android:name="com.CFM.ELAN.TimedAlarm" />
    8.     </application>
    9.  
    10.     <uses-permission android:name="android.permission.VIBRATE"/>
    11. </manifest>
    12.  
    project.properties
    Code (CSharp):
    1. target=android-19
    2. android.library=true


    http://forum.unity3d.com/threads/ob...ets-plugins-android-res-is-deprecated.315889/
     
    Last edited: Dec 31, 2015
  38. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    @yuewahchan: happy new year! Sorry it took me a while to get back to you.

    Yes, as you said Unity 5.2.1 seemed to have issues with copying android resources when compiling, so you had to do the suggested workaround. However I have tested the plugin on the latest version of Unity 5.2.3 and it seems it is back to normal now.

    If you can upgrade, I would suggest you do so so you can enjoy the plugin without workarounds!
     
  39. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    Btw, it is not a workaround, almost other new 3rd party Android plugins use this method. It is better to organize with other plugins.
     
  40. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    Also, the clear notification is not work on the demo project. i.e. send a notification with 10 sec delay, and cancel it immediately.
     
  41. AnswerFinder

    AnswerFinder

    Joined:
    May 2, 2015
    Posts:
    7
    Hi! Another question, with plugin, can I send a few local notifications ( at once I send with deferent delay all of them ), but to always display only the last notification? Thanks.
     
    Last edited: Jan 21, 2016
  42. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    don't use the latest version, it is terrible, I just rollback to the old version.
     
  43. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    Hey, I have the same problem. It can not cancel notification for the latest version
     
    AnswerFinder likes this.
  44. SummitJain

    SummitJain

    Joined:
    May 30, 2014
    Posts:
    12
    Hello!

    ELAN Notification and integration is perfect. But there is a white notification icon on marshmallow android.

    We have integrated it perfectly fine and the notification icon is perfect on all devices except marshamallow devices. I have checked the google update for marshmallow.
    So the owner of the plugin can you please update your .jar files in your plugin and fix this asap. Thanks.

    Please click on the below link for some more information:
    http://stackoverflow.com/questions/...ion-is-not-showing-colour-icon-in-marshmallow
     
  45. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    @SummitJain: the white notifications are a new Google design policy -notifications must be shown in white. It seems there might be a way to set colour icons for extended notifications, I'll take a look and keep you posted!.

    @yuewahchan & @AnswerFinder: what version are you using? I was certain that bug was cleared in version 1.2, but I will investigate -but if you could let me know the version you are using, that'll be easier!

    BTW, yes, with the plugin, you will only see the last notification by default -even if you send more
     
  46. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    @SummitJain This enhancement turned out to be quite simple and will be included in the next version of ELAN. If you require it sooner, please could you please send me an email to carlos (dot) fernandez (dot) musoles (at) gmail (dot) com with your ELAN version (this is important as I can tailor the update to that)
     
  47. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    @yuewahchan I have tested that functionality on ELAN 1.2 and I do not seem to be able to reproduce the issue. If you can at your end, can you send me an email (address in the last comment) with your ELAN version, Unity version and a logcat (android debug on the device)?
     
  48. macoriha

    macoriha

    Joined:
    Apr 5, 2016
    Posts:
    1
    Hi,I also can not be canceled on ELAN 1.15

    Where is ELAN 1.2?
    The asset store has only 1.15
     
  49. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    Hello all,

    There where some issues with the publication of the latest version (1.2) but I can now confirm it has been pushed for approval. It should take a few days to get to the store.

    If anyone wishes to have the updated before this step, please email me your purchase ID and I will send you a copy. Please note that due to some dependencies the Asset Store will only show the newer version for users of Unity 5.1 and above -though if you want the update regardless you can email me your purchase id and I can send it over to you.

    carlos.fernandez.musoles (at) gmail (dot) com

    Thanks and apologies for the confusion.
     
  50. raviraj_vdy

    raviraj_vdy

    Joined:
    May 14, 2009
    Posts:
    309
    Hello @CarlosFM

    We are using your plugin and it works like a charm, Only one thing that we would like to know is how play a notification sound the sound provided is not being played.

    Thank You,
    Raviraj.
     
    Last edited: Apr 15, 2016