Update: Problem resolved.
I’m not sure exactly which change fixed the issue but combining two functions (packData() and saveData()) into a single function and dropping the local declaration for both function saveData() and function onSystemEvent (event), the applicationExit routine started saving the game file.
Thanks for the help!
#
Sadly, the Admob code doesn’t seem to like a call to save data near a URL request:
I tried this:
[lua]local function showAd(event)
– Is the url a remote call?
if string.find(event.url, “http://”, 1, false) == 1 then
– Is it a call to the admob server?
if string.find(event.url, “c.admob.com”, 1, false) == nil then
adSpace.url = event.url
else
– an actual click on an ad, so open in Safari
saveData() – this is the only altered line from the standard Admob code
system.openURL(event.url)
end
else
adSpace.url = event.url
end
end[/lua]
and the Safari no longer launched. Instead, the window opened as a banner on the bottom of the screen. No data was saved.
Moving the saveData() function around didn’t help either. Putting it at the bottom restored the Safari launch but still no data was saved.
saveData() works fine for me when triggered by a button. [import]uid: 1560 topic_id: 2604 reply_id: 7491[/import]