Daily Builds Update (626-631)

Share on Facebook0Share on Google+1Tweet about this on TwitterShare on LinkedIn0

Corona Daily Builds October 4, 2011

Last week, I covered Local Notifications, which is an awesome new feature that recently came through the Corona Daily Builds (available to subscribers only).

Today, I’m going to show you how to handle notifications when your app is not currently in the foreground (a question that came up in the comments section of last week’s post), as well as give you a quick update on all the other things that recently got pushed in.


The local variable, launchArgs, will hold any data that is passed to your app when it is not in the foreground (such as notification event data). IMPORTANT: The line below must be placed in main.lua and it MUST be the first line of code or it will not work:

local launchArgs = ...

Then, elsewhere in your app (somewhere after your notification listener function), you check to see if any launchArgs were detected, and if so, you simply invoke your notification listener manually.

Here’s an example:

Line 1 is where you declare the launchArgs variable.

Lines 3-8 is your notification listener that will tell your app what to do in the event a notification occurs.

Line 11 is where you tell your app to start listening for notification events.

Finally, lines 13-16 is where you check if any notification data is in launchArgs, and if so, you manually invoke your notification listener (lines 3-8) and pass launchArgs.notification as the first argument (notification event data).

IMPORTANT: In order for any of this to work, you need to set UIApplicationExitsOnSuspend to false in your build.settings file. See the example below:

iphone = {
plist = {
UIApplicationExitsOnSuspend = false

So to re-cap, what I just showed you is how to detect notifications when your app is NOT in the foreground, meaning, the user is not currently in your app. For a more general Local Notifications how-to, see last week’s post.

More Daily Build Updates

Additionally, Corona Subscribers will be glad to hear that there’s been tons of bug fixes to come through the Corona Daily Builds since I announced the availability of Local Notifications in Build 625 last week.

Here’s a quick rundown of all that’s been fixed in just the last few builds (626-631):


  • Fixed issue where a web popup would prevent the back key from exiting the app.
  • Fixed bug where network.download() would crash if file was larger than 24 MB. Also fixed issue where network.request() and network.download() was blocking the UI thread (casenums: 8353, 8413).
  • Fixed bug where search button would close the activity indicator (casenum: 8410).
  • Fixed random crash caused by exiting out of an app that listens to heading/compass data (casenum: 8432).
  • Fixed bug where accelerometer, gyroscope, and heading/compass would yield wrong values on landscape tablets (casenum: 8260).
  • Fixed bug where opening/closing the physics keyboard would restart the app if it had a fixed orientation (casenum: 8445).
  • Fixed crash that sometimes occurred if the app was exited while a web popup was loading a new page (casenum: 8473).
  • Fixed out-of-memory crash caused by loading too many images (casenum: 1298).
  • Got rid of the harmless “can’t open” log messages caused by loading asset files.


  • Updated InMobi SDK to Build 3.0.2 which fixes several issues, including ones related to app crashes and geo-data permissions popups (casenum: 8439).
  • Fixed several important OpenAL audio-related bugs affecting iOS 5 (just in time!), as well as other OpenAL bugs (casenums: 8401, 8186, 8247—see the Daily Build release notes for full descriptions).


  • Physics: Fixed bug where “length”, “frequency”, and “dampingRatio” properties were not getting properly set (casenum: 8291).

Can you believe all those changes are from only six builds?!

It just goes to show how much work our engineering team does on a daily basis, and also highlights a HUGE benefit to becoming a Corona subscriber: you get to download all these bug fixes (as well as new features!) as soon as they’re pushed in!

Stay tuned for more updates, and in the meantime, become a subscriber today.

Share on Facebook0Share on Google+1Tweet about this on TwitterShare on LinkedIn0

This entry has 7 replies

  1. Matthew says:

    Any ETA on Android In-App Purchases? The second that daily build goes live is the second I purchase my subscription! ๐Ÿ™‚

  2. What Matthew said +1 I would love In-App Purchases. Top Priority for sure!

  3. Sunny says:

    Thanks jonathan, we can’t wait for remote/server based notifications !! ๐Ÿ˜‰

  4. Dhennrich says:

    And another thing
    this code does not work in ipad 2

  5. James says:

    Has anyone actually got this to work?

    I have tried exactly the code listed above without success and then tried the simplest form I could think of:

    local launchArgs = ...

    if launchArgs and launchArgs.notification then

    native.showAlert("Time to play", "Play", {"OKey"})
    local text = display.newText("Processing notification......", 0, display.contentHeight, system.nativeFont, 20)
    text:setTextColor(255, 0, 255)
    text.x = display.contentWidth / 2
    text.y = display.contentHeight / 2


    system.scheduleNotification(15, { alert = "This is the alert text", badge = 1, sound = "alarm.caf" })
    local text = display.newText("Notification set.....", 0, display.contentHeight, system.nativeFont, 20)
    text:setTextColor(255, 0, 255)
    text.x = display.contentWidth / 2
    text.y = display.contentHeight / 2

    The notification itself works, when the app is either exited or in the background the alert will go off, however when I tap the alert, if the app is suspended (as in most cases) it is simply brought into the foreground but doesn’t go through the “launchArgs…” bit and so only displays where it left off, i.e. “Notification set…..”. If the app is exited, as would be the case if the phone was rebooted or you manually shut down the app, it starts up and shows the splash page, then exits immediately – no alert and no text saying “Processing notification………”

    Hopefully it’s just me but currently it seems like this function doesn’t work at all.

    What am I missing?

  6. James says:

    Problem solved, it seems this was broken in build 2011.703 for iOS 5.1 at least.
    Not sure exactly which build it was fixed in but I have upgraded to the latest daily build and it now works.

  7. Vik says:

    I am unclear as to what this is supposed to do? I followed your other post (the Local Notifications) and I don’t see any difference when I put in on an Ipad…

    functionality works the same..

    even when the application is in the background, I still get notification and they still run the same way…

    what is the scenario I am missing?
    am I missing something?