Android NDK limitations?

前端 未结 4 1284
广开言路
广开言路 2021-02-05 12:13

I have a question about the limitations of what you can do in native code on the Android platform.

Basically I have developed a library in native C code that uses UDP so

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-05 13:08

    You still need your application to have permissions. For example, your native sockets will not work without android.permission.INTERNET in the manifest.

    
     ...
     
    
    

    Another option is to create the socket at the Java layer and pass it down. Here's an example of interacting with the socket in native land, see the method org_..._OpenSSLSocketImpl_connect():

    http://www.netmite.com/android/mydroid/dalvik/libcore/x-net/src/main/native/org_apache_harmony_xnet_provider_jsse_OpenSSLSocketImpl.cpp

提交回复
热议问题