jeudi 28 juillet 2016

How to fix "None-static method 'getSystemService' can not be referenced from a static context error?

I am trying to add network speed tester functionality to my app . But I am stuck at the error. Please fix ..

java file

 package com.buckydroid.app.droidcpu.tools;

import android.content.Context;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;


public class network {
    public   wifispeed(Context context){
        WifiManager wifiManager = Context.getSystemService(Context.WIFI_SERVICE);
        WifiInfo wifiInfo = wifiManager.getConnectionInfo();
        if (wifiInfo != null) {
            Integer linkSpeed = wifiInfo.getLinkSpeed(); //measured using WifiInfo.LINK_SPEED_UNITS
        }

    }
}

Aucun commentaire:

Enregistrer un commentaire