Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Crash when using notification addon with Android — Gideros Forum

Crash when using notification addon with Android

ChrisFChrisF Member
edited December 2015 in Bugs and issues
Hopefully this is something stupid.
I am just making my own player and putting in add-ons.
I have got the Notification add-on in place, and if I do a dispatchNow event something appears straight away so I guess it working (not tried the rest) however I get a crash on relaunch.

If I launch the player, exit and re-enter it is all fine.
If I launch the player, choose my project and launch - it starts ok.
I then exit and re-enter the app and it crashes in the onResume before my project reappears again - logs below.
My Lua code for notifications is only run in main so does not even get touched on the resume.
The crash happens regardless of if I trigger a notification in my project or not.

----
Here is a link to the stack trace :
http://pastebin.com/raw/T8ES37m2

Comments

  • ChrisFChrisF Member
    edited December 2015
    So just tried to track down the bundle, so in the onResume in NotificationClass (which surely should have no bundle!) , I added
    for (String key : bundle.keySet())
    {
        Log.d("Bundle Debug", key + " = \"" + bundle.get(key) + "\"");
    }
    ]

    Output is :
    Bundle Debug: profile = "0"

    Still none the wiser, but got more info :D
  • Went through it all again from clean build triple checking permissions etc, still have the same issue - no clue as to what is wrong so any advice appreciated.
  • Hello,
    what Android version do you use?
    Basically the problem is that one of the notification value is null, and this notification is queued internally, and it should be removed once it is processed, but it is never processed because it crashes due to null value.

    I don't remember old behavior, but if you are using new Android version, then it could mean that new Android version does not allow null values anymore, and thus the problem, or you somehow got the null value the way I did not anticipate when creating the plugin :)
  • ChrisFChrisF Member
    edited December 2015
    My two test devices are 14 and 16,just tried it and crashes are gone and thanks for explanation.

    Will continue my notification quest tomorrow :-)
    I have made some updates to the handler for newer android builds (it wont build against the latest) will share when I am sure everything works. Weird thing I have to debug now is dispatchafter not firing if I am in the app or exit it, yet if I crash the lua (I found this out accidentally!!!) The notification then appears on schedule, very weird.
  • @ChrisF as I remember for Android there was a specific case, if app is opened, it won't issue a notification, but I think rather fire Gideros event with notification data.
  • Thanks, I *think* they working now, and your correct dispatchafter fires an event in the app if your in it (unlike dispatchnow that makes something appear regardless).
  • So it's all working now, as I am compiling in Android Studio using compileSdkVersion of 23 (with a min of 16 and target of 19) the notification class did not compile.
    Here is a pastebin with the modified GNotification : http://pastebin.com/H4bZQ1vn
  • it would be much more valuable to see the error, what you had, why it did not compile
  • Just realised I had pasted the wrong one , the work in progress ...
    Anyway here is the working one :
    http://pastebin.com/HAu8nf1G

    The error is basically that setLatestEventInfo(....) has been removed from the latest version so I just grabbed some existing Notification code I had from a native Android app and spliced it in (see latest pastebin) - it works great and uses the compatibility library now.
Sign In or Register to comment.