Back to project page Werewolf-Android-Client.
The source code is released under:
Copyright (c) 2013, Timothy Cohen All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ...
If you think the Android project Werewolf-Android-Client listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package edu.wm.werewolf_client; // ww w.j a va2 s. c om import edu.wm.werewolf_client.FindLocation.LocationResult; import android.app.Activity; import android.location.Location; import android.os.Bundle; import android.util.Log; public class Locate extends Activity { public static final String TAG = "DetectLocation"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.detect_location); getActionBar().setDisplayHomeAsUpEnabled(true); LocationResult locationResult = new LocationResult(){ @Override public void gotLocation(Location location){ if (location == null){ //If we failed to find the location for some reason, show the user an alert dialog Log.w(TAG,"failed to get location!"); } else{ //Got the location! double lat = (double) (location.getLatitude()); double lng = (double) (location.getLongitude()); Log.v(TAG,"latitude is: "+lat); Log.v(TAG,"longitude is: "+lng); } } }; FindLocation myLocation = new FindLocation(); myLocation.getLocation(this, locationResult); } }