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 6896673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:04:23+00:00 2026-05-27T07:04:23+00:00

I am testing my application in Android Emulator and I am only able to

  • 0

I am testing my application in Android Emulator and I am only able to set a GPS position when the application is already running through the onLocationChanged method. I can’t set it before I start the application. This is the code in my onCreate method:

Edit: Think you guys missunderstood me. I am able to set a GPS position with geo fix when application is running. When I try to set it before I launch the activity I get Error android.view.windowmanager$badtokenexception.

LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);

Criteria crit = new Criteria();
providers = lm.getBestProvider(crit, false);
loc = lm.getLastKnownLocation(providers);
    if (loc != null) {
    title.setText(stop_name);
    lview.setAdapter(lviewAdapter);
      } else {
        Toast t = Toast.makeText(this, "Failed to get GPS location", 5000);
        t.setGravity(Gravity.BOTTOM, 0, 0);
        t.show();
        }
  • 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-27T07:04:24+00:00Added an answer on May 27, 2026 at 7:04 am

    to set the gps location in emulator you have to follow below steps and open your app before setting up below steps ,then this will go to last configuration .

    1. Open command prompt
    2. Type “telnet localhost 5554”
    3. then type geo fix

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a hybrid mobile application (PhoneGap+JQM). While testing in the Android emulator, I'm
I am just testing out the onLocationChanged method in Android , I have implemented
Hi i am testing android E-mail application . I have configured an Exchange account
I started developing android applications. And am testing with the android emulator. Do I
I heard that for testing android application you have to test them on 2
Can we make application that support NFC (near field communication) for android devices without
I am developing and testing an android application on my Galaxy S device, which
I have been developing an Android application and testing the orientation sensor using SensorSimulator
when testing my application in the emulator(I'm using Eclipse) it shows me The application
After I have set up all the unit test cases for my android application

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.