• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PlaceLikelihoodBuffer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.android.gms.location.places.PlaceLikelihoodBuffer的典型用法代码示例。如果您正苦于以下问题:Java PlaceLikelihoodBuffer类的具体用法?Java PlaceLikelihoodBuffer怎么用?Java PlaceLikelihoodBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PlaceLikelihoodBuffer类属于com.google.android.gms.location.places包,在下文中一共展示了PlaceLikelihoodBuffer类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: callPlaceDetectionApi

import com.google.android.gms.location.places.PlaceLikelihoodBuffer; //导入依赖的package包/类
private void callPlaceDetectionApi() throws SecurityException {
    PendingResult<PlaceLikelihoodBuffer> result = Places.PlaceDetectionApi
            .getCurrentPlace(mGoogleApiClient, null);
    result.setResultCallback(new ResultCallback<PlaceLikelihoodBuffer>() {
        @Override
        public void onResult(PlaceLikelihoodBuffer likelyPlaces) {
            for (PlaceLikelihood placeLikelihood : likelyPlaces) {
                Log.i(LOG_TAG, String.format("Place '%s' with " +
                                "likelihood: %g",
                        placeLikelihood.getPlace().getName(),
                        placeLikelihood.getLikelihood()));
            }
            likelyPlaces.release();
        }
    });
}
 
开发者ID:addy-org,项目名称:Addy-Android,代码行数:17,代码来源:PlacesAPIActivity.java


示例2: getCurrentPlace

import com.google.android.gms.location.places.PlaceLikelihoodBuffer; //导入依赖的package包/类
void getCurrentPlace() throws SecurityException {
    PendingResult<PlaceLikelihoodBuffer> result = Places.PlaceDetectionApi.getCurrentPlace(placeApiClient, null);
    result.setResultCallback(new ResultCallback<PlaceLikelihoodBuffer>() {
        @Override
        public void onResult(PlaceLikelihoodBuffer likelyPlaces) {
            for (int i = 0; i < likelyPlaces.getCount() && i < 5; i++) {
                PlaceEntry place = new PlaceEntry();
                if (likelyPlaces.get(i).getLikelihood() == 0) continue;

                place.setName(likelyPlaces.get(i).getPlace().getName().toString());
                place.setLatLon(likelyPlaces.get(i).getPlace().getLatLng());
                myDataset.add(place);
                mAdapter.notifyItemInserted(myDataset.size() - 1);
            }
            getMapA();
            likelyPlaces.release();
        }
    });
}
 
开发者ID:Pavou,项目名称:Stalker,代码行数:20,代码来源:PlaceFragment.java


示例3: callPlaceDetectionApi

import com.google.android.gms.location.places.PlaceLikelihoodBuffer; //导入依赖的package包/类
private void callPlaceDetectionApi() throws SecurityException {
    PendingResult<PlaceLikelihoodBuffer> result = Places.PlaceDetectionApi
            .getCurrentPlace(mGoogleApiClient, null);
    result.setResultCallback(new ResultCallback<PlaceLikelihoodBuffer>() {
        @Override
        public void onResult(PlaceLikelihoodBuffer likelyPlaces) {
            for (PlaceLikelihood placeLikelihood : likelyPlaces) {
                Log.i(LOG_TAG, String.format("Place '%s' with " +
                                "likelihood: %g",
                        placeLikelihood.getPlace().getName(),
                        placeLikelihood.getLikelihood()));
                display.setText(placeLikelihood.getPlace().getAddress().toString());
                messageSending(placeLikelihood.getPlace().getAddress().toString());
                break;
            }
            likelyPlaces.release();
        }
    });
}
 
开发者ID:Pritom14,项目名称:Gps,代码行数:20,代码来源:Gps4Activity.java


示例4: callPlaceDetectionApi2

import com.google.android.gms.location.places.PlaceLikelihoodBuffer; //导入依赖的package包/类
private void callPlaceDetectionApi2(final String ph_number) throws SecurityException {
    PendingResult<PlaceLikelihoodBuffer> result = Places.PlaceDetectionApi
            .getCurrentPlace(mGoogleApiClient, null);
    result.setResultCallback(new ResultCallback<PlaceLikelihoodBuffer>() {
        @Override
        public void onResult(PlaceLikelihoodBuffer likelyPlaces) {
            for (PlaceLikelihood placeLikelihood : likelyPlaces) {
                Log.i(LOG_TAG, String.format("Place '%s' with " +
                                "likelihood: %g",
                        placeLikelihood.getPlace().getName(),
                        placeLikelihood.getLikelihood()));
                display.setText(placeLikelihood.getPlace().getAddress().toString());
                messageSending_individual(ph_number,placeLikelihood.getPlace().getAddress().toString());
                break;
            }
            likelyPlaces.release();
        }
    });
}
 
开发者ID:Pritom14,项目名称:Gps,代码行数:20,代码来源:Gps4Activity.java


示例5: guessCurrentPlace

