0
我正在使用Xamarin.Fomrs PLC项目,我试图显示通知即使应用程序已关闭,现在它正在正常工作,因为应用程序正在运行,因为我穿上OnStart()
通知线程,我应该怎么做才能让如果应用程序被关闭Xamarin.Forms如何显示通知即使应用程序已关闭
在下面的代码简要更清楚地通知甚至工作:
namespace X
{
public class App : Application
{
INotificationService service;
}
void CheckNotifications()
{
service = DependencyService.Get<INotificationService>();
service.Notify (message);
System.Threading.Thread.Sleep (1000 * 60);
}
protected override void OnStart()
{
var threadStart = new System.Threading.ThreadStart (CheckNotifications);
var thread = new System.Threading.Thread (threadStart);
thread.IsBackground = true;
thread.Start();
}
}