本文整理汇总了C#中Android.Content.Intent.GetIntArrayExtra方法的典型用法代码示例。如果您正苦于以下问题:C# Intent.GetIntArrayExtra方法的具体用法?C# Intent.GetIntArrayExtra怎么用?C# Intent.GetIntArrayExtra使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Content.Intent
的用法示例。
在下文中一共展示了Intent.GetIntArrayExtra方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnStartCommand
public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
{
Console.WriteLine("WidgetService - OnStartCommand - startId: {0} intent.action: {1}", startId, intent.Action);
_widgetIds = intent.GetIntArrayExtra(AppWidgetManager.ExtraAppwidgetIds);
if (intent.Action == SessionsWidgetActions.SessionsWidgetPrevious.ToString())
{
_messengerHub.PublishAsync<PlayerCommandMessage>(new PlayerCommandMessage(this, PlayerCommandMessageType.Previous));
}
else if (intent.Action == SessionsWidgetActions.SessionsWidgetPlayPause.ToString())
{
_messengerHub.PublishAsync<PlayerCommandMessage>(new PlayerCommandMessage(this, PlayerCommandMessageType.PlayPause));
}
else if (intent.Action == SessionsWidgetActions.SessionsWidgetNext.ToString())
{
_messengerHub.PublishAsync<PlayerCommandMessage>(new PlayerCommandMessage(this, PlayerCommandMessageType.Next));
}
else if (intent.Action == "android.appwidget.action.APPWIDGET_UPDATE")
{
Console.WriteLine("WidgetService - Updating notification because of APPWIDGET_UPDATE...");
UpdateWidgetView();
}
return StartCommandResult.NotSticky;
}
示例2: OnStartCommand
public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
{
Console.WriteLine("NotificationService - OnStartCommand - startId: {0} intent.action: {1}", startId, intent.Action);
_widgetIds = intent.GetIntArrayExtra(AppWidgetManager.ExtraAppwidgetIds);
if (intent.Action == SessionsWidgetActions.SessionsWidgetPrevious.ToString())
{
_messengerHub.PublishAsync<PlayerCommandMessage>(new PlayerCommandMessage(this, PlayerCommandMessageType.Previous));
}
else if (intent.Action == SessionsWidgetActions.SessionsWidgetPlayPause.ToString())
{
_messengerHub.PublishAsync<PlayerCommandMessage>(new PlayerCommandMessage(this, PlayerCommandMessageType.PlayPause));
}
else if (intent.Action == SessionsWidgetActions.SessionsWidgetNext.ToString())
{
_messengerHub.PublishAsync<PlayerCommandMessage>(new PlayerCommandMessage(this, PlayerCommandMessageType.Next));
}
else if (intent.Action == SessionsWidgetActions.SessionsWidgetClose.ToString())
{
_isShutDowning = true;
Console.WriteLine("NotificationService - Closing the application...");
// Broadcast any component that the application is closing; do not add the lock screen activity until the application is 'restarted'
Console.WriteLine("NotificationService - Notifying ApplicationCloseMessage...");
_messengerHub.PublishAsync<ApplicationCloseMessage>(new ApplicationCloseMessage(this));
_messengerHub.PublishAsync<ActivateLockScreenMessage>(new ActivateLockScreenMessage(this, false));
// Stop playback and remove notification service from foreground
_playerService.Stop();
StopForeground(true); // maybe that is enough and the service doesn't have to be stopped?
var notificationManager = (NotificationManager)ApplicationContext.GetSystemService(NotificationService);
notificationManager.Cancel(1);
StopSelf();
}
return StartCommandResult.NotSticky;
}