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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:13:44+00:00 2026-05-25T15:13:44+00:00

In Monodroid, I am trying to access GPS services. All I need is a

  • 0

In Monodroid, I am trying to access GPS services. All I need is a location object.

this line thorws an error:

  • _locationManager.RequestLocationUpdates(LocationManager.GpsProvider, 1000, 10, this);

Java.Lang.SecurityException

The stack trace says at Android.Runtime.JNIEnv.CallVoidMethod(IntPtr jobject, IntPtr jmethod, Android.Runtime.jValue[] params) [0x00000] in :0

I have the latest version of monodroid and I am running it on a Samsung Galaxy S II physical device.

I think it has something to do with the Manifest file – I suspect there is an attribute I am missing so that Monodroid can generate a manifest that tells the device I am using GPS services.

I know from http://docs.xamarin.com/android/advanced_topics/working_with_androidmanifest.xml that Monodroid generates it’s own AndroidManifest file using mandroid.exe. Now either I must modify the AndroidManifest.xml file myself or I must get mandroid to insert GPS things for me. Here’s the kicker: there is no ‘merge’ file as described by the link above – so I am left with doing it through mandroid.

So do I create and add a new file for mandroid to merge with?

Here is what I am doing:

...
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.Locations;
...

namespace mynamespace
{
    [Activity(Label = "My Activity")]  
    public class MainActivity : Activity, ILocationListener
    {
        ...
        #region Location Variables
        LocationManager _locationManager;
        #endregion

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.MainPage);

            ...
            #region Location Setup
            try
            {
                _locationManager = null;

                if (/*user says to use location services*/)
                {

                    _locationManager = (LocationManager)GetSystemService(Context.LocationService);
                    _locationManager.RequestLocationUpdates(LocationManager.GpsProvider, 1000, 10, this);
                }
            }
            catch (Exception ex)
            {
                _debug.Text = string.Format("{0} -- {1}",ex.Message,ex.StackTrace);
            }

            #endregion

            ...
        }

        #region Common Methods
        ...
        #endregion

        #region Events
        ...
        #endregion

        #region Location Services
        public void OnLocationChanged(Location location)
        {
            _debug.Text = string.Format("long: {0}, lat: {1}", location.Longitude, location.Latitude);
        }

        public void OnProviderDisabled(string provider)
        {
            //throw new NotImplementedException();
        }

        public void OnProviderEnabled(string provider)
        {            
            //throw new NotImplementedException();
        }

        public void OnStatusChanged(string provider, int status, Bundle extras)
        {
            //throw new NotImplementedException();
        }
        #endregion
    }
}
  • 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-25T15:13:45+00:00Added an answer on May 25, 2026 at 3:13 pm

    You app does not have permissions to access GPS. To solve this open context menu on project, select Properties-> Android Manifest. If there is no nothing click on the link “No AndroidMaifest.xml found. Click to add one.” Check permission to access GPS data – ACCESS_FINE_LOCATION. Save, rebuild, enjoy.

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

Sidebar

Related Questions

I've been trying to implement this example using C# and Monodroid, but am having
How does one turn any random object into a JSON string using Monodroid's System.Json
My monodroid application builds and runs fine, but breakpoints are not being hit. This
I'm trying to use RedLaserSDK.java from MonoDroid. I've included redlasersdk.jar as AndroidJavaLibrary I've included
I have problems implementing the ItemizedOverlay on monodroid from this tutorial: http://developer.android.com/resources/tutorials/views/hello-mapview.html , Does
I am trying to use IronPython with monodroid (using a Android 4 phone) so
I'm trying to use ServiceStack for Json serialization/deserialization in MonoDroid project. I've built ServiceStack
I'm trying to use ServiceStack REST DTO and OrmLite with monoDroid. But I can't
I'm trying to build the mondroid-sample https://github.com/xamarin/monodroid-samples/tree/master/MapsAndLocationDemo . Whenever I start the application I
I just installed MonoDroid alpha 4.1, and I'm trying to create a binding library

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.