import com.google.android.gms.location.places.PlaceLikelihoodBuffer; //导入依赖的package包/类
private void guessCurrentPlace() {
    PendingResult<PlaceLikelihoodBuffer> result = Places.PlaceDetectionApi.getCurrentPlace( mGoogleApiClient, null );
    result.setResultCallback( new ResultCallback<PlaceLikelihoodBuffer>() {
        @Override
        public void onResult( PlaceLikelihoodBuffer likelyPlaces ) {

            PlaceLikelihood placeLikelihood = likelyPlaces.get( 0 );
            String content = "";
            if( placeLikelihood != null && placeLikelihood.getPlace() != null && !TextUtils.isEmpty( placeLikelihood.getPlace().getName() ) )
                content = "Most likely place: " + placeLikelihood.getPlace().getName() + "\n";
            if( placeLikelihood != null )
                content += "Percent change of being there: " + (int) ( placeLikelihood.getLikelihood() * 100 ) + "%";
            mTextView.setText( content );

            likelyPlaces.release();
        }
    });
}
 
开发者ID:Lakkichand,项目名称:AndroidDemoProjects,代码行数:19,代码来源:MainActivity.java


示例6: getCurrentPlace

import com.google.android.gms.location.places.PlaceLikelihoodBuffer; //导入依赖的package包/类
/**
 * Returns observable that fetches current place from Places API. To flatmap and auto release
 * buffer to {@link com.google.android.gms.location.places.PlaceLikelihood} observable use
 * {@link DataBufferObservable}.
 *
 * @param placeFilter filter
 * @return observable that emits current places buffer and completes
 */
