首页 > 解决方案 > 如何每天像(1PM,2Pm,3Pm,4Pm,5Pm)每天5次调用AVplayer?

问题描述

我想每天在 xamarin.ios 中播放 AVplayer 5 次,例如(1PM、2Pm、3Pm、4Pm、5Pm)。我在通知期间尝试了 5 次。但是通知方法不能播放avplayer ...请帮助我如何在给定时间播放avplayer 5次?

标签: c#xamarin.ios

解决方案


你能告诉我当手机被锁定时,在本地通知期间会触发哪种方法

当您的应用程序终止时,您可以尝试:

public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
    // Override point for customization after application launch.
    // If not required for your application you can safely delete this method

    UILocalNotification localNotif = launchOptions.ObjectForKey(UIApplication.LaunchOptionsLocalNotificationKey) as UILocalNotification;

    if (localNotif != null)
    {
        //check if it is your local notification
        //localNotif.UserInfo;
        //Try add your method here
    }

    return true;
}

如果您的应用在后台,您可以尝试在此处添加方法:

public override void ReceivedLocalNotification(UIApplication application, UILocalNotification notification)
{
    base.ReceivedLocalNotification(application, notification);
    //Add your method here
}

推荐阅读