What is the alternative packages for R(android) to HarmonyOs and Displaymetrics to harmonyOS and some constants?

140 Views Asked by At

what should I do with the constants which are causing some problem.?

      import static android.net.ConnectivityManager.TYPE_BLUETOOTH;
      import static android.net.ConnectivityManager.TYPE_DUMMY;
      import static android.net.ConnectivityManager.TYPE_ETHERNET;
      import static android.net.ConnectivityManager.TYPE_MOBILE;
      import static android.net.ConnectivityManager.TYPE_MOBILE_DUN;
2

There are 2 best solutions below

0
On

If you are looking for an alternative API in harmonyos, you should check - Netcapabilities class from package ohos.net.NetCapabilities.

It has the following corresponding attributes -

enter image description here

0
On

The NetManager class and other related classes in the ohos.net package may be what you're looking for.

public final class NetManager
extends Object

enter image description here

It provides interfaces to manage and use data networks.

This class provides interfaces to activate and query data networks and bind NICs to processes, as well as callback interfaces to listen for status changes.

For more info, kindly check docs link.