Back to Exoplayer

NetworkTypeObserver (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/util/NetworkTypeObserver.html

latest3.6 KB
Original Source

Package com.google.android.exoplayer2.util

Class NetworkTypeObserver


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classNetworkTypeObserverextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")

Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.

Observer for network type changes.

Registered listeners are informed at registration and whenever the network type changes.

The current network type can also be queried without registration.

Nested Class Summary

Nested Classes | Modifier and Type | Class | Description | | --- | --- | --- | | static interface | NetworkTypeObserver.Listener | Deprecated.

A listener for network type changes. |

Method Summary

All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | static NetworkTypeObserver | getInstance​(Context context) | Deprecated.

Returns a network type observer instance. | | @com.google.android.exoplayer2.C.NetworkType int | getNetworkType() | Deprecated.

Returns the current network type. | | void | register​(NetworkTypeObserver.Listener listener) | Deprecated.

Registers a listener. | | static void | resetForTests() | Deprecated.

Resets the network type observer for tests. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail

- 

getInstance

public static[NetworkTypeObserver](NetworkTypeObserver.html "class in com.google.android.exoplayer2.util")getInstance​([Context](https://developer.android.com/reference/android/content/Context.html "class or interface in android.content")context)

Deprecated.

Returns a network type observer instance. Parameters:context - A Context.

- 

resetForTests

public static void resetForTests()

Deprecated.

Resets the network type observer for tests.

- 

register

public void register​([NetworkTypeObserver.Listener](NetworkTypeObserver.Listener.html "interface in com.google.android.exoplayer2.util")listener)

Deprecated.

Registers a listener.

The current network type will be reported to the listener after registration.

Parameters:listener - The NetworkTypeObserver.Listener.

- 

getNetworkType

[@NetworkType](../C.NetworkType.html "annotation in com.google.android.exoplayer2")public @com.google.android.exoplayer2.C.NetworkType int getNetworkType()

Deprecated.

Returns the current network type.