但實作上發現,upnp control point並沒有啟動
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tView = (TextView)findViewById(R.id.resultTV);
ControlPoint cPoint = new ControlPoint();
tView.append(String.valueOf(cPoint.start())); --> false,表示沒有start( )成功
tView.append(String.valueOf(cPoint.stop())); --> true
於是使用logcat查看,其中CyberGarage被permission denied
04-26 10:57:03.010: I/System.out(12701): CyberGarage warning : Permission denied
04-26 10:57:03.010: I/System.out(12701): java.net.SocketException: Permission denied
04-26 10:57:03.010: I/System.out(12701): at java.net.NetworkInterface.getAllInterfaceAddressesImpl(Native Method)
04-26 10:57:03.010: I/System.out(12701): at java.net.NetworkInterface.getNetworkInterfacesImpl(NetworkInterface.java:62)
04-26 10:57:03.010: I/System.out(12701): at java.net.NetworkInterface.getNetworkInterfacesList(NetworkInterface.java:241)
04-26 10:57:03.010: I/System.out(12701): at java.net.NetworkInterface.getNetworkInterfaces(NetworkInterface.java:237)
谷歌的結果,是說因CyberGarage會使用到internet服務,需將internet service打開。
在AndroidManifest.xml裡,將權限加入即可,如下:

沒有留言:
張貼留言