语言

MockContext.StartForegroundService(Intent) 方法

定义

引发 UnsupportedOperationException。 重写此方法以在测试中启动前台服务。

[Android.Runtime.Register("startForegroundService", "(Landroid/content/Intent;)Landroid/content/ComponentName;", "GetStartForegroundService_Landroid_content_Intent_Handler", ApiSince=26)]
public override Android.Content.ComponentName? StartForegroundService(Android.Content.Intent? service);
[<Android.Runtime.Register("startForegroundService", "(Landroid/content/Intent;)Landroid/content/ComponentName;", "GetStartForegroundService_Landroid_content_Intent_Handler", ApiSince=26)>]
override this.StartForegroundService : Android.Content.Intent -> Android.Content.ComponentName

参数

service
Intent

标识服务的意向。 可用于测试重写;默认的模拟实现不使用此参数。

返回

不返回任何值。 默认模拟实现引发 UnsupportedOperationException;重写此方法以提供测试结果。

特性

注解

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于