Getting device model (not device name) from peer through Wifi Peer2Peer

I have successfully created an android application that is capable of discovering peers through wifi peer 2 peer. I discovered and requested the WifiP2Pdevicelist class and with that i managed to obtained the primaryDeviceType value. However what i want is the device model of the peer. Is there anyway to convert the primaryDeviceType or get device model through wifi p2p?

Got the deviceName, deviceAddress, primaryDeviceType, and secondaryDeviceType from the WifiP2Pdevicelist class used for Wifi P2P. The output of the deviceName is the Wifi-direct name which could be changed. I have yet to connect to the peer because all of this is done using the requestPeer() and discoverPeer() method.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>WifiManager wifi;
WifiP2pManager manager;
WifiP2pManager.Channel channel;
BroadcastReceiver receiver;
IntentFilter intentFilter;
ListView listView;
List<WifiP2pDevice> peers = new ArrayList<>();
String[] deviceName, deviceType, deviceAddress;
WifiP2pDevice[] deviceArray;
public ArrayList<WifiP2pDevice> wifiDeviceList = new ArrayList<>();
WifiP2pManager.PeerListListener peerListListener = new WifiP2pManager.PeerListListener() {
@Override
public void onPeersAvailable(WifiP2pDeviceList peersList) {
Toast.makeText(getApplicationContext(), "Peers available", Toast.LENGTH_SHORT).show();
if (!peersList.getDeviceList().equals(peers)) {
peers.clear();
peers.addAll(peersList.getDeviceList());
deviceName = new String[peersList.getDeviceList().size()];
deviceArray = new WifiP2pDevice[peersList.getDeviceList().size()];
for (WifiP2pDevice device : peersList.getDeviceList()) {
listView.clearChoices();
wifiDeviceList.add(device);
}
ArrayAdapter<WifiP2pDevice> mAdapter = new ArrayAdapter<WifiP2pDevice>(getApplicationContext(), android.R.layout.simple_list_item_1, wifiDeviceList) {
@NonNull
@Override
public View getView(int position, View convertView, @NonNull ViewGroup parent) {
Toast.makeText(getApplicationContext(), "No Devices Found", Toast.LENGTH_SHORT).show();
TextView view = (TextView) super.getView(position, convertView, parent);
// Replace text with my own
if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return view;
}
view.setText("Device name: " + wifiDeviceList.get(position).deviceName + "n" + "Device address: " + wifiDeviceList.get(position).deviceAddress + "n" + "Device type: " + wifiDeviceList.get(position).primaryDeviceType);
return view;
}
};
listView.setAdapter(mAdapter);
listView.deferNotifyDataSetChanged();
}
else {
Toast.makeText(getApplicationContext(), "No peers found", Toast.LENGTH_SHORT).show();
}
}
};
</code>
<code>WifiManager wifi; WifiP2pManager manager; WifiP2pManager.Channel channel; BroadcastReceiver receiver; IntentFilter intentFilter; ListView listView; List<WifiP2pDevice> peers = new ArrayList<>(); String[] deviceName, deviceType, deviceAddress; WifiP2pDevice[] deviceArray; public ArrayList<WifiP2pDevice> wifiDeviceList = new ArrayList<>(); WifiP2pManager.PeerListListener peerListListener = new WifiP2pManager.PeerListListener() { @Override public void onPeersAvailable(WifiP2pDeviceList peersList) { Toast.makeText(getApplicationContext(), "Peers available", Toast.LENGTH_SHORT).show(); if (!peersList.getDeviceList().equals(peers)) { peers.clear(); peers.addAll(peersList.getDeviceList()); deviceName = new String[peersList.getDeviceList().size()]; deviceArray = new WifiP2pDevice[peersList.getDeviceList().size()]; for (WifiP2pDevice device : peersList.getDeviceList()) { listView.clearChoices(); wifiDeviceList.add(device); } ArrayAdapter<WifiP2pDevice> mAdapter = new ArrayAdapter<WifiP2pDevice>(getApplicationContext(), android.R.layout.simple_list_item_1, wifiDeviceList) { @NonNull @Override public View getView(int position, View convertView, @NonNull ViewGroup parent) { Toast.makeText(getApplicationContext(), "No Devices Found", Toast.LENGTH_SHORT).show(); TextView view = (TextView) super.getView(position, convertView, parent); // Replace text with my own if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) { // TODO: Consider calling // ActivityCompat#requestPermissions // here to request the missing permissions, and then overriding // public void onRequestPermissionsResult(int requestCode, String[] permissions, // int[] grantResults) // to handle the case where the user grants the permission. See the documentation // for ActivityCompat#requestPermissions for more details. return view; } view.setText("Device name: " + wifiDeviceList.get(position).deviceName + "n" + "Device address: " + wifiDeviceList.get(position).deviceAddress + "n" + "Device type: " + wifiDeviceList.get(position).primaryDeviceType); return view; } }; listView.setAdapter(mAdapter); listView.deferNotifyDataSetChanged(); } else { Toast.makeText(getApplicationContext(), "No peers found", Toast.LENGTH_SHORT).show(); } } }; </code>
WifiManager wifi;
WifiP2pManager manager;
WifiP2pManager.Channel channel;

BroadcastReceiver receiver;
IntentFilter intentFilter;

ListView listView;
List<WifiP2pDevice> peers = new ArrayList<>();
String[] deviceName, deviceType, deviceAddress;
WifiP2pDevice[] deviceArray;

public ArrayList<WifiP2pDevice> wifiDeviceList = new ArrayList<>();

WifiP2pManager.PeerListListener peerListListener = new WifiP2pManager.PeerListListener() {
    @Override
    public void onPeersAvailable(WifiP2pDeviceList peersList) {
        Toast.makeText(getApplicationContext(), "Peers available", Toast.LENGTH_SHORT).show();

        if (!peersList.getDeviceList().equals(peers)) {
            peers.clear();
            peers.addAll(peersList.getDeviceList());
            deviceName = new String[peersList.getDeviceList().size()];
            deviceArray = new WifiP2pDevice[peersList.getDeviceList().size()];

            for (WifiP2pDevice device : peersList.getDeviceList()) {
                listView.clearChoices();
                wifiDeviceList.add(device);
            }

            ArrayAdapter<WifiP2pDevice> mAdapter = new ArrayAdapter<WifiP2pDevice>(getApplicationContext(), android.R.layout.simple_list_item_1, wifiDeviceList) {
                @NonNull
                @Override
                public View getView(int position, View convertView, @NonNull ViewGroup parent) {
                    Toast.makeText(getApplicationContext(), "No Devices Found", Toast.LENGTH_SHORT).show();
                    TextView view = (TextView) super.getView(position, convertView, parent);
                    // Replace text with my own
                    if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
                        // TODO: Consider calling
                        //    ActivityCompat#requestPermissions
                        // here to request the missing permissions, and then overriding
                        //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
                        //                                          int[] grantResults)
                        // to handle the case where the user grants the permission. See the documentation
                        // for ActivityCompat#requestPermissions for more details.
                        return view;
                    }
                    view.setText("Device name: " + wifiDeviceList.get(position).deviceName + "n" + "Device address: " + wifiDeviceList.get(position).deviceAddress + "n" + "Device type: " + wifiDeviceList.get(position).primaryDeviceType);
                    return view;
                }
            };
            listView.setAdapter(mAdapter);
            listView.deferNotifyDataSetChanged();
        }
        else {
            Toast.makeText(getApplicationContext(), "No peers found", Toast.LENGTH_SHORT).show();
        }
    }
};

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật