Question: I'm trying to create an activity, upon starting it, I'll have a map that immediately access my current location in the map and move towards it.

So I call the below during the onCreate()...

```
public void moveToCurrentLocation()
{
    if ( !mLM.isProviderEnabled( LocationManager.GPS_PROVIDER ) ) {
        buildAlertMessageNoGps();
    }
    else
    {
        Location myloc = mMap.getMyLocation();
        //if (myloc == null ) myloc = mLM.getLastKnownLocation(LocationManager.GPS_PROVIDER);
        if (myloc != null) {
            LatLng position = new LatLng(myloc.getLatitude(), myloc.getLongitude());
            moveToLocation(position);
            return;
        } else {
            Toast.makeText(mContext, "Sorry no location information obtained yet. Try click again on 'current location button' on the map", Toast.LENGTH_LONG).show();
        }
    }
    moveToLocation(SINGAPORE, false, 9);

}

```

What happen is, getMyLocation always return Null initially, and after awhile only, it will be able to get the location. The workaround I use is getLastKnownLocation from LocationManager to solve the problem. However, the LastKnownLocation might not be the current location.

So how could I solve the problem to ensure getMyLocation will get the data immediately upon starting of the activity? Thanks.

Answer: 
> 
> I do not know where to upload the php file.
> 
> 
> 

You need to upload it to web hosting that supports PHP and to which the URL specified in the `action` attribute of the form resolves.

> 
> I tried uploading the php code on my google drive, and also on dropbox, but how to make my form access that php file?
> 
> 
> 

Neither Google Drive not Dropbox provide web hosting which supports any kind of server side programming. You need to get a proper web host instead of using a cloud storage service that happens to allow public sharing of (static) files.

> 
> Can I make this form work (i.e the messages to be sent to my email id) by javascript
> 
> 
> 

Not in any practical way. 

In theory you could construct a `mailto:` URI and use JS to send the browser to it. Depending on how the browser is configured, this might simply fail or it might open a pre-filled-in email in the user's email client which they could click send on. This is an unreliable and user-unfriendly approach that you shouldn't go anywhere near.

> 
> /jquery 
> 
> 
> 

jQuery is a JS library. You can't do anything with it that you can't do with JS already.

> 
> or some other method?
> 
> 
> 

You need a server side solution. Some companies will supply dedicated form to email gateways (i.e. a prewritten server side solution), but they tend to be inflexible.
You'll need some sort of server set up to handly the post request, it wouldnt matter if you do a standard http post from a form or use javascript/jquery ajax.

If you cant use your own server try a email service or a iframed form service such as [wooforms](http://www.wufoo.com/land/1/)