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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:41:58+00:00 2026-05-19T17:41:58+00:00

I am having difficulty getting my Monodroid application retrieve a location when I run

  • 0

I am having difficulty getting my Monodroid application retrieve a location when I run it in an emulator. My code looks something like this:

LocationManager locationsManager = (LocationManager)threadSurfaceView.Context.GetSystemService(Context.LocationService);

location = locationsManager.GetLastKnownLocation(Android.Content.Context.LocationService);

However, this always seems to return null. Do I have to configure the emulator in some way so that it has a locaion service and/or location?

I also tried adding a LocationListener:

locationListener = new MyLocationListener();

locationsManager.RequestLocationUpdates(LocationManager.GpsProvider, 120000, 0, locationListener);

But the problem I had here was to create the MyLocationListener class. I implemented the four public methods (OnLocationChanged(Location) and so on), but Visual Studio complained about a missing Android.Runtime.IJavaObject method – does anyone have a simple example of a class that implements ILocationListener?

Thanks for any help. Martin

  • 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-19T17:41:59+00:00Added an answer on May 19, 2026 at 5:41 pm

    I got a kindly link to a sample at

    https://github.com/gshackles/Sample-Projects/blob/master/MonoDroid/MonoDroidSamples/MonoDroidSamples/DemoActivities/LocationDemo/LocationActivity.cs

    Which works fine on my Nexus S but still will not work on the emulator – so (perhaps) the issue is not a code issue.

    I liked the technique in this sample of getting the “Activity” to implement ILocationListener as well as Activity – a neat solution to getting data back out of the “listener” function which had been giving me headaches when it was wrapped into another class.

    I downloaded the bundle of samples and if you do the same then you will need to grab an mp3 file – rename it volbeat.mp3 and add it to the “raw” folder within “Resources” as it is missing.

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

Sidebar

Related Questions

I am having difficulty getting this shell script to run. I decided to start
This feels like a newbie question, so brace yourself. I am having difficulty getting
I'm having great difficulty getting my Android application to play videos from the SD
I am having difficulty getting the pid of a launched file in an application.
I'm having difficulty getting my textarea to expand vertically automatically. I have some code
I am having difficulty getting this scoring function to work. The objective of my
I'm following a tutorial on php, and am having difficulty getting this to work.
I am having difficulty getting rid if the following error: bash-3.00$ p4 login Enter
I am having difficulty getting multiple jPicker instances of the same type to display
I'm having difficulty getting XQuery to work. I downloaded Saxon-HE 9.2. It seems to

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.