我当前正在使用Google Places API。我想做的是接收用户设备的经/纬度坐标,并找到附近某种类型的地点。
以某种方式,这可以与wifi连接配合使用。我取回附近地点的清单,并可以在卡片上显示它们。
但是当我禁用wifi并连接到4G连接时,我收到“ [应用名称]目前无响应。请稍后重试。”信息。
我检查了Firebase功能日志,并获得了200的响应状态,其中包含有效数据,但位置不正确。即使这样,即使在错误的位置,它也不应该显示数据吗?
关于为什么会这样的任何想法? Google Maps位置对我来说很好用。我可以通过单击Google地图上的相应按钮来获取当前位置。我还为Google地图和助手启用了移动数据。
编辑:我更深入地研究了日志。 因此,事实证明,在Google Cloud Platform上,由于“轮播”中只有一个项目,因此我得到了格式错误的响应。
格式错误的响应 Expected_inputs [0] .input_prompt.rich_initial_prompt.items [1] .carousel_browse: “ carousel_browse”至少需要2个项目。
但这仍然不能解决位置本身坐标错误的问题。
这是我通过4G连接(Firebase功能日志)得到的:
listPolicePost [ { geometry: { location: [Object], viewport: [Object]
},
icon: 'https://maps.gstatic.com/mapfiles/place_api/icons/police-71.png',
id: '0e7b9a2a292b190e98e46bbdcb2c81ad6eb48f5e',
name: 'Serangoon Garden Neighbourhood Police Post',
photos: [ [Object] ],
place_id: 'ChIJFzNrGAAX2jER2PowrtSXY_A',
plus_code:
{ compound_code: '9V78+9G Singapore',
global_code: '6PH59V78+9G' },
rating: 3.5,
reference: 'CmRSAAAA-vgZQmvol1ZcY4srSlQGLRLIErqMGaZPJvgyySiigXxG_O9ysjoAZOjBwIxH99q6fAMnml69NOuogaYzpc84yYgGf6BaNJ7c0QhI4gwqxUUpeYPe9pW4EundAFi4IbTKEhAhCFSAhJeHTmmurQzf55eEGhTYyD6BAiFSZ35QMftDtdehqVhF0Q',
scope: 'GOOGLE',
types: [ 'police', 'point_of_interest', 'establishment' ],
vicinity: '51 Serangoon Garden Way, Singapore' }, { geometry: { location: [Object], viewport: [Object] },
icon: 'https://maps.gstatic.com/mapfiles/place_api/icons/police-71.png',
id: '122baf85e424de14925665be49f5984cf367d61b',
name: 'Serangoon Neighbourhood Police Centre',
photos: [ [Object] ],
place_id: 'ChIJo_ADBqcX2jERaelpKPuk7_0',
plus_code:
{ compound_code: '9V2C+R5 Singapore',
global_code: '6PH59V2C+R5' },
rating: 4.6,
reference: 'CmRSAAAAt4STs5V8zT4-xRBKNU5EAqtLvHE1_CZr_Bk0WbNZqFdQztPT8HSeoRcw-Yksvz8TdiqzfQQGYXnAAqSJxNT6B9nAxhh0XlqkVLJh3Au0hCN8VrBhoSPujE8SBMfhjWPCEhCAgTBiiW9CWycfc9KneqEdGhT9BRJiiWfyx2KzqAJUyjAN3Snhpg',
scope: 'GOOGLE',
types: [ 'police', 'point_of_interest', 'establishment' ],
vicinity: '50 Serangoon Avenue 2, #01-02' } ]
在同一位置使用WIFI的结果:
listPolicePost [ { geometry: { location: [Object], viewport: [Object]
},
icon: 'https://maps.gstatic.com/mapfiles/place_api/icons/police-71.png',
id: '95c157891f885550b39dc74767a1ebc6fc426fa2',
name: 'Alexandra Neighbourhood Police Post',
photos: [ [Object] ],
place_id: 'ChIJ42CR00Aa2jERvHTJPpayEZQ',
plus_code:
{ compound_code: '8Q2X+46 Singapore',
global_code: '6PH58Q2X+46' },
rating: 5,
reference: 'CmRSAAAA6BBPfMynSJdnUhiFv3hGRmJxzSp4P6DGZ9_zAWX36EQEUXpxgmNgQNv1RYcH4B3d3Yxic5CaQK3Ec7UeY3dQW4Us92P8Y29yArsYfRuULrTOjdI4-GquWMzwB2wf6UubEhCHHitSm1_8jKBYWgPoU0vyGhRZUWXrfi9ShbA-dryqFABVCCwsmw',
scope: 'GOOGLE',
types: [ 'police', 'point_of_interest', 'establishment' ],
vicinity: 'Blk 46 Tanglin Halt Rd, #01-328' }, { geometry: { location: [Object], viewport: [Object] },
icon: 'https://maps.gstatic.com/mapfiles/place_api/icons/police-71.png',
id: '8bdb0e2f344ec77efcc198ed410f0a06bc04fbbb',
name: 'Commonwealth Neighbourhood Police Post',
place_id: 'ChIJ39iOiz8a2jER6Wv2o-9yeGs',
plus_code:
{ compound_code: '8Q4X+HF Singapore',
global_code: '6PH58Q4X+HF' },
rating: 5,
reference: 'CmRRAAAAprrqfgGSHVqj2xKP-TgSAagHxEIsWcak0WLiD_hqotMH-_lwWJg0HhlpW0MnxKZ5_yD3UWNkBT_0CjePxvt5Glu8PIC58AdmfDAmQ1fmPYxC64Au1WhwNuskwnS1a2M4EhCiJ7JzCXBGezyKo8HzhMwzGhRmp_Df8vfjWU_vasmr-QtXmWEi3Q',
scope: 'GOOGLE',
types: [ 'police', 'point_of_interest', 'establishment' ],
vicinity: '111 Commonwealth Crescent, Singapore' }, { geometry: { location: [Object], viewport: [Object] },
icon: 'https://maps.gstatic.com/mapfiles/place_api/icons/police-71.png',
id: '34e78e46388c52c814cc5c0858b5f6ad3221511c',
name: 'Buona Vista Police Post',
photos: [ [Object] ],
place_id: 'ChIJzeD5Imoa2jERih3LNGr2MSM',
plus_code:
{ compound_code: '8Q5V+P7 Singapore',
global_code: '6PH58Q5V+P7' },
rating: 2.8,
reference: 'CmRRAAAAqDe2CLznGR81_LoV_7OnWIOne7g-zrP4h1U6ELKlc1zhVBMG15AmyxXJWJlZdys7ILMVUSj6Mv5_gDBsII72NMLHZ97gELkaUbrnKEBu0_o72VXwyJRLvuzcjCK8MqKyEhC6GmBSJYtpY4mSyNUeNk6WGhTwCRXaS5B5Xwx5zyrDE9xapnlRIg',
scope: 'GOOGLE',
types: [ 'police', 'point_of_interest', 'establishment' ],
vicinity: 'block 13 Holland Dr #01-38/40' }, { geometry: { location: [Object], viewport: [Object] },
icon: 'https://maps.gstatic.com/mapfiles/place_api/icons/police-71.png',
id: '434ce574c05e43e70c33b6ba64d7f21c840b132f',
name: 'Dover Neighbourhood Police Post',
place_id: 'ChIJ73qudVwa2jERlggLteLz6nU',
plus_code:
{ compound_code: '8Q3J+GV Singapore',
global_code: '6PH58Q3J+GV' },
rating: 5,
reference: 'CmRRAAAAdXD9jiCrSsH6oBqvxFviOGDBq_KOj08XfSR8mLSgTZhk8FCbt4UVqUUiWnvoLJv5jw5nytcTfellRW8Js_cRvQca_ToDtVbp6nQqaiq9RR408qaJm-9WOJuBZXTui9TQEhCyyQlxS4MRYvjh9dTD0qTmGhS95n1YPfpmR0BDcdYuWFQ6lYKG0A',
scope: 'GOOGLE',
types: [ 'police', 'point_of_interest', 'establishment' ],
vicinity: 'Block 3, Dover Road, #01-368, 130003' }, { geometry: { location: [Object], viewport: [Object] },
icon: 'https://maps.gstatic.com/mapfiles/place_api/icons/police-71.png',
id: 'b2b998513d890ac0061b4b75380f26a3b7c4c81e',
name: 'Special Operations Command',
photos: [ [Object] ],
place_id: 'ChIJH2LnQ8sb2jERA-RABTXay8c',
plus_code:
{ compound_code: '7RW2+76 Singapore',
global_code: '6PH57RW2+76' },
rating: 5,
reference: 'CmRSAAAA8n7968a6h62bOQchkLcjdLGNlcCih7H3pQ1UmojLIXJOOD_RI8v5t3pZJlL0tZtTRBLpnIpgpXtEGu-48dPoELTPRu2Q_aHriAV4l2_YBf-tLR0RSNEQzOivTA7fPPxAEhDXhPRQs18Vfe-Ord4z-i0MGhS3eoucLyTZ504RQROrKrx18OEmGQ',
scope: 'GOOGLE',
types: [ 'police', 'point_of_interest', 'establishment' ],
vicinity: 'Queensway, Singapore' } ]