Android Add Place to Google Places database doesn't work -


i'm developing android application using google maps , google places. when user makes long click on map, show him form in can add details clicked place, , want add google database new google place. when before , after submits form:

in oncreate():

mgoogleapiclient = new googleapiclient                 .builder(this)                 .addapi(places.geo_data_api)                 .enableautomanage(this, 0, this)                 .addconnectioncallbacks(this)                 .addonconnectionfailedlistener(this)                 .build(); 

after submitting form:

private void addplacetogoogledbandtotrip() {     final double lat = getintent().getextras().getdouble("lat");     final double lng = getintent().getextras().getdouble("lng");     final string placename = newplacenameet.gettext().tostring();     final string address = newplaceaddresset.gettext().tostring();     final string website = newplacewebsiteet.gettext().tostring();     final string phonenumber = newplacephoneet.gettext().tostring();     latlng latlng = new latlng(lat, lng);  addplacerequest place =         new addplacerequest(                 placename, // name                 latlng, // latitude , longitude                 address, // address                 collections.singletonlist(place.type_point_of_interest), // place types                 phonenumber, // phone number                 uri.parse("www.somewebsite.co.il") // website         );  places.geodataapi.addplace(mgoogleapiclient, place).setresultcallback(new resultcallback<placebuffer>() {     @override     public void onresult(placebuffer places)     {          if (!places.getstatus().issuccess()) {              log.e(tag, "place query did not complete. error: " + places.getstatus().tostring());             places.release();             return;         }          final place place = places.get(0);         newplaceid = place.getid();         log.i(tag, "place add result: " + place.getname());         places.release();      } }); } 

but places.get(0) used return empty place, , don't that... error on result coming back. says: "error_operation_failed, resolution=null".

my manifest has well:

<uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.get_accounts" /> <uses-permission android:name="android.permission.use_credentials" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="com.google.android.providers.gsf.permission.read_gservices" />  <meta-data     android:name="com.google.android.gms.version"     android:value="@integer/google_play_services_version" /> <meta-data     android:name="com.google.android.maps.v2.api_key"     android:value="@string/google_maps_key" /> 

any idea might problem? apis enabled in developers console.

thank you!

use com.google.android.geo.api_key rather com.google.android.maps.v2.api_key.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -