Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4545128
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:46:07+00:00 2026-05-21T15:46:07+00:00

I am developing an Android application that gets your current GPS location but the

  • 0

I am developing an Android application that gets your current GPS location but the toast does not appear onLocationChanged when I manually send latitude and longitude values via the Location Controls on Eclipse.

Is there anything I have left out, because I have tried all I can think of. I will greatly appreciate your help.

Here is my code:

package com.currentlocation;

import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.widget.Button;
import android.widget.Toast;

public class CurrentLocation extends Activity {
    Button button1;
   LocationManager mylocationManager;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        button1=(Button)findViewById(R.id.button1);
        mylocationManager=(LocationManager)getSystemService(Context.LOCATION_SERVICE);
        LocationListener locationlistener=new mylocation();
        mylocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0,locationlistener);
    }
    public class mylocation implements LocationListener
    {
        @Override
        public void onLocationChanged(Location location) {
            String mycurrentLocation="My current location is Latitude"+location.getLatitude()+" and Longitude"+location.getLongitude();
            Toast.makeText(getApplicationContext(),mycurrentLocation, Toast.LENGTH_SHORT).show();
        }
        @Override
        public void onProviderDisabled(String provider) {}
        @Override
        public void onProviderEnabled(String provider) {}
        @Override
        public void onStatusChanged(String provider, int status, Bundle extras) {}
    }


}

Here is my manifest code:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.currentlocation"
      android:versionCode="1"
      android:versionName="1.0">


    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".CurrentLocation"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

</manifest>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T15:46:08+00:00Added an answer on May 21, 2026 at 3:46 pm

    You are Listening from NETWORK_PROVIDER not from GPS_PROVIDER. If you want GPS Latitude and Longitude just replace this line.

     mylocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0,locationlistener);
    

    with

     mylocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,locationlistener);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing an Android application that might be used at night. Therefor, I need
I'm developing an Android application that uses a WebView to display the login page
I'm currently developing an Android application that fetches images using http requests. It would
I am developing an android application that receives data about events from a server.
I'm developing an Android application that I'd like to be compatible with 1.5 (SDK
I'm developing an Android Application that has three very similar Activities. I would like
im developing an Android application for twitter that will sync data coming from the
When developing a desktop application in .NET, is it possible to not require the
I'm having a go at developing my first android application and have never really
When developing on BlackBerry or iOS, you can deploy your application just by dropping

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.