gpt4 book ai didi

java - 在多个设备之间共享单个谷歌地图

转载 作者:行者123 更新时间:2023-11-29 21:16:33 24 4
gpt4 key购买 nike

假设我有一个使用 google map 的应用程序,我是 Controller ,我可以添加标记、删除标记等...问题是我如何让另一台设备上的其他人看到我的 map 以动态的方式,即如果我删除/添加一个标记并且他刷新,他将看到发生的变化

最佳答案

您需要同步这两个应用程序,例如使用网络服务器中的数据库,所有应用程序都在其中发送和读取其状态中的更新。为此,您必须调用 php 服务器,可能以 json 格式发送和接收信息。

另外,你可以尝试使用sync adapters

Synchronizing data between an Android device and web servers can make your application significantly more useful and compelling for your users. For example, transferring data to a web server makes a useful backup, and transferring data from a server makes it available to the user even when the device is offline. In some cases, users may find it easier to enter and edit their data in a web interface and then have that data available on their device, or they may want to collect data over time and then upload it to a central storage area.

Although you can design your own system for doing data transfers in your app, you should consider using Android's sync adapter framework. This framework helps manage and automate data transfers, and coordinates synchronization operations across different apps. When you use this framework, you can take advantage of several features that aren't available to data transfer schemes you design yourself:

在给定的链接中,您可以找到更多信息以及示例应用

关于java - 在多个设备之间共享单个谷歌地图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21299436/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com