Come arrivare hardware wi-fi informazioni su Android

Seguente mi darà base di wifi di informazioni, ma io voglio informazioni hardware:

WiFiScanReceiver.java

import java.util.List;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.util.Log;
import android.widget.Toast;

public class WiFiScanReceiver extends BroadcastReceiver {

    private static final String TAG = "WiFiScanReceiver";
    systemInfo systemInfo;

    public WiFiScanReceiver(systemInfo systemInfo) {
        super();
        this.systemInfo = systemInfo;
    }

    @Override
    public void onReceive(Context c, Intent intent) {
        List<ScanResult> results = systemInfo.wifi.getScanResults();
        ScanResult bestSignal = null;
        for (ScanResult result : results) {
            if (bestSignal == null
                    || WifiManager.compareSignalLevel(bestSignal.level,
                            result.level) < 0) bestSignal = result;
        }
        String message = String.format(
                "%s networks found. %s is the strongest.", results.size(),
                bestSignal.SSID);
        Toast.makeText(systemInfo, message, Toast.LENGTH_LONG).show();
        Log.d(TAG, "onReceive() message: " + message);
    }
}

systemInfo.java

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;

import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManager.MemoryInfo;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.IntentFilter;

import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class systemInfo extends Activity implements OnClickListener {

    private static final String TAG = "WiFiDemo";
    WifiManager wifi;
    BroadcastReceiver receiver;
    TextView textStatus;
    Button buttonScan;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        //Setup UI
        textStatus = (TextView) findViewById(R.id.textStatus);
        buttonScan = (Button) findViewById(R.id.buttonScan);
        buttonScan.setOnClickListener(this);
        //Setup WiFi
        wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
        //Get WiFi status
        WifiInfo info = wifi.getConnectionInfo();
        textStatus.append("\n\nWiFi Status: " + info.toString());
        //List available networks
        List<WifiConfiguration> configs = wifi.getConfiguredNetworks();
        for (WifiConfiguration config : configs) {
            textStatus.append("\n\n" + config.toString());
        }
        //Register Broadcast Receiver
        if (receiver == null) receiver = new WiFiScanReceiver(this);
        registerReceiver(receiver, new IntentFilter(
                WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
        Log.d(TAG, "onCreate()");
        MemoryInfo mi = new MemoryInfo();
        ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
        activityManager.getMemoryInfo(mi);
        long availableMegs = mi.availMem / 1048576L;
        System.out.println("availableMegs:::::::::::" + availableMegs);
    }

    @Override
    public void onStop() {
        unregisterReceiver(receiver);
    }

    public void onClick(View view) {
        Toast.makeText(this, "On Click Clicked. Toast to that!!!",
                Toast.LENGTH_LONG).show();
        if (view.getId() == R.id.buttonScan) {
            Log.d(TAG, "onClick() wifi.startScan()");
            wifi.startScan();
            String ab = getInfo();
            System.out.println("CPU INFORMATON:::::::::::::\n" + ab);
            textStatus.append("CPU INFORMATON:::::::::::::\n" + ab);
        }
    }

    private String getInfo() {
        StringBuffer sb = new StringBuffer();
        sb.append("abi: ").append(Build.CPU_ABI).append("\n");
        if (new File("/proc/cpuinfo").exists()) {
            try {
                BufferedReader br = new BufferedReader(new FileReader(new File(
                        "/proc/cpuinfo")));
                String aLine;
                while ((aLine = br.readLine()) != null) {
                    sb.append(aLine + "\n");
                }
                if (br != null) {
                    br.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return sb.toString();
    }
}

autorizzazioni sono

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />

Questo mi dà di base wifi informazioni .Ma io voglio le informazioni sull’hardware ..

Una differenza importante è l’architettura della CPU. Anche se quasi tutti i dispositivi Android che utilizzano CPU ARM, è dotato di diverse versioni, tra cui armv5, armv5te, armv6, armv6 con visual foxpro, armv7, armv7 con visual foxpro, armv7 con neon ecc.

OriginaleL’autore Satya | 2012-08-29

One Reply
  1. 0

    Se la tua domanda è come ottenere le informazioni relative all’hardware su chip WiFi, allora la risposta è semplice: Android non fornisce questo tipo di dati, ad eccezione dell’indirizzo MAC (che, btw, non è proprio l’hardware informazioni).

    Thank u per il tuo raply Andrejs Cainikovs…

    OriginaleL’autore Andrejs Cainikovs

Lascia un commento