Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.location.Criteria;

import android.location.LocationManager;

public class Main {
    public static String getBestProvider(LocationManager locationmanager) {
        String s = null;
        if (locationmanager != null) {
            Criteria criteria = new Criteria();
            criteria.setAccuracy(2);
            criteria.setAltitudeRequired(false);
            criteria.setBearingRequired(false);
            criteria.setCostAllowed(true);
            criteria.setPowerRequirement(0);
            s = locationmanager.getBestProvider(criteria, true);
            if (s == null)
                s = "network";
        }
        return s;
    }
}