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
Hmm, not sure. Local notification support was implemented by @sven. I’ll give Sven a chance to answer (if he knows the answer ) before I spend some time investigating.
Short answer is that there is a discrepancy between the iOS and Android implementations in this regard, on Android it’s not currently possible to list scheduled notifications from a previous run.
If I remember correctly, there is no reliable (or at least wasn’t at the time of implementation) way to list notification alarms we set on Android, in Java. I’ll add an issue for this so we can give this another look, it might be possible for us to serialise this information between runs.
(Some more in-depth info; Internally the notifications information are kept on the C++ side, but the are never serialised and are simply lost between restarts. While on iOS we don’t need to keep track of this ourselves, we can ask the OS to just give us a list of pending notifications.)
Sadly no, the notification list (C++ side) is lost between runs, so trying to cancel a notification with a certain ID that isn’t in the list will result in an error. I think we need to fix this in engine if possible.
This is not something we have planned to fix short term I’m afraid. During the coming two weeks we’re going to work on our roadmap and backlog for the coming months. I will be giving everyone a chance to suggest your top prio missing features or bugs so that we can incorporate them in our plans. A separate post will be made regarding this, most likely next week.