After my failed with non-consumable purchases “bug” that was not a bug =) I afraid to set a bug status to new posts =)
And now it just a question.
How push.get_all_scheduled() should woks?
I have next behavior:
- open an app;
- register new notification;
- check registered notifications using push.get_all_scheduled() – it’s just 1 that we registered;
- close an app (fully close);
- open an app;
- check registered notifications using push.get_all_scheduled() – 0 notification, but my notification from point 2 will alert in time.
That mean that I have no possibility to remove old notification after app was restarted.
Is it by design or a bug? (I tested it only on android)
My testing script:
local console = require("defcon.console")
local standart_prefix = '{"data" : {"type" : "'
local standart_postfix = '"}}'
local test =
{
time = 60,
title = "Test",
alert = "test?",
payload = standart_prefix.."test"..standart_postfix
}
local function push_listener(self, payload, origin, activated)
end
function init(self)
push.set_listener(push_listener)
console.register_command("nlist", "notifications list", function(args, stream)
local all_n = push.get_all_scheduled()
local str = "List:\n"
for i, v in pairs(all_n) do
local jstype = json.decode(v.payload)
str = str..i.." = "..jstype.data.type.." seconds = "..v.seconds.."\n"
end
return str
end)
console.register_command("nadd", "register one", function(args, stream)
push.schedule(test.time, test.title, test.alert, test.payload, {})
return "done"
end)
end