다음을 통해 공유


NetworkSecurityPolicy.IsCleartextTrafficPermitted Property

Definition

Returns whether cleartext network traffic (e.

public virtual bool IsCleartextTrafficPermitted { [Android.Runtime.Register("isCleartextTrafficPermitted", "()Z", "GetIsCleartextTrafficPermittedHandler", ApiSince=23)] get; }
[<get: Android.Runtime.Register("isCleartextTrafficPermitted", "()Z", "GetIsCleartextTrafficPermittedHandler", ApiSince=23)>]
member this.IsCleartextTrafficPermitted : bool

Property Value

Attributes

Remarks

Returns whether cleartext network traffic (e.g. HTTP, FTP, WebSockets, XMPP, IMAP, SMTP -- without TLS or STARTTLS) is permitted for all network communication from this process.

When cleartext network traffic is not permitted, the platform's components (e.g. HTTP and FTP stacks, android.app.DownloadManager, android.media.MediaPlayer) will refuse this process's requests to use cleartext traffic. Third-party libraries are strongly encouraged to honor this setting as well.

This flag is honored on a best effort basis because it's impossible to prevent all cleartext traffic from Android applications given the level of access provided to them. For example, there's no expectation that the java.net.Socket API will honor this flag because it cannot determine whether its traffic is in cleartext. However, most network traffic from applications is handled by higher-level network stacks/components which can honor this aspect of the policy.

NOTE: android.webkit.WebView honors this flag for applications targeting API level 26 and up.

Java documentation for android.security.NetworkSecurityPolicy.isCleartextTrafficPermitted().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to