当前位置: 首页>>代码示例>>C#>>正文


C# Intent.GetIntArrayExtra方法代码示例

本文整理汇总了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;
        }
开发者ID:pascalfr,项目名称:MPfm,代码行数:25,代码来源:WidgetService.cs

示例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;
        }
开发者ID:pascalfr,项目名称:MPfm,代码行数:37,代码来源:NotificationService.cs


注:本文中的Android.Content.Intent.GetIntArrayExtra方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。