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

  • Home
  • SEARCH
  • 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 6156735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:39:42+00:00 2026-05-23T20:39:42+00:00

i try to create small example to test GPS here package org.example.location; import com.google.android.maps.MapActivity;

  • 0

i try to create small example to test GPS here

package org.example.location;

import com.google.android.maps.MapActivity;

import android.app.Activity;
import android.content.Context;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.widget.TextView;

public class WhereAmI extends MapActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    LocationManager locationManager;
    String context = Context.LOCATION_SERVICE;
    locationManager = (LocationManager)getSystemService(context);
    //String provider = LocationManager.GPS_PROVIDER;
    Criteria criteria = new Criteria();
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    criteria.setAltitudeRequired(false);
    criteria.setBearingRequired(false);
    criteria.setCostAllowed(true);
    criteria.setPowerRequirement(Criteria.POWER_LOW);
    String provider = locationManager.getBestProvider(criteria, true);

    Location location = locationManager.getLastKnownLocation(provider);
    updateWithNewLocation(location);

    locationManager.requestLocationUpdates(provider, 2000, 10, locationListener);
}

private void updateWithNewLocation(Location location) {
    String latLongString;
    TextView myLocationText;
    myLocationText = (TextView)findViewById(R.id.myLocationText);
    if (location != null) {
        double lat = location.getLatitude();
        double lng = location.getLongitude();
        latLongString = "Lat:" + lat + "\nLong:" + lng;
    } else {
        latLongString = "No location found";
    }
    myLocationText.setText("Your Current Position is:\n" +latLongString);
}

private final LocationListener locationListener = new LocationListener() {
    public void onLocationChanged(Location location) {
    updateWithNewLocation(location);
    }
    public void onProviderDisabled(String provider){
    updateWithNewLocation(null);
    }
    public void onProviderEnabled(String provider){ }
    public void onStatusChanged(String provider, int status,
    Bundle extras){ }
    };

@Override
protected boolean isRouteDisplayed() {
    // TODO Auto-generated method stub
    return false;
}

}

when i run it it gives nothing n in log cat

07-19 13:04:46.372: WARN/System.err(430): IOException processing: 26
07-19 13:04:46.381: WARN/System.err(430): java.io.IOException: Server returned: 3
07-19 13:04:46.401: WARN/System.err(430):     at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115)
07-19 13:04:46.421: WARN/System.err(430):     at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473)
07-19 13:04:46.451: WARN/System.err(430):     at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117)
07-19 13:04:46.471: WARN/System.err(430):     at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994)
07-19 13:04:46.491: WARN/System.err(430):     at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702)
07-19 13:04:46.511: WARN/System.err(430):     at java.lang.Thread.run(Thread.java:1019)

here manifest file

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="org.example.location"
  android:versionCode="1"
  android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />

<application android:icon="@drawable/icon" android:label="@string/app_name">
<uses-library android:name="com.google.android.maps"/>
    <activity android:name=".WhereAmI"
              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.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
</manifest>

Any idea??

  • 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-23T20:39:43+00:00Added an answer on May 23, 2026 at 8:39 pm

    Do you have the appropriate permissions set in AndroidManifest.xml?

    [Update]
    Have you provided a valid and registered Google Maps key? I believe that is the problem here.

    [Update]
    Check this tutorial: http://www.pocketvnc.com/blog/?page_id=511 on how to register and provide a Google Maps key.

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

Sidebar

Related Questions

I try to create a small file explorer on Android, and I want the
I try to create a new file inside a JSP and try to save
I try to create a thread in QT, can declare, create and start it,
I try to create a very simple app using windows API. I've done some
I try to create 2 buttons inside my app case WM_CREATE:{ hWnd =CreateWindowEx(NULL, LBUTTON,
i try to create an AEP for my advantage Database. I create a AEP
I try to create a multi-threaded singleton pattern class. Header: class HL{ public: static
I try to create a form that can save a person's form data so
I try to create some li elements in my XUL Application. Theres only the
When I try to create a SQL Server Login by saying CREATE LOGIN [ourdomain\SQLAccessGroup]

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.