Stay organized with collections
Save and categorize content based on your preferences.
ServiceStartNotAllowedException
abstract class ServiceStartNotAllowedException : IllegalStateException
Known Indirect Subclasses
|
Exception thrown when an app tries to start a Service
when it's not allowed to do so.
Summary
Properties
cause
open val cause: Throwable?
Return |
Throwable? |
the cause of this throwable or null if the cause is nonexistent or unknown. |
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,["# ServiceStartNotAllowedException\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nServiceStartNotAllowedException\n===============================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/app/ServiceStartNotAllowedException \"View this page in Java\") \n\n```\nabstract class ServiceStartNotAllowedException : IllegalStateException\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](#) |\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [BackgroundServiceStartNotAllowedException](/reference/kotlin/android/app/BackgroundServiceStartNotAllowedException), [ForegroundServiceStartNotAllowedException](/reference/kotlin/android/app/ForegroundServiceStartNotAllowedException), [ForegroundServiceTypeException](/reference/kotlin/android/app/ForegroundServiceTypeException) |----------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------| | [BackgroundServiceStartNotAllowedException](/reference/kotlin/android/app/BackgroundServiceStartNotAllowedException) | Exception thrown when an app tries to start a background [Service](/reference/kotlin/android/app/Service) when it's not allowed to do so. | | [ForegroundServiceStartNotAllowedException](/reference/kotlin/android/app/ForegroundServiceStartNotAllowedException) | Exception thrown when an app tries to start a foreground [Service](/reference/kotlin/android/app/Service) when it's not allowed to do so. | | [ForegroundServiceTypeException](/reference/kotlin/android/app/ForegroundServiceTypeException) | Base exception thrown when an app tries to start a foreground [Service](/reference/kotlin/android/app/Service) without a valid type. | |\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Indirect 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\nException thrown when an app tries to start a [Service](/reference/kotlin/android/app/Service) when it's not allowed to do so.\n\nSummary\n-------\n\n| Properties ||\n|----------------------------------------------------------------------------------------------|-----------------------------------------|\n| open [Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)? | [cause](#cause:kotlin.Throwable) \u003cbr /\u003e |\n\nProperties\n----------\n\n### cause\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen val cause: Throwable?\n```\n\n| Return ||\n|-----------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|\n| [Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)? | the cause of this throwable or `null` if the cause is nonexistent or unknown. |"]]