<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>android location Archives - Creatronix</title>
	<atom:link href="https://creatronix.de/tag/android-location/feed/" rel="self" type="application/rss+xml" />
	<link>https://creatronix.de/tag/android-location/</link>
	<description>My adventures in code &#38; business</description>
	<lastBuildDate>Thu, 09 Oct 2025 09:51:12 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Getting Location Info in Android</title>
		<link>https://creatronix.de/getting-location-info-in-android/</link>
		
		<dc:creator><![CDATA[Jörn]]></dc:creator>
		<pubDate>Mon, 22 Jun 2020 09:00:23 +0000</pubDate>
				<category><![CDATA[Android & iOS development]]></category>
		<category><![CDATA[android location]]></category>
		<guid isPermaLink="false">http://creatronix.de/?p=3345</guid>

					<description><![CDATA[<p>Manifest &#60;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&#62; Activity &#160; public static final int REQUEST_CODE = 123; LocationManager mLocationManager; LocationListener mLocationListener; @Override protected void onResume(){ super.onResume(); getCurrentLocation(); } private void getCurrentLocation() { Log.d("Clima", "getWeatherForCurrentLocation"); mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); mLocationListener = new LocationListener() { @Override public void onLocationChanged(Location location) { Log.d("Clima", "onLocationChanged"); String longitude = String.valueOf(location.getLongitude()); String latitude = String.valueOf(location.getLatitude());&#8230;</p>
<p>The post <a href="https://creatronix.de/getting-location-info-in-android/">Getting Location Info in Android</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Manifest</h2>
<pre>&lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;</pre>
<h2>Activity</h2>
<p>&nbsp;</p>
<pre>public static final int REQUEST_CODE = 123;
LocationManager mLocationManager; 
LocationListener mLocationListener;</pre>
<pre>@Override
protected void onResume(){
    super.onResume();
    getCurrentLocation();
}</pre>
<pre>private void getCurrentLocation() {
    Log.d("Clima", "getWeatherForCurrentLocation");
    mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    mLocationListener = new LocationListener() {
        @Override
        public void onLocationChanged(Location location) {
            Log.d("Clima", "onLocationChanged");
            String longitude = String.valueOf(location.getLongitude());
            String latitude = String.valueOf(location.getLatitude());
            Log.d("Clima", "longitude is: " +longitude);
            Log.d("Clima","latitude is: " + latitude);
        }

        @Override
        public void onStatusChanged(String s, int i, Bundle bundle) {

        }

        @Override
        public void onProviderEnabled(String s) {

        }

        @Override
        public void onProviderDisabled(String s) {

        }
    };
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
            &amp;&amp; ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_CODE);
        return;
    }
    mLocationManager.requestLocationUpdates(LOCAION_PROVIDER, MIN_TIME, MIN_DISTANCE, mLocationListener);
}</pre>
<p>&nbsp;</p>
<pre>@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    Log.d("Clima", "onRequestPermissionsResult");
    if (requestCode == REQUEST_CODE) {
        if(grantResults.length &gt; 0 &amp;&amp; grantResults[0] == PackageManager.PERMISSION_GRANTED){
            getCurrentLocation();
        }
    }
}</pre>
<p>The post <a href="https://creatronix.de/getting-location-info-in-android/">Getting Location Info in Android</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
