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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:20:09+00:00 2026-05-26T13:20:09+00:00

About App:–This is a simple app which find the user current location. Problem:– The

  • 0

About App:–This is a simple app which find the user current location.

Problem:– The app works fine on emulator please see the image.

enter image description here

But in phone it is not showing the MapView.Please see the image.

enter image description here

Please tell me what is going wrong with the phone. In Phone it just download the huge(20 mb) data but not show the actual map.

Logcat im getting –

   10-31 16:44:45.994: E/MapActivity(3026): Couldn't get connection factory client

  10-31 15:47:42.319: ERROR/MapView(1773): java.lang.IllegalStateException: Null Bitmap!   "loading_tile"; if seen during a test, this usually means that the image file needs to be added to the test.config file

XML FILE

  <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

<TextView  
android:id="@+id/myLocationText"
android:layout_width="fill_parent" 
android:layout_height="wrap_content" />

 <com.google.android.maps.MapView
 android:id="@+id/myMapView"
 android:layout_height="fill_parent"
 android:layout_width="fill_parent"
 android:clickable="true"
 android:enabled="true"
 android:apiKey="0bBgLl42nWwnTf983Y5VdIgfZI6mC7meL7Ms_qg"/>

</LinearLayout>

Code

public class WhereIam extends MapActivity {
MapController mapController;
MyPositionOverlay positionOverlay;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    MapView myMapView=(MapView)findViewById(R.id.myMapView);
    mapController=myMapView.getController();
    myMapView.setSatellite(true);
    myMapView.setStreetView(true);
    myMapView.displayZoomControls(false);
    myMapView.setBuiltInZoomControls(true);
    mapController.setZoom(16);
    positionOverlay = new MyPositionOverlay();
    List<Overlay> overlays = myMapView.getOverlays();
    overlays.add(positionOverlay);
    LocationManager locationManager;
    String context=Context.LOCATION_SERVICE;
    locationManager=(LocationManager)getSystemService(context);

    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);

    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){ }
        };

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

private void updateWithNewLocation(Location location) {
    String latLongString;
    TextView myLocationText;
    String addressString ="No Address Found";
    myLocationText=(TextView)findViewById(R.id.myLocationText);
    if(location!=null)  {
        // Update the map location.
        positionOverlay.setLocation(location);
        Double geoLat = location.getLatitude()*1E6;
        Double geoLng = location.getLongitude()*1E6;
        GeoPoint point = new GeoPoint(geoLat.intValue(),
        geoLng.intValue());
        mapController.animateTo(point);
        double lat=location.getLatitude();
        double lng=location.getLongitude();
        latLongString = "Lat:" + lat + "\nLong:" + lng;
        Geocoder gc=new Geocoder(this, Locale.getDefault());
        try {
            List<Address> addressess= gc.getFromLocation(lat, lng, 1);
            StringBuilder sb=new StringBuilder();
            if(addressess.size()>0) {
                Address address=addressess.get(0);
                for(int i=0;i<address.getMaxAddressLineIndex();i++) {
                    sb.append(address.getAddressLine(i)).append("\n");
                    sb.append(address.getLocality()).append("\n");
                    sb.append(address.getPostalCode()).append("\n");
                    sb.append(address.getCountryName());
                }
                addressString = sb.toString();
            }
        }catch(IOException e) {} 
    }
    else {
        latLongString="No Found Location";
    }
    myLocationText.setText("Your current Location is \n"+latLongString+"\n"+addressString);
}

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

}

I just crated one api key as follow goto->cmd prompt

change the directory to the keytool folder

now run the command keytool -list -alias androiddebugkey -keystore “C:\Users\pc.android\debug.keystore” -storepass android -keypass android

see the image enter image description here

Now i goto signup page i simply put the MD5 in EditText and checked accept and clicked generate key then following page comes up which show the key–

enter image description here
Now i put this key in my MapView Xml file..

as you can see app running fine in emulator but not in real phone.

Where am I going wrong, and how do I generate a second API key for a real phone?

  • 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-26T13:20:10+00:00Added an answer on May 26, 2026 at 1:20 pm

    For testing on real hardware you need to use a key different from the debug key. Following your post you are using a debug keystore.

    https://developers.google.com/maps/documentation/android-api/v1/?csw=1#getfingerprint

    Read that paragraph on google.

    Is important that the application is exported as a signed application with the same key used for the google api (and NOT the debug key).

    For create a valid read that paragraph:

    http://developer.android.com/guide/publishing/app-signing.html#releasemode

    and then use the same key to obtain the google maps api key.

    Once you have the key for your application you can export a signed application by clicking with right button of your mouse on the project select Android Tools and then Export as a signed application package and follow the wizard (probably you can create a new key using that wizard).

    hope that help.

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

Sidebar

Related Questions

(edited) For more details about the app it self, please, also see: Simple but
This question is about App domains and Sessions. Is it possible to have IIS
This is about a web app that serves images. Since the same request will
sorry if this question sounds useless . I am researching about google app engine
I need your advise. It's about this app: LEDit Free EDIT: The referenced app
I have made a app which uses visual studio's app.config to store settings about
I've released an app about a month ago now, and it works as it
I am just learning about app.config in respect of creating custom sections. I have
I was reading about App Engine on wikipedia and came across some GQL restrictions:
I am making app about google documents. but I don't know How to save

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.