0

I am able to post to Google Place Actions from android using the below code to post a place as in here (partly based on this answer by kuester2000).

 public void postMyPlaces(final double lat, final double lng, String name){
    Log.i(TAG," postMyPlaces called");
    
    Thread t = new Thread(){
        
        @Override
        public void run() {
            super.run();
            
            String url = "https://maps.googleapis.com/maps/api/place/add/json?sensor=true&key=" +GOOGLE_API_KEY ;
            
            
            HttpParams httpParameters = new BasicHttpParams();
            // Set the timeout in milliseconds until a connection is established.
            // The default value is zero, that means the timeout is not used. 
            int timeoutConnection = 3000;
            HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);
            // Set the default socket timeout (SO_TIMEOUT) 
            // in milliseconds which is the timeout for waiting for data.
            int timeoutSocket = 5000;
            HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);

            DefaultHttpClient httpClient = new DefaultHttpClient(httpParameters);
            
            HttpPost httpPost = new HttpPost(url);
            Log.i(TAG," postMyPlaces called "+ url);
            httpPost.setHeader("Content-type", "application/json");
        
            
            //Create a json request object to send it via HTTPS
            LocationModel uLocation = new LocationModel(Double.toString(lat),Double.toString(lng));
            MyPlacesModelImpl myPlacesPayload = new MyPlacesModelImpl("50","My Car","parking","en-AU",uLocation);
            
            
            StringEntity entity = null;
            try {
                entity = new StringEntity(myPlacesPayload.toJSON().toString());
            } catch (UnsupportedEncodingException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            
            httpPost.setEntity(entity);
            HttpResponse httpResponse = null;
            try {
                 httpResponse = httpClient.execute(httpPost);
                String resp = httpResponse.toString();
                Log.i(TAG,resp);
            } catch (ClientProtocolException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            
        };
        
    };
    t.start();
    
    
}

I am getting the response as "OK". But how to see these places which I have added in map???? Please help

Ryan M
  • 18,333
  • 31
  • 67
  • 74
CyBer2t
  • 524
  • 1
  • 5
  • 12

1 Answers1

0

"Place Report requests are used to add new Places, or delete existing ones. New Places will be available immediately in Place Nearby Searches initiated by your application, and will enter the moderation queue to be considered for Google Maps. A newly-added Place will not appear in Places Text Search or Radar Search results, or to other applications, until it has been approved by the moderation process." (from:https://developers.google.com/places/documentation/actions#PlaceReports)

this webpage contains the Place Nearby Searches: https://developers.google.com/places/documentation/search

IntoCode
  • 57
  • 1
  • 6