开发者

Is SNMP supported in Android?

开发者 https://www.devze.com 2023-03-09 05:09 出处:网络
I would like to know if SNMP is supported in Android(2.1)? If it is not available, is it possible to port the snmp source for Android?(some pointers plz..)

I would like to know if SNMP is supported in Android(2.1)?

If it is not available, is it possible to port the snmp source for Android?(some pointers plz..)

If it is available, how can I test the presence of it in my device.

All pointers are welc开发者_StackOverflow中文版omed.

Thanks,

Sen


SNMP4J 2.x can be directly used on Android without changing its sources. The logging can be set to a simple console logger by calling

  static {
    LogFactory.setLogFactory(new ConsoleLogFactory());
    ConsoleLogAdapter.setDebugEnabled(true);
  }

in your root activity. Of course, you can implement a Android Logging Adapter too and register it as shown above.


I know this is a really old question, but I was doing exactly what you're asking. The short answer is no, by default, SNMP is not supported on android 2.1. Because it isn't available, what I wound up doing was grabbing snmp4j's source code, and sticking it in android and making my own library. There are libraries (snmp4android comes to mind) but I found that it lacked certain classes I needed and did not have the whole snmp4j.agent branch.

There are a few dependencies and a few libraries that android is missing but most of them pertain to the log4j class.

To remedy that, just convert/make the switch to something like slf4j, which is a small logging library that you can include with your application.

I hope that answers some of your initial questions, and I hope this is still relevant even if it is an old question.

0

精彩评论

暂无评论...
验证码 换一张
取 消