Firemonkey TNotificationCenter did not work C++Builder 10.4

  

I am new to Firemonkey. I am using C++Builder 10.4 Sydney. The target platform is Android.
My code is:

unsigned short y, m, d, h, n, s, ms;
StrToDate(date).DecodeDate(&y, &m, &d); // might be: 2020, 7, 9
StrToTime(time).DecodeTime(&h, &n, &s, &ms); // might be: 13, 01, 00, 000

TNotification *myNotification=NotificationCenter1->CreateNotification();
try{
myNotification->Number=1;
myNotification->AlertBody="something";
myNotification->EnableSound = true;
myNotification->Title = "alert";
myNotification->AlertAction = "GO";
myNotification->SoundName = my_soundname;
myNotification->FireDate = System::Dateutils::EncodeDateTime(y, m, d, h, n, s, ms);

myNotification->RepeatInterval=TRepeatInterval::Minute;
NotificationCenter1->ScheduleNotification(myNotification);

} __finally {
myNotification->DisposeOf();
}

When time is up, nothing happens.
I tried adding Android Service to my project, but no dialog pops up (did 10.4 fixed dialog or is this a bug?).
And I added the Android Service manually with linker libandroidService.a and System.Android.service.hpp, and put this code in the Form’s OnCreate event:
TLocalServiceConnection::StartService("MyProject");

But still, nothing happens.
I tried PresentNotification(), just notified right now.
Can anyone help me with this problem?

Comments are closed.