Home  >  Q&A  >  body text

android - 重复登录 怎么解决 比如两台设备同时登录一个账号

重复登录怎么解决比如两台设备同时登录一个账号

PHP中文网PHP中文网2741 days ago1133

reply all(6)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 17:34:25

    There are two types of solutions. The first type is proactive. When your second client logs in, the first client is notified to log out. This requires a long connection between the client and the server.
    The second type is passive. When the client logs in, it will obtain a token, and every subsequent operation will bring the token. The token will be updated each time it logs in. Therefore, when the second logs in, the token of the first login will be used. It will be invalid, log out at this time

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 17:34:25

    You can integrate third parties such as Huanxin, which has a kick-out function for repeated logins. However, if it is just for this function, it is not necessary. It is better to design it through the interface.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 17:34:25

    If you are chatting, it is a long connection, and the server can actively disconnect the user. Like QQ
    If it is just for ordinary functions, tokens are used to squeeze out the other party's offline, but this must request the network interface to be effective. Generally, the interface design, each request head Zhongdu brings token information, but you can also send it directly to the client through push messages to prompt you to go offline.

    reply
    0
  • 阿神

    阿神2017-04-17 17:34:25

    If you do it yourself, use a custom message notification. When an account has been logged in and another device logs in to the account again, let the server send a notification to the first device. The device can log out after receiving the notification.
    If you are using third-party instant messaging, it is relatively simple. After the account is logged in, the instant messaging will have a monitoring method. Just perform operations in this method

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 17:34:25

    Generally, one account is not allowed to be logged in on two mobile phones. Unless there are special needs, you can go to the mobile phone device parameters for unique verification as account parameters

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 17:34:25

    Requires server-side classmates to make restrictions

    reply
    0
  • Cancelreply