ServiceInfo.ForegroundServiceTypeSpecialUse フィールド

定義

注意事項

This constant will be removed in the future version. Use Android.Content.PM.ForegroundService enum directly instead of this field.

属性内の android.R.attr#foregroundServiceTypespecialUse対応する定数。

[Android.Runtime.Register("FOREGROUND_SERVICE_TYPE_SPECIAL_USE", ApiSince=34)]
[Android.Runtime.RequiresPermission("android.permission.FOREGROUND_SERVICE_SPECIAL_USE")]
[System.Obsolete("This constant will be removed in the future version. Use Android.Content.PM.ForegroundService enum directly instead of this field.", true)]
public const Android.Content.PM.ForegroundService ForegroundServiceTypeSpecialUse = 1073741824;
[<Android.Runtime.Register("FOREGROUND_SERVICE_TYPE_SPECIAL_USE", ApiSince=34)>]
[<Android.Runtime.RequiresPermission("android.permission.FOREGROUND_SERVICE_SPECIAL_USE")>]
[<System.Obsolete("This constant will be removed in the future version. Use Android.Content.PM.ForegroundService enum directly instead of this field.", true)>]
val mutable ForegroundServiceTypeSpecialUse : Android.Content.PM.ForegroundService

フィールド値

Value = 1073741824

実装

属性

注釈

属性内の android.R.attr#foregroundServiceTypespecialUse対応する定数。 他のフォアグラウンド サービスの種類に分類できないが、API を使用 android.app.job.JobInfo.Builder できないユース ケース。

このフォアグラウンド サービスの種類の使用が制限される場合があります。 さらに、アプリでは、ここでの正確なユース ケースのヒントとして、 でAndroidManifest.xmlサービス レベルPackageManager#PROPERTY_SPECIAL_USE_FGS_SUBTYPE &lt;property&gt;を宣言する必要があります。 たとえば次のようになります。

&lt;uses-permission
                 android:name="android.permissions.FOREGROUND_SERVICE_SPECIAL_USE"
             /&gt;
             &lt;service
                 android:name=".MySpecialForegroundService"
                 android:foregroundServiceType="specialUse"&gt;
                 &lt;property
                     android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
                     android:value="foo"
                 /&gt;
            &lt;/service&gt;

Android の今後のリリースでは、上記のフォアグラウンド サービスの種類 foo がプラットフォームでサポートされている場合、下位互換性を提供するために、アプリは < で 属性を指定 android:maxSdkVersion できます。uses-permission>セクションを使用し、フォアグラウンド サービスの種類 foo を に android:foregroundServiceType追加します。そのため、両方のプラットフォームに同じアプリをインストールできます。

&lt;uses-permission
                 android:name="android.permissions.FOREGROUND_SERVICE_SPECIAL_USE"
                 android:maxSdkVersion="last_sdk_version_without_type_foo"
             /&gt;
             &lt;service
                 android:name=".MySpecialForegroundService"
                 android:foregroundServiceType="specialUse|foo"&gt;
                 &lt;property
                     android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
                     android:value="foo"
                 /&gt;
            &lt;/service&gt;

android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USEJava ドキュメント。

このページの一部は、によって作成および共有された作業に基づく変更であり、に記載されている条件に従って使用されます。

適用対象