Stay organized with collections
Save and categorize content based on your preferences.
ForegroundServiceTypeException
abstract class ForegroundServiceTypeException : ServiceStartNotAllowedException
Base exception thrown when an app tries to start a foreground Service
without a valid type.
Summary
Public constructors |
Constructor.
|
Public constructors
ForegroundServiceTypeException
ForegroundServiceTypeException(message: String)
Constructor.
Parameters |
message |
String: This value cannot be null . |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# ForegroundServiceTypeException\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nForegroundServiceTypeException\n==============================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/app/ForegroundServiceTypeException \"View this page in Java\") \n\n```\nabstract class ForegroundServiceTypeException : ServiceStartNotAllowedException\n```\n\n|---|---|---|---|---|---|-------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) |||||||\n| ↳ | [kotlin.Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html) ||||||\n| | ↳ | [java.lang.Exception](../../java/lang/Exception.html#) |||||\n| | | ↳ | [java.lang.RuntimeException](../../java/lang/RuntimeException.html#) ||||\n| | | | ↳ | [java.lang.IllegalStateException](../../java/lang/IllegalStateException.html#) |||\n| | | | | ↳ | [android.app.ServiceStartNotAllowedException](/reference/kotlin/android/app/ServiceStartNotAllowedException) ||\n| | | | | | ↳ | [android.app.ForegroundServiceTypeException](#) |\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [InvalidForegroundServiceTypeException](/reference/kotlin/android/app/InvalidForegroundServiceTypeException), [MissingForegroundServiceTypeException](/reference/kotlin/android/app/MissingForegroundServiceTypeException) |--------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------| | [InvalidForegroundServiceTypeException](/reference/kotlin/android/app/InvalidForegroundServiceTypeException) | Exception thrown when an app tries to start a foreground [Service](/reference/kotlin/android/app/Service) with an invalid type. | | [MissingForegroundServiceTypeException](/reference/kotlin/android/app/MissingForegroundServiceTypeException) | Exception thrown when an app tries to start a foreground [Service](/reference/kotlin/android/app/Service) without a type. | |\n\nBase exception thrown when an app tries to start a foreground [Service](/reference/kotlin/android/app/Service) without a valid type.\n\nSummary\n-------\n\n| Public constructors ||\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [ForegroundServiceTypeException](#ForegroundServiceTypeException(kotlin.String))`(`message:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Constructor. |\n\n| Inherited properties ||\n|---|---|\n| From class [ServiceStartNotAllowedException](/reference/kotlin/android/app/ServiceStartNotAllowedException) |-----------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------| | [Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)? | [cause](/reference/kotlin/android/app/ServiceStartNotAllowedException#cause:kotlin.Throwable) \u003cbr /\u003e | ||\n\nPublic constructors\n-------------------\n\n### ForegroundServiceTypeException\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nForegroundServiceTypeException(message: String)\n```\n\nConstructor.\n\n| Parameters ||\n|-----------|----------------------------------------------------------------------------------------------------------------|\n| `message` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): This value cannot be `null`. |"]]