2016-12-03 5 views
5

पर बंद हो रहा है, मैं पहली बार जगह स्वतः पूर्ण टुकड़ा लागू करने की कोशिश कर रहा हूं और इसके साथ एक समस्या का सामना कर रहा हूं। जब भी मैं टाइप करना शुरू करता हूं, पहले अक्षर के बाद यह खोज शुरू करता है और परिणाम दिखाने के बजाए (टुकड़ा) बस गायब हो जाता है .. insted है कि मैं हो रही है स्थिति {statusCode = PLACES_API_ACCESS_NOT_CONFIGURED, संकल्प = अशक्त}एंड्रॉइड प्लेस स्वत: पूर्ण फ्रैगमेंट अपने स्वयं के

Manifest.xml

<meta-data 
      android:name="com.google.android.geo.API_KEY" 
      android:value="Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx4" /> 

Xml_layout

<TextView 
    android:text="TextView" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true" 
    android:layout_marginTop="14dp" 
    android:id="@+id/Area" 
    android:onClick="Onselection" 
    android:layout_alignParentEnd="true" 
    android:layout_alignParentStart="true" /> 
<fragment 
     android:id="@+id/place_autocomplete_fragment" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment" 
     android:layout_below="@+id/Area" 
     android:layout_alignParentStart="true" /> 

वर्ग Android पर Google API के साथ डेवलप जबकि

public class test extends AppCompatActivity implements PlaceSelectionListener { 


    private static final String LOG_TAG = "PlaceSelectionListener"; 
    private static final LatLngBounds BOUNDS_MOUNTAIN_VIEW = new LatLngBounds(
      new LatLng(-85, -180), new LatLng(85, 180)); 
    private static final int REQUEST_SELECT_PLACE = 1000; 
    TextView locationtext ; 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_testtttt); 
     locationtext = (TextView) findViewById(R.id.Arear) ; 

     PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment) 
       getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment); 

     autocompleteFragment.setOnPlaceSelectedListener(this); 

     AutocompleteFilter typeFilter = new AutocompleteFilter.Builder() 
       .setTypeFilter(AutocompleteFilter.TYPE_FILTER_ADDRESS) 
       .build(); 
     autocompleteFragment.setFilter(typeFilter); 


    } 


    public void Onselection(View v) 
    { 
     try { 
      Intent intent = new PlaceAutocomplete.IntentBuilder 
        (PlaceAutocomplete.MODE_OVERLAY) 
        .setBoundsBias(BOUNDS_MOUNTAIN_VIEW) 
        .build(testtttt.this); 
      startActivityForResult(intent, REQUEST_SELECT_PLACE); 
     } catch (GooglePlayServicesRepairableException | 
       GooglePlayServicesNotAvailableException e) { 
      e.printStackTrace(); 
     } 
    } 


    @Override 
    public void onPlaceSelected(Place place) { 

    } 

    @Override 
    public void onError(Status status) { 

    } 

On click fragment appears

fragment disappears/closed on its own

उत्तर

7

यह एक बहुत ही पेचीदा अनुभव है। सभी कि आप क्या करने की जरूरत है:

  1. console.developers.google.com
  2. पर जाएं Google API कुंजी
  3. गूगल एंड्रॉयड

यह है कि के लिए स्थानों API सक्षम के साथ जुड़े अपने प्रोजेक्ट का चयन करें।

3

rand_mem_RAM सही है।
मुझे 2 दिन googling ले लिया, शायद जवाब छोड़ दिया क्योंकि यह बहुत आसान है।

  1. जाओ console.developers.google.com को
  2. Google API कुंजी
  3. गूगल एंड्रॉयड 3 ए के लिए स्थानों API सक्षम के साथ जुड़े अपने प्रोजेक्ट का चयन करें। वेब पेज के शीर्ष पर पहला ब्लू बटन क्लिक करें, यह अगले वेब पेज 3b खोलता है। इसके बाद, अगले वेब पेज के शीर्ष पर दूसरा ब्लू बटन क्लिक करें, फिर अपने डिवाइस का परीक्षण करें।

अपरिवर्तित होगा लेकिन अतिथि के रूप में ऐसा नहीं कर सकता।

+0

आपका उत्तर पिछले जवाब के समान दिखता है काम कर रिहाई SHA1 अनुप्रयोग के साथ डिबग SHA1 कुंजी बदलें। –

0

कुछ समय समस्या, SHA1 फिंगरप्रिंट की वजह से होते जा सकता है मेरे मामले में के बाद ठीक

संबंधित मुद्दे