duanfei1930 2013-05-27 10:01
浏览 76

AS3 / Air iOS和Android数据将数据同步到多个设备到远程数据库

I am about to undertake the development of an app that requires sycning of data from the local device to an online DB...and back.

I am building something that will allow users to create events and invite users to those events. Users will also be able to chat and receive in app notifications. I would like to store the information in local storage that the user creates and push this information to an online DB when there is internet available. Then if there are any waiting events or notifications for that user, they can retrieve them when online also.

My concern is about the merging of data and the fact the local storage PK's will not be the same as the online PK's.

For example, user1 and user2 both just installed the app. They both create an event and invite each other to the event. Once they are both online their devices try to push the data to the online DB however there is a conflict with the PK used.

My question is: Can someone give me some guidance about how best to handle a situation like this? The app will be built using AS3 and Air and only for iOS and Android. There will be a MySQL remote DB with a PHP backend.

Any help is appreciated.

  • 写回答

1条回答 默认 最新

  • dongyan3237 2013-05-28 20:06
    关注

    You could also send a time stamp of when it was sent to use with your PHP, where the request that got there last has an event sent back to notify the user (probably best with a push notification) that there has already been an event made.

    Also not sure if you know already, but you can use NetConnection status to get a sense of when they connect to the internet.

    localNc = new NetConnection();
    localNc.addEventListener(NetStatusEvent.NET_STATUS, netStatus);
    
    function netStatus(event:NetStatusEvent):void{
        trace(event.info.code);
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大