public Observable<PlaceLikelihoodBuffer> getCurrentPlace(@Nullable final PlaceFilter placeFilter) {
    return getGoogleApiClientObservable(Places.PLACE_DETECTION_API, Places.GEO_DATA_API)
            .flatMap(new Func1<GoogleApiClient, Observable<PlaceLikelihoodBuffer>>() {
                @Override
                public Observable<PlaceLikelihoodBuffer> call(GoogleApiClient api) {
                    return fromPendingResult(Places.PlaceDetectionApi.getCurrentPlace(api, placeFilter));
                }
            });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:ReactiveLocationProvider.java


示例7: updateMarkers

import com.google.android.gms.location.places.PlaceLikelihoodBuffer; //导入依赖的package包/类
/**
 * Adds markers for places nearby the device and turns the My Location feature on or off,
 * provided location permission has been granted.
 */
private void updateMarkers() {
    if (mMap == null) {
        return;
    }

    if (mLocationPermissionGranted) {
        // Get the businesses and other points of interest located
        // nearest to the device's current location.
        @SuppressWarnings("MissingPermission")
        PendingResult<PlaceLikelihoodBuffer> result = Places.PlaceDetectionApi
                .getCurrentPlace(mGoogleApiClient, null);
        result.setResultCallback(new ResultCallback<PlaceLikelihoodBuffer>() {
            @Override
            public void onResult(@NonNull PlaceLikelihoodBuffer likelyPlaces) {
                for (PlaceLikelihood placeLikelihood : likelyPlaces) {
                    // Add a marker for each place near the device's current location, with an
                    // info window showing place information.
                    String attributions = (String) placeLikelihood.getPlace().getAttributions();
                    String snippet = (String) placeLikelihood.getPlace().getAddress();
                    if (attributions != null) {
                        snippet = snippet + "\n" + attributions;
                    }

                    mMap.addMarker(new MarkerOptions()
                            .position(placeLikelihood.getPlace().getLatLng())
                            .title((String) placeLikelihood.getPlace().getName())
                            .snippet(snippet));
                }
                // Release the place likelihood buffer.
                likelyPlaces.release();
            }
        });
    } else {
        mMap.addMarker(new MarkerOptions()
                .position(mDefaultLocation)
                .title(getString(R.string.default_info_title))
                .snippet(getString(R.string.default_info_snippet)));
    }
}
 
开发者ID:Francescopaolo44,项目名称:MedicalMe,代码行数:44,代码来源:MapsActivity.java


示例8: isAtGasStationAsync

import com.google.android.gms.location.places.PlaceLikelihoodBuffer; //导入依赖的package包/类
public void isAtGasStationAsync(final CurrentPlaceListener currentPlaceListener) {
    if (!LocationHelper.isLocationPermissionAsked && ActivityCompat.checkSelfPermission(activity, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        ActivityCompat.requestPermissions(activity,
                new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, LocationHelper.LOCATION_PERMISSION_REQUEST);
        Log.e("getting location", "NO PERMISSION");
    }
    PendingResult<PlaceLikelihoodBuffer> places = Places.PlaceDetectionApi
            .getCurrentPlace(googleApiClient, null);
    places.setResultCallback(new ResultCallback<PlaceLikelihoodBuffer>() {
        @Override
        public void onResult(PlaceLikelihoodBuffer likelyPlaces) {
            for (PlaceLikelihood placeLikelihood : likelyPlaces) {
                if (placeLikelihood.getLikelihood() > LIKELIHOOD_ACCEPTABLE) {
                    List<Integer> types = placeLikelihood.getPlace().getPlaceTypes();
                    for (int t : types) {
                        if (t == Place.TYPE_GAS_STATION) {
                            lastStation = new Station(placeLikelihood.getPlace());
                            currentPlaceListener.OnIsAtGasStationResult(lastStation);
                            break;
                        }
                    }
                }
            }
            likelyPlaces.release();
        }
    });
}
 
开发者ID:Gaso-UFS,项目名称:gaso,代码行数:28,代码来源:PlacesHelper.java


示例9: lokasyonCek

import com.google.android.gms.location.places.PlaceLikelihoodBuffer; //导入依赖的package包/类
private void lokasyonCek(final boolean hepsi, final boolean hastahane, final boolean eczane, final boolean cafe, final boolean ibadethane, final boolean okul, final boolean diger) {

        PendingResult<PlaceLikelihoodBuffer> result = Places.PlaceDetectionApi
                .getCurrentPlace(mGoogleApiClient, null);
        result.setResultCallback(new ResultCallback<PlaceLikelihoodBuffer>() {
            @Override
            public void onResult(PlaceLikelihoodBuffer likelyPlaces) {
                for (PlaceLikelihood placeLikelihood : likelyPlaces) {
                    List types=placeLikelihood.getPlace().getPlaceTypes();
                    Log.i("liste", String.format("Place '%s' has likelihood: %g",
                            placeLikelihood.getPlace().getName(),
                            placeLikelihood.getLikelihood()));
                    if(hepsi)
                    konumlar.add(placeLikelihood.getPlace().getName().toString());
                    else{
                        if(hastahane && (types.contains(Place.TYPE_HOSPITAL) || types.contains(Place.TYPE_DOCTOR) ||types.contains(Place.TYPE_DENTIST) || types.contains(Place.TYPE_VETERINARY_CARE)))
                            konumlar.add(placeLikelihood.getPlace().getName().toString());
                        if(eczane && types.contains(Place.TYPE_PHARMACY))
                            konumlar.add(placeLikelihood.getPlace().getName().toString());
                        if(cafe &&( types.contains(Place.TYPE_CAFE) ||(types.contains(Place.TYPE_RESTAURANT) || types.contains(Place.TYPE_NIGHT_CLUB))))
                            konumlar.add(placeLikelihood.getPlace().getName().toString());
                        if(ibadethane && (types.contains(Place.TYPE_MOSQUE) || types.contains(Place.TYPE_CHURCH)))
                            konumlar.add(placeLikelihood.getPlace().getName().toString());
                        if(okul && (types.contains(Place.TYPE_UNIVERSITY) || types.contains(Place.TYPE_SCHOOL)))
                            konumlar.add(placeLikelihood.getPlace().getName().toString());
                        if(diger)
                            konumlar.add(placeLikelihood.getPlace().getName().toString());
                    }

                }
                likelyPlaces.release();
                veriAdaptoru.notifyDataSetChanged();
            }
        });



    }
 
开发者ID:safakesberk,项目名称:MobilAsistan,代码行数:39,代码来源:Konumlar.java


示例10: getCurrentLocation

import com.google.android.gms.location.places.PlaceLikelihoodBuffer; //导入依赖的package包/类
public void getCurrentLocation() {
    try {
        // On Marshmallow request for permissions first
        if (Build.VERSION.SDK_INT >= 23) {
            if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
                ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION},
                        PERMISSION_ACCESS_FINE_LOCATION);
            } else {
                return;
            }
            if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
                ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.ACCESS_COARSE_LOCATION},
                        PERMISSION_ACCESS_COARSE_LOCATION);
            } else {
                return;
            }
        }

        PendingResult<PlaceLikelihoodBuffer> result = Places.PlaceDetectionApi.getCurrentPlace(mGoogleApiClient, null);
        result.setResultCallback(new ResultCallback<PlaceLikelihoodBuffer>() {
            @Override
            public void onResult(@NonNull PlaceLikelihoodBuffer likelyPlaces) {
                Place place = null;
                float max = 0;
                for (PlaceLikelihood placeLikelihood : likelyPlaces) {
                    float likelihood = placeLikelihood.getLikelihood();
                    if (likelihood > max) {
                        place = placeLikelihood.getPlace();
                        max = placeLikelihood.getLikelihood();
                    }
                }
                if (place == null) {
                    Toast.makeText(getApplicationContext(), R.string.note_location_unable, Toast.LENGTH_SHORT).show();
                } else {
                    note.setLocation(place);
                    refreshLayout();
                }
                likelyPlaces.release();
            }
        });
    } catch (Exception ex) {
        Toast.makeText(getApplicationContext(), R.string.note_location_unable, Toast.LENGTH_SHORT).show();
    }
}
 
开发者ID:Ronak-LM,项目名称:memoir,代码行数:45,代码来源:ViewActivity.java



注:本文中的com.google.android.gms.location.places.PlaceLikelihoodBuffer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IGuild类代码示例发布时间:2022-05-21
下一篇:
Java ExpandoBridgeFactoryUtil类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap