Android - 如何从多个设备检测相同的用户? [英] Android - How to detect same user from multiple devices?

查看:126
本文介绍了Android - 如何从多个设备检测相同的用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个将用户创建的数据发送到服务器的应用程序。

在不同的设备上使用应用程序时,是否可以识别同一用户没有我的应用程序不得不请求访问他的Google帐户,需要额外的权限或要求他创建自定义登录凭据? (这是非常重要的,因为我的应用程序需要为匿名用户工作。)

我的应用程序使用推送通知,对于任何给定的用户,我明白令牌ID由FireBase生成的应用程序的每个设备安装可能都是相同的。所以我正在考虑使用这些令牌ID来识别多个设备上的相同用户。然而,我不确定这种方法有多可靠 - 或者有更好的方法吗?

NB - 我发现唯一标识符的最佳实践特别是处理多个安装部分),但是没有帮助。


  • 在本地和服务器上存储令牌

  • 在启动画面上始终使用存储在serever上的令牌检查存储在本地的令牌

  • 如果显示不同,请求用户只保留一个设备处于活动状态以接收通知,
    (如果用户选择了当前设备将该令牌存储到服务器)。


    I am developing an app that sends user-created data to a server.

    Is it possible to recognise the same user when he is using the app on different devices without my app having to request access to his Google account, requiring additional permissions or asking him to create custom login credentials? (This is important as my app needs to work for 'anonymous' users.)

    My app uses push notifications and, for any given user, I understand that the token ID generated by FireBase may be the same for each of his device installations of the app. So I am considering using these token IDs to identify the same user across multiple devices. However, I'm not sure how reliable that approach would be - or if there is a better way?

    NB - I found Best Practices for Unique Identifiers (the Handling Multiple Installations section in particular), but it hasn't helped.

    解决方案

    We can manage multiple installation with same account,

    1. Generate device token using firebase
    2. store token locally and on server also
    3. on splash screen always check token stored locally with token stored on serever
    4. if it shows differences ask user to keep only one device active to receive notification , if user selected current device store that token to server.

    这篇关于Android - 如何从多个设备检测相同的用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