質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.47%
Google API

Googleは多種多様なAPIを提供していて、その多くはウェブ開発者向けのAPIです。それらのAPIは消費者に人気なGoogleのサービス(Google Maps, Google Earth, AdSense, Adwords, Google Apps,YouTube等)に基づいています。

Java

Javaは、1995年にサン・マイクロシステムズが開発したプログラミング言語です。表記法はC言語に似ていますが、既存のプログラミング言語の短所を踏まえていちから設計されており、最初からオブジェクト指向性を備えてデザインされています。セキュリティ面が強力であることや、ネットワーク環境での利用に向いていることが特徴です。Javaで作られたソフトウェアは基本的にいかなるプラットフォームでも作動します。

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

Google マップ

Google Mapは、Google社がオンラインで提供している地図・ローカル検索サービスです。GIS(Geographic Information System:地理情報システム)の中の「WebGIS」に該当します。地図・航空写真・地形の表示方式があり、それぞれユーザーが縮尺を調整して表示させることができます。地域の情報サービスを検索する機能やルート検索の機能も搭載されています。

Q&A

解決済

1回答

2539閲覧

Google Mapの実装で大量に検出されるLogについて

Jhon_McClane

総合スコア48

Google API

Googleは多種多様なAPIを提供していて、その多くはウェブ開発者向けのAPIです。それらのAPIは消費者に人気なGoogleのサービス(Google Maps, Google Earth, AdSense, Adwords, Google Apps,YouTube等)に基づいています。

Java

Javaは、1995年にサン・マイクロシステムズが開発したプログラミング言語です。表記法はC言語に似ていますが、既存のプログラミング言語の短所を踏まえていちから設計されており、最初からオブジェクト指向性を備えてデザインされています。セキュリティ面が強力であることや、ネットワーク環境での利用に向いていることが特徴です。Javaで作られたソフトウェアは基本的にいかなるプラットフォームでも作動します。

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

Google マップ

Google Mapは、Google社がオンラインで提供している地図・ローカル検索サービスです。GIS(Geographic Information System:地理情報システム)の中の「WebGIS」に該当します。地図・航空写真・地形の表示方式があり、それぞれユーザーが縮尺を調整して表示させることができます。地域の情報サービスを検索する機能やルート検索の機能も搭載されています。

0グッド

0クリップ

投稿2021/09/15 01:56

編集2021/09/15 03:42

前提・実現したいこと

Android studio 4.2.2でgoogle Mapを取り入れた実装をしています.
私が実装したい機能として,ユーザの向きを取得する度に,マップ UI上で向きが分かるよう反映させたいです.
しかし,向きを取得する毎にsetOrientation()を呼ぶため,膨大な数の

I/Counters: exceeded sample count in FrameTime

が呼ばれます. いずれ,処理が重いと判断され,アプリが落ちることはあるでしょうか.

向きは,onSensorChanged(SensorEvent event) で内の処理で取得しています.

以下のLogは,地図の状態が変わる度に呼ばれるのですが,何故こんなに呼ばれるのでしょうか.
そもそもFrameTime以内に,カメラ位置・拡大縮小・markerの変更による描画を終えることは可能なのでしょうか.
私の原因は,FrameTimeでのsample数を越えたことが原因です.

一様このLogは無視して構わないという情報を見たのですが,スレッドの表示限界に達することでアプリが落ちる様な気がするので,
できれば検出されないようにしたいです.

大量にはかれるLog

以下のように,zoomIn/Out, カメラ位置を動かす,Markerの状態が変わるなどをすると,大量に検出します.

I/Counters: exceeded sample count in FrameTime I/Counters: exceeded sample count in FrameTime I/Counters: exceeded sample count in FrameTime I/Counters: exceeded sample count in FrameTime I/Counters: exceeded sample count in FrameTime I/Counters: exceeded sample count in FrameTime I/chatty: uid=10116(u0_a116) androidmapsapi- identical 21 lines I/Counters: exceeded sample count in FrameTime I/Counters: exceeded sample count in FrameTime I/Counters: exceeded sample count in FrameTime I/Counters: exceeded sample count in FrameTime I/Counters: exceeded sample count in FrameTime I/Counters: exceeded sample count in FrameTime I/chatty: uid=10116(u0_a116) androidmapsapi- identical 59 lines I/Counters: exceeded sample count in FrameTime I/Counters: exceeded sample count in FrameTime I/chatty: uid=10116(u0_a116) androidmapsapi- identical 4 lines I/Counters: exceeded sample count in FrameTime I/Counters: exceeded sample count in FrameTime I/chatty: uid=10116(u0_a116) androidmapsapi- identical 64 lines I/Counters: exceeded sample count in FrameTime I/Counters: exceeded sample count in FrameTime I/chatty: uid=10116(u0_a116) androidmapsapi- identical 2 lines I/Counters: exceeded sample count in FrameTime I/Counters: exceeded sample count in FrameTime I/chatty: uid=10116(u0_a116) androidmapsapi- identical 32 lines I/Counters: exceeded sample count in FrameTime

該当のソースコード

Mapに関わるコードを載せています.

// onMapReadyが呼ばれたとき,1度だけ実行 public void onMapStart() { // marker my location in map //setPinOnMap(myUserInfo); onLocationChanged(myUserInfo); // marker group area in map createCircle(); mMap.getUiSettings().setScrollGesturesEnabled(false); } public void onLocationChanged(UserInfo userInfo) { Marker marker = markerHashMap.get(userInfo.getPeerId()); if (null != marker) { marker.remove(); Log.d("onLocationChanged()", userInfo.getPeerId() + "さんのMarkerをremove()します"); } LatLng currentLocation = new LatLng(userInfo.getLatitude(), userInfo.getLongitude()); marker = mMap.addMarker(new MarkerOptions() .position(currentLocation) .title(userInfo.getPeerId())); markerHashMap.put(userInfo.getPeerId(), marker); Log.d("onLocationChanged()", userInfo.getPeerId() + "さんのMarkerを更新しました"); Log.d("onLocationChanged()", "markerの数は" + markerHashMap.size() + "です"); if (userInfo.getPeerId().equals(myUserInfo.getPeerId())) { marker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.my_pin)); mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(currentLocation, 18)); } // 他端末のPinは緑色が基本 else { marker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)); marker.setAlpha(0.7f); markerList.add(marker); markerHashMap.put(marker.getTitle(), marker); } } // 視覚的方向変更 public void setOrientation(float dirAngle) { Marker marker = markerHashMap.get(myUserInfo.getPeerId()); if (null != marker) { marker.setRotation(dirAngle); } } private void createCircle() { CircleOptions circleOptions = new CircleOptions() .center(new LatLng(groupInfo.getLatitude(), groupInfo.getLongitude())) .radius(groupInfo.getAreaSize()) //.fillColor(Color.argb(59, 255, 255, 0)) .strokeColor(Color.RED) .zIndex(1.0f); mMap.addCircle(circleOptions); }

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

地図の描画処理が発生するとI/Counters: exceeded sample count in FrameTimeが呼ばれる.
私の場合,短時間に再描画の処理が頻繁に発生していたため,描画の条件を変更したり,描画間隔を広げることで対処した.

投稿2021/10/18 07:09

Jhon_McClane

総合スコア48

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.47%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問