In a P2P setting, I understand how to get another device\'s name, but how do I get my own device\'s name? (the one displayed in WiFi-direct under settings).
I have c
Try this code:
public static String getHostName(String defValue) { try { Method getString = Build.class.getDeclaredMethod("getString", String.class); getString.setAccessible(true); return getString.invoke(null, "net.hostname").toString(); } catch (Exception ex) { return defValue; } }