Hi there,
Im using local notifications as a sort of alarm in my app. So that I can cancel the scheduled notifications in different sessions, I would like to store the notification ID in a file. I tried using json to convert the table to string but I get the following error:
“type ‘userdata’ is not supported by JSON”.
Has anyone encountered the same problem? Is there a way to save the NotificationID so I can use it later on in different sessions??
I’m using corona build: 2013.2100, and the code to replicate the error is the one bellow:
local futureTime = os.date( "!\*t", os.time() + 10000 ) local options = { alert = "this is the alert message", custom = {abc="custom content"}, } local notificationID = system.scheduleNotification( futureTime, options ) local json = require("json") local result,text = pcall( json.encode, notificationID) display.newText({ text=tostring(result) .. "\n" .. text, x=display.contentCenterX, y=display.contentCenterY, fontSize=30, width=display.contentWidth \* 0.8 })