Search Unity

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
    $small_android1.png

    Hi All!

    I would like to present you my new package: Easy Local Android Notifications.

    Have you ever wondered whether you can have native local notification services for android? Now you can! With Easy Local Android Notifications you can:

    - Fire single notifications
    - Schedule repeating notifications
    - Cancel any delayed notifications

    Whether you want to remind your users to come back to your app or send them a single message about some event that happened when they were away, ELAN is an easy solution to send messages to the notifications bar.

    ELAN is the android equivalent of the built in NotificationServices for iOS.

    Let me know what you think about it.

    Enjoy and happy coding!

    $icon_androidbitmap.png
     
    Last edited: Aug 21, 2013
  2. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    Just adding a nice pic to make it all more visual :)

    $big_androidbitmap1.png
     
    Last edited: Jul 3, 2013
  3. sugi

    sugi

    Joined:
    Mar 12, 2013
    Posts:
    6
    It seems "ELANManager.SendNotification" is called in "OnApplicationPause", whenever suspend.
    Seeing log, I can see "am_create_activity" was called but "am_finish_activity" is not working.

    It working well, without when I call it in suspend.

    Could you tell me how we can resolve this problem?
     
  4. CarlosFM

    CarlosFM

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

    I'm not sure I understand what the issue is. The plugin has no calls OnApplicationPause method, so it should not be called when your app suspends! Could you send me the logs you are referring to so I can see what is going on?

    Also, how do you know the method SendNotification is being called there? Do you get a notification when you suspend (i.e. exit with the home button) the scene?
     
  5. sugi

    sugi

    Joined:
    Mar 12, 2013
    Posts:
    6
    Thank you for your quick response!
    I'm sorry for expression was not clear.

    Make what I want to do clear.
    I want set the Local Notification when user suspend the application,
    sutch as touch the home button.

    So, I use "SendNotification" in "OnApplicationPause".

    Here is the log,

    07-17 19:09:54.717: I/ActivityManager(539): START {flg=0x10000000 cmp=jp.co.NotificationTest/com.CFM.ELAN.ELANAlarmCreator (has extras) u=0} from pid 17748
    07-17 19:09:59.497: I/REC@0(539): am_create_activity: {1140868104,27,jp.co.NotificationTest/com.CFM.ELAN.ELANAlarmCreator,null,null,null,272629760}

    It is not work well, because stop befor "am_finish_activity".
    Thanks.
     
  6. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    OK, I think I know what's going on.

    You are right, if you call ELANManager.SendNotification() within OnApplicationPause it will stop before it actually sends the notification -however once you resume your app the notification will appear in the notification bar. This is a consequence of how android works: if the user suspends an app, any activity deriving from that app is suspended -including ELAN.

    According to Unity documentation you can use OnApplicationPause as a Co-routine, which could mean there is a way to stop the "suspend" process for long enough to send the notification, but I have not managed to make it work -it seems unity calls OnApplicationPause really when the app has been paused and not when it is being paused.

    That being said, maybe you can manage a workaround using ELANManager.ScheduleRepeatingNotification() or with ELANManager.SendNotification(delay) -both of them will deliver the message, no matter the state of your app (paused, killed...)
     
  7. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    If I reboot the phone, will future notification be killed too?
     
  8. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    If a user does reboot the phone, the future notification unfortunately won't reach its destination -pretty extreme use case though!

    Rebooting will also kill any repetitive notifications your app has set.
     
  9. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    I reboot my phone quite often, unfortunately. How does WhatsApp, Line do it? Maybe you can combine withe the server notification package to initiate the local packages back?
     
  10. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    WhatsApp and Line are closer to what I offer in ECPN: a system to deliver remote notifications to self or to other users of your app.

    This package is a simplification of that for the use case of some app wanting to deliver messages locally to your user -for those developers that do not have or do not want to have the server side set up.
     
  11. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    I have both. I'm just thinking of getting your package can cooperate by having the server to activate the local notification.
     
  12. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    Well, in fact that is what ECPN does! It receives the push notification (or GCM message in Google) and produces a local notification :) You could of course send a message to self and get it no matter what
     
  13. DaeRo

    DaeRo

    Joined:
    Jul 19, 2013
    Posts:
    1
    Screen is Black-out(1sec) to Function call in ELANManager.
    How Can i fix?
     
  14. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    Well, not much you can do there, as this is a consequence of the plugin being an activity in Java. I will try to minimize the impact if I can.
     
  15. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    I think you misunderstood me. I mean, my app would have code to fire the local notification, but if I use ECPN, then I need server side logic to fire. What I'm thinking is like a ping alive from the server, which talks to the local instead of both firing if app is active.
     
  16. sugi

    sugi

    Joined:
    Mar 12, 2013
    Posts:
    6
    I am also in trouble.
    When will it be fixed?
     
  17. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    @sugi @DaeRo: I've been working on that issue and I can confirm it has been solved! I just submitted an update to the asset store with the fix.

    Cheers.
     
  18. GerryM

    GerryM

    Joined:
    May 1, 2012
    Posts:
    20
    A quick question: Does this plugin only allow for sending (local) notifications or does it also register the app for handling the notifications?

    In other words, would it be possible to schedule a notification (in for example 2 hours) and then (when the user already did leave the app) actually fire up the unity application again when the notification is clicked?

    Thanks in advance!

    Cheers.
     
  19. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    @GerryM: yeah, the plugin was indeed designed with that particular functionality in mind!

    You can schedule your notifications with any delay you choose fit and after that time you will see it on the notifications bar -and clicking on it will load your app.
     
  20. GerryM

    GerryM

    Joined:
    May 1, 2012
    Posts:
    20
    Terrific! Thanks!

    Just bought it. Really a bargain. Was fumbling around with this functionally way too long..

    Keep up the good work :cool:
     
  21. dreamychris

    dreamychris

    Joined:
    Aug 28, 2012
    Posts:
    7
    Hi Carlos,

    Bought this last week, it looks like a useful little extension. One feature I was looking for is the ability to cancel or replace an existing notification. For iOS I can just call NotificationServices.CancelAllLocalNotifications(), but there's no equivalent in ELAN.

    Any chance of at least being able to (optionally) specify the ID in SendNotification, so we can have new notifications replace existing ones when desired? Being able to cancel by ID would also be nice. From my brief skim of the AlarmManager documentation this seems like the most straightforward way to implement replacement or cancelling.

    It looks like I can achieve what I want by scheduling a repeating notification with a very very long repetition delay (so it effectively never repeats), but that's not exactly elegant. :)
     
  22. dreamychris

    dreamychris

    Joined:
    Aug 28, 2012
    Posts:
    7
    I also noticed that the extension generates compile errors when the platform isn't Android, which is obviously a bit of an issue for any cross-platform project :) Luckily the fix is simple, just stick #if UNITY_ANDROID / #endif around the entire contents of ELANManager.cs and MainScene.cs. Any code that calls the ELANManager functions will also need to be removed from non-Android builds in this way, of course.
     
  23. CarlosFM

    CarlosFM

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

    Yep, you are right about the compiler error! This is a big overlook on my side -since this package was only designed for Android platforms I never stopped and think about it, but you have a point; I will include this myself on the next update.

    There is an equivalent: ELANManager.CancelRepeatingNotification() will cancel your previously set up Repeating Notification. At the moment there is a limitation on the number of repeating notifications your app can schedule (one), but as you mentioned, you can tweak this by adding an ID to both ScheduleRepeatingNotification(..) and CancelRepeatingNotification(..). As a matter of fact I mentioned it on the guide as an exercise :)
     
  24. dreamychris

    dreamychris

    Joined:
    Aug 28, 2012
    Posts:
    7
    Right. I meant there's no equivalent for non-repeating notifications. :) Of course I could tweak the library to add one, but I bought the package because I didn't want to have to mess around with native code.

    I've worked around the lack of a cancel function for non-repeating notifications by using a repeating notification instead, so my needs are satisfied for now. It just seems to me that for a package sold as having "equivalent" functionality to NotificationServices, it's very close but not quite there yet. Call it a feature request. :)
     
  25. dreamychris

    dreamychris

    Joined:
    Aug 28, 2012
    Posts:
    7
    Small correction: The #if mentioned previously should read #if UNITY_ANDROID !UNITY_EDITOR in order to avoid runtime errors in the editor, when the editor has its platform set to Android. :)
     
  26. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    Thanks dreamychris!

    All noted ;P
     
  27. dreamychris

    dreamychris

    Joined:
    Aug 28, 2012
    Posts:
    7
    Heh. Thanks Carlos :D
     
  28. sugi

    sugi

    Joined:
    Mar 12, 2013
    Posts:
    6
    Thank you for your response!
    I could use push notification.

    I have other question.
    How can I implement the function that go back the application,
    when user tap the notification.
     
  29. dreamychris

    dreamychris

    Joined:
    Aug 28, 2012
    Posts:
    7
    Android seems to do that automatically. Tapping the notification task-switches to the app, or launches it if it's not running.
     
  30. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    Yes, sort of ;P

    The code that is called when a notification is tapped will redirect you to your game -although this isn't automatic, it seems to be a fairly common practice, so the plugin does it by default.
     
  31. sugi

    sugi

    Joined:
    Mar 12, 2013
    Posts:
    6
    It seems not work well, when a notification was tapped.
    Could you tell me what's the matter of this?
     
  32. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    @sugi: it should take you to your app, once you tap on it. Do you mind sending me a logcat and a description of what happens when you tap on the notification? Also, if you can, let me know what model of device you are testing it on.

    It probably is easier if you send it to my email, rather than doing it here. My address is: carlos.fernandez.musoles (at) gmail.com

    Cheers.
     
  33. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    New 1.02 version available

    The new update has been approved and it's already on the Asset Store! It includes a feature request made by dreamychris: the ability to cancel any delayed notification! You can cancel all your notifications, or simply the one you don't want anymore.

    Check out the "Version Control" section of the guide for an overview of the changes.

    Cheers.
     
  34. jrrmteixeira

    jrrmteixeira

    Joined:
    Aug 27, 2013
    Posts:
    4
    EDIT: What I say in this post doesn't work, see my other post below

    Hi there,

    I was using this plugin but some notifications were showing up blank, I was able to fix it and decided to post my fix in case someone runs into a similar issue.

    The way I am managing local notifications is something like this, at the start of the app:

    1 - Clear all previous pending notifications (so that I don't end up with duplicate notifications)
    2 - Check the notifications I need and fire them

    What happened was that the notifications, when they appeared, had an empty title and text.

    I tried to isolate the issue and found out the notification IDs were being generated based on the length of the current pending notifications, leading to the same ID being potentially used twice. So, I made a small correction, I added a new field to the ELANManager class:

    private static int nextNotificationID = 0;

    And when generating the notification ID, I replaced:

    int nID = currentNotificationIDs.Count + 1;

    With:
    int nID = nextNotificationID++;

    I did not inspect the java code closely to verify that this was the root cause, but it seems to have solved the problem :)
     
    Last edited: Aug 28, 2013
  35. jrrmteixeira

    jrrmteixeira

    Joined:
    Aug 27, 2013
    Posts:
    4
    It seems the issue persists, notifications showing up blank. I guess I'll have to go deeper.
     
  36. jrrmteixeira

    jrrmteixeira

    Joined:
    Aug 27, 2013
    Posts:
    4
    Ok, so I think the problem has to do exactly with the same IDs being used for notifications (my previous solution actually makes this worse:roll:).

    Maybe this could be solved by changing the way the notifications are handled on the java-side of the code (change FLAG_ONE_SHOT to FLAG_UPDATE_CURRENT or something). But since I'm time limited I did not test this theory.

    Instead, I implemented a work around, basically I now generate IDs based on the current time, which should be fine for most cases, so, in ELANManager.cs, in line 23 (or around there):

    int nID = (int)System.DateTime.Now.Ticks;
     
  37. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    @jrrmteixeira: thanks for that! I will investigate that issue and will issue a fix as soon as possible.
     
  38. jrrmteixeira

    jrrmteixeira

    Joined:
    Aug 27, 2013
    Posts:
    4
    @CarlosFM You're welcome!

    In the meantime, I have been trying to find out why the application isn't launched when I tap the notification. Do you have any idea what may be causing this? Maybe because other plugin I'm using is replacing the main activity and the lookup is made by name? Do you have any ideas to work around this?

    Thanks again :)
     
  39. CarlosFM

    CarlosFM

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

    I've fixed the issue and will be submitting the update later on today. There seems to be some kind of problem with the way I was storing notification IDs from different sessions and as a consequence when you cancelAllNotifications with previously delivered notifications, it will mess something up and the next notification will be blank. I am unsure why this happen and what I have done is change the behaviour of the CancelAllNotifications() function: now it will only cancel notifications set on the current session (plus all repeating notifications). If you want to remove delayed notifications set on previous sessions you will have to track their notification ID yourself and call CancelNotification(ID).

    As per the app not being launched, that is a problem, but I can't tell you why without more information. The plugin is supposed to open your app upon tapping the notification. If you could send me a logcat of the moment when you tap to my email address, I could give you pointers (carlos.fernandez.musoles AT gmail.com).

    Cheers.

    PS: If you need the update quickly I can send it to you to your email -just send me a note with your invoice number :)
     
  40. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    New version available: ELAN 1.03 now on the Asset Store.

    Please read the Guide for a detailed description of the changes (and see my comment above).
     
  41. zeloswilder

    zeloswilder

    Joined:
    Nov 9, 2012
    Posts:
    2
    Hi, the plugins is quite easy to use, but i have a problem. I try to start many notification with different delay, but it looks like every time a new notification is set, the last one is canceled.

    ELANManager.SendNotification("TEST_1", "TEST_1", 60); // Notification #1
    ELANManager.SendNotification("TEST_2", "TEST_2", 120); // Notification #2 will cancel Notification #1

    Also, not only it clear the last notification, but it will use his delay (in this case, notification #2 delay will be 60 instead of 120) ?
    Same problem with ScheduleRepeatingNotification, but if I use SendNotification AND ScheduleRepeatingNotification with different delay, one SendNotification (the last one) will be send and one ScheduleRepeatingNotification.
     
  42. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    That's definitely not the intended behaviour. Let me take a look and will get back to you.
     
  43. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    OK, this error only happens when you try to set two delayed notifications on the same frame (at the same time). This is a consequence of the way I was assigning IDs to notifications.

    If you would like to set two delayed notifications simultaneously, then I suggest you change line 23 on ELANManager.cs to:

    Code (csharp):
    1. int nID = (int)(Time.time*1000) + (int)Random.Range (0,int.MaxValue/2);
    It isn't the prettiest thing, but it'll do the trick
     
  44. zeloswilder

    zeloswilder

    Joined:
    Nov 9, 2012
    Posts:
    2
    Exactly, i was calling them all in the same frame, it works now! Thank you :)
     
  45. td0239

    td0239

    Joined:
    Oct 2, 2013
    Posts:
    3
    Hi,

    I'm using the plugin, and I found that if I schedule notifications for quite far ahead, e.g around 1 months time, the notifications all fire instantly. Is there a limit to the number of seconds you can pass here? This is a non-repeating, regular notification. I am trying a delay of e.g. 2342400 seconds.

    Thanks
    Tom
     
  46. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    @td0239: Wow, way to miss that!

    As you have experienced, there was a limit to the number you could input as delay and repeat times. Sadly, the limit was 1000 times smaller than I thought it was! I've fixed the plugin to work with 'long' types instead of 'int', which would give us a ceiling of 19 digit numbers. But because internally the numbers you input are converted to milliseconds, your max time is now 9223372036854774, which is roughly about 300k years -surely your app cannot be live that long! :)

    I've pushed an update on the Asset Store. If you are in a hurry about it, send me your proof of purchase (invoice number) and I'll send the new package.

    carlos.fernandez.musoles (at) gmail.com
     
  47. CarlosFM

    CarlosFM

    Joined:
    Jun 8, 2013
    Posts:
    240
    New version 1.04 available

    Hi guys,

    The new update to the package has been approved and is ready on the Asset Store. It solves the two issues mentioned above:
    - Avoid clash of notifications when they are created within the same frame (at the same time)
    - 'delay' and 'repeat' values are now long type, which allows for longer times to be set.

    Cheers
     
  48. xsodus

    xsodus

    Joined:
    Jun 5, 2012
    Posts:
    14
    I found problem while I testing ELAN below these steps..
    1.I send a message with delay 5 seconds.
    2.The notify message was appear.
    3.My app has been crashed (with message "Unfortunately, xxxxx has stoped")
    when I touch on a notify message.

    My app contains many activities such as my activity , prime31 plugins.
    Please tell me how to fix it. Thank you.

    [Android Log]
    /KeyguardViewMediator( 347): verifyUnlock
    W/KeyguardViewMediator( 347): verifyUnlock called when not externally disabled
    D/dalvikvm(15936): Trying to load lib /data/data/com.gamemaker.kreatorian/lib/li
    bmono.so 0x42295fc0
    D/dalvikvm(15936): Shared lib '/data/data/com.gamemaker.kreatorian/lib/libmono.s
    o' already loaded in same CL 0x42295fc0
    D/dalvikvm(15936): Trying to load lib /data/data/com.gamemaker.kreatorian/lib/li
    bunity.so 0x42295fc0
    D/dalvikvm(15936): Shared lib '/data/data/com.gamemaker.kreatorian/lib/libunity.
    so' already loaded in same CL 0x42295fc0
    D/AndroidRuntime(15936): Shutting down VM
    W/dalvikvm(15936): threadid=1: thread exiting with uncaught exception (group=0x4
    19e22a0)
    E/AndroidRuntime(15936): FATAL EXCEPTION: main
    E/AndroidRuntime(15936): java.lang.Error: FATAL EXCEPTION [main]
    E/AndroidRuntime(15936): Unity version : 4.1.5f1
    E/AndroidRuntime(15936): Device model : LGE LG-P768
    E/AndroidRuntime(15936): Device fingerprint: lge/u2_open_tha/u2:4.1.2/JZO54K/P76
    8f20c.4DEB3D0B:user/release-keys
    E/AndroidRuntime(15936):
    E/AndroidRuntime(15936): Caused by: java.lang.RuntimeException: Unable to start
    activity ComponentInfo{com.gamemaker.kreatorian/com.unity3d.player.UnityPlayerAc
    tivity}: java.lang.NullPointerException
    E/AndroidRuntime(15936): at android.app.ActivityThread.performLaunchActiv
    ity(ActivityThread.java:2070)
    E/AndroidRuntime(15936): at android.app.ActivityThread.handleLaunchActivi
    ty(ActivityThread.java:2095)
    E/AndroidRuntime(15936): at android.app.ActivityThread.access$600(Activit
    yThread.java:135)
    E/AndroidRuntime(15936): at android.app.ActivityThread$H.handleMessage(Ac
    tivityThread.java:1201)
    E/AndroidRuntime(15936): at android.os.Handler.dispatchMessage(Handler.ja
    va:99)
    E/AndroidRuntime(15936): at android.os.Looper.loop(Looper.java:137)
    E/AndroidRuntime(15936): at android.app.ActivityThread.main(ActivityThrea
    d.java:4849)
    E/AndroidRuntime(15936): at java.lang.reflect.Method.invokeNative(Native
    Method)
    E/AndroidRuntime(15936): at java.lang.reflect.Method.invoke(Method.java:5
    11)
    E/AndroidRuntime(15936): at com.android.internal.os.ZygoteInit$MethodAndA
    rgsCaller.run(ZygoteInit.java:795)
    E/AndroidRuntime(15936): at com.android.internal.os.ZygoteInit.main(Zygot
    eInit.java:562)
    E/AndroidRuntime(15936): at dalvik.system.NativeStart.main(Native Method)

    E/AndroidRuntime(15936): Caused by: java.lang.NullPointerException
    E/AndroidRuntime(15936): at com.unity3d.player.g.a(Unknown Source)
    E/AndroidRuntime(15936): at com.unity3d.player.g.b(Unknown Source)
    E/AndroidRuntime(15936): at com.unity3d.player.UnityPlayer.resume(Unknown
    Source)
    E/AndroidRuntime(15936): at com.unity3d.player.UnityPlayer.a(Unknown Sour
    ce)
    E/AndroidRuntime(15936): at com.unity3d.player.UnityPlayer.init(Unknown S
    ource)
    E/AndroidRuntime(15936): at com.unity3d.player.UnityPlayerActivity.onCrea
    te(Unknown Source)
    E/AndroidRuntime(15936): at android.app.Activity.performCreate(Activity.j
    ava:5236)
    E/AndroidRuntime(15936): at android.app.Instrumentation.callActivityOnCre
    ate(Instrumentation.java:1082)
    E/AndroidRuntime(15936): at android.app.ActivityThread.performLaunchActiv
    ity(ActivityThread.java:2034)
    E/AndroidRuntime(15936): ... 11 more
    W/ActivityManager( 347): Force finishing activity com.gamemaker.kreatorian/co
    m.unity3d.player.UnityPlayerActivity

    [ActivitiesManifest.xml]
    <?xml version="1.0" encoding="utf-8"?>
    <manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.unity3d.player"
    android:installLocation="preferExternal"
    android:theme="@android:style/Theme.NoTitleBar"
    android:versionCode="1"
    android:versionName="1.0">
    <supports-screens
    android:smallScreens="true"
    android:normalScreens="true"
    android:largeScreens="true"
    android:xlargeScreens="true"
    android:anyDensity="true"/>

    <application
    android:icon="@drawable/app_icon"
    android:label="@string/app_name"
    android:debuggable="true">
    <activity android:name="com.unity3d.player.UnityPlayerProxyActivity"
    android:launchMode="singleTask"
    android:label="@string/app_name"
    android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    </activity>
    <activity android:name="com.unity3d.player.UnityPlayerActivity"
    android:launchMode="singleTask"
    android:label="@string/app_name"
    android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    </activity>
    <activity android:name="com.unity3d.player.UnityPlayerNativeActivity"
    android:launchMode="singleTask"
    android:label="@string/app_name"
    android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    <meta-data android:name="android.app.lib_name" android:value="unity" />
    <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
    </activity>

    <activity android:name="com.unity.easy2pay.Easy2payProxyActivity"
    android:label="@string/app_name"
    >
    </activity>
    <activity android:name="com.android.easy2pay.Easy2PayScreen" android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
    <activity android:name="com.facebook.LoginActivity"></activity>
    <activity android:name="com.prime31.FacebookProxyActivity"></activity>
    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="\ 224184054400235"/>

    <!-- ELAN java -->
    <service android:enabled="true" android:name="com.CFM.ELAN.ELANAlarmCreator" />
    <receiver android:name="com.CFM.ELAN.TimedAlarm" />
    <!-- end -->
    </application>

    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="android.permission.SEND_SMS"/>
    <uses-permission android:name="android.permission.VIBRATE" />

    </manifest>
     
    Last edited: Oct 9, 2013
  49. xsodus

    xsodus

    Joined:
    Jun 5, 2012
    Posts:
    14
    I test with empty project. but i found the same problem too.

    W/dalvikvm(16384): threadid=1: thread exiting with uncaught exception (group=0x4
    19e22a0)
    E/AndroidRuntime(16384): FATAL EXCEPTION: main
    E/AndroidRuntime(16384): java.lang.Error: FATAL EXCEPTION [main]
    E/AndroidRuntime(16384): Unity version : 4.1.5f1
    E/AndroidRuntime(16384): Device model : LGE LG-P768
    E/AndroidRuntime(16384): Device fingerprint: lge/u2_open_tha/u2:4.1.2/JZO54K/P76
    8f20c.4DEB3D0B:user/release-keys
    E/AndroidRuntime(16384):
    E/AndroidRuntime(16384): Caused by: java.lang.RuntimeException: Unable to start
    activity ComponentInfo{com.Company.ProductName/com.unity3d.player.UnityPlayerAct
    ivity}: java.lang.NullPointerException
    E/AndroidRuntime(16384): at android.app.ActivityThread.performLaunchActiv
    ity(ActivityThread.java:2070)
    E/AndroidRuntime(16384): at android.app.ActivityThread.handleLaunchActivi
    ty(ActivityThread.java:2095)
    E/AndroidRuntime(16384): at android.app.ActivityThread.access$600(Activit
    yThread.java:135)
    E/AndroidRuntime(16384): at android.app.ActivityThread$H.handleMessage(Ac
    tivityThread.java:1201)
    E/AndroidRuntime(16384): at android.os.Handler.dispatchMessage(Handler.ja
    va:99)
    E/AndroidRuntime(16384): at android.os.Looper.loop(Looper.java:137)
    E/AndroidRuntime(16384): at android.app.ActivityThread.main(ActivityThrea
    d.java:4849)
    E/AndroidRuntime(16384): at java.lang.reflect.Method.invokeNative(Native
    Method)
    E/AndroidRuntime(16384): at java.lang.reflect.Method.invoke(Method.java:5
    11)
    E/AndroidRuntime(16384): at com.android.internal.os.ZygoteInit$MethodAndA
    rgsCaller.run(ZygoteInit.java:795)
    E/AndroidRuntime(16384): at com.android.internal.os.ZygoteInit.main(Zygot
    eInit.java:562)
    E/AndroidRuntime(16384): at dalvik.system.NativeStart.main(Native Method)

    E/AndroidRuntime(16384): Caused by: java.lang.NullPointerException
    E/AndroidRuntime(16384): at com.unity3d.player.g.a(Unknown Source)
    E/AndroidRuntime(16384): at com.unity3d.player.g.b(Unknown Source)
    E/AndroidRuntime(16384): at com.unity3d.player.UnityPlayer.resume(Unknown
    Source)
    E/AndroidRuntime(16384): at com.unity3d.player.UnityPlayer.a(Unknown Sour
    ce)
    E/AndroidRuntime(16384): at com.unity3d.player.UnityPlayer.init(Unknown S
    ource)
    E/AndroidRuntime(16384): at com.unity3d.player.UnityPlayerActivity.onCrea
    te(Unknown Source)
    E/AndroidRuntime(16384): at android.app.Activity.performCreate(Activity.j
    ava:5236)
    E/AndroidRuntime(16384): at android.app.Instrumentation.callActivityOnCre
    ate(Instrumentation.java:1082)
    E/AndroidRuntime(16384): at android.app.ActivityThread.performLaunchActiv
    ity(ActivityThread.java:2034)
    E/AndroidRuntime(16384): ... 11 more
    W/ActivityManager( 347): Force finishing activity com.Company.ProductName/com
    .unity3d.player.UnityPlayerActivity
     
  50. CarlosFM

    CarlosFM

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

    Let's see, from the error I can see the Intent associated with tapping the notification is trying to open the UnityPlayerActivity (main unity activity) on package "com.gamemaker.kreatorian", but it cannot find it. Now from the manifest, I see that your package name is "com.unity3d.player", which is an odd pick, but it definitely isn't the one java is complaining about.

    Could I ask whether your bundle ID (in Unity Android Player Settings, under Other Settings) is com.gamemaker.kreatorian or com.unity3d.player? Those two fields (bundle ID AND package name within the manifest) should match.

    EDIT: Yeah, from the second message I can gather exactly the same information (you are not setting bundle ID, as it reads com.Company.ProductName). Make that field and the package name in the manifesto match.
     
    Last edited: Oct 9, 2013