File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
java/com/thirdegg/chromecast/api/v2/utils Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 11<manifest xmlns : android =" http://schemas.android.com/apk/res/android"
22 package =" com.thirdegg.chromecast.api.v2" >
33 <uses-permission android : name =" android.permission.ACCESS_WIFI_STATE" />
4+ <uses-permission android : name =" android.permission.CHANGE_WIFI_MULTICAST_STATE" />
45</manifest >
Original file line number Diff line number Diff line change 77import java .net .UnknownHostException ;
88
99public class AndroidUtils {
10+
1011 public static InetAddress getDeviceIpAddress (WifiManager wifi ) {
1112 InetAddress result = null ;
1213 try {
@@ -16,8 +17,12 @@ public static InetAddress getDeviceIpAddress(WifiManager wifi) {
1617 // figure out our wifi address, otherwise bail
1718 WifiInfo wifiinfo = wifi .getConnectionInfo ();
1819 int intaddr = wifiinfo .getIpAddress ();
19- byte [] byteaddr = new byte []{(byte ) (intaddr & 0xff ), (byte ) (intaddr >> 8 & 0xff ),
20- (byte ) (intaddr >> 16 & 0xff ), (byte ) (intaddr >> 24 & 0xff )};
20+ byte [] byteaddr = new byte []{
21+ (byte ) (intaddr & 0xff ),
22+ (byte ) (intaddr >> 8 & 0xff ),
23+ (byte ) (intaddr >> 16 & 0xff ),
24+ (byte ) (intaddr >> 24 & 0xff )
25+ };
2126 result = InetAddress .getByAddress (byteaddr );
2227 } catch (UnknownHostException ex ) {
2328 ex .printStackTrace ();
You can’t perform that action at this time.
0 commit comments