Android日志创建应用与添加位置服务
1、申明头文件
import android.util.Log;
import android.location.Location;
import android.location.LocationManager;
2、创建变量及其应用
public static final String DEBUG_TAG = "MySecondAppLogging";
public void getLocation()
{
try
{
LocationManager locMgr=(LocationManager)getSystemService(LOCATION_SERVICE);
Location recentLoc=locMgr.getLastKnownLocation(LocationManager.GPS_PROVIDER);
Log.i(DEBUG_TAG, "loc:" + recentLoc.toString());
}
catch(Exception e)
{
Log.e(DEBUG_TAG, "Location failed", e);
}
}
补充:移动开发 , Android ,