简体   繁体   English

Android-如何限制用户在多个设备上处于活动状态?

[英]Android- How to restrict users to be active in more than one device?

I am developing an Android application in which I would like to restrict an user to access only one device at a time. 我正在开发一个Android应用程序,在该应用程序中,我希望限制用户一次只能访问一个设备。

Lets say, User A is logging in first time using the Android application and from next time,the app logs in automatically using the credentials stored in the local storage. 可以说,用户A首次使用Android应用程序登录,从下次开始,该应用程序将使用本地存储中存储的凭据自动登录。

If the same user is logging in with the web application with the same credentials and changed the password, the mobile application should force the user to login as soon as the password is changed.Even if the mobile application is being active and doing some tasks , it has to be cancelled and force user to login once again. 如果同一用户使用相同的凭据登录Web应用程序并更改了密码,则移动应用程序应在更改密码后立即强制用户登录。即使移动应用程序处于活动状态并正在执行某些任务,必须取消它,并迫使用户再次登录。

My idea was to use Push Notification in Mobile app to terminate the session as soon as the user has logged in/changed the password from web application. 我的想法是在用户从Web应用程序登录/更改密码后立即在移动应用程序中使用“推送通知”来终止会话。 But the bottle neck is that there is an option in device settings to block the notification. 但瓶颈在于,设备设置中有一个选项可以阻止通知。

Please help me to find a way to overcome this. 请帮助我找到克服此问题的方法。

There is NO option in devices to block Push Notifications. 有一个在设备没有选项来阻止推送通知。 But there is an option to stop an App from showing Notifications in the Device Notification Bar and also there is another option to stop an App from using Data (Internet) in the background (when not in use!). 但是,有一个选项可以阻止应用程序在设备通知栏中显示通知,并且还有另一个选项可以阻止应用程序在后台(不使用时!)在后台使用数据(Internet)。 This is a different case with your issue. 这与您的问题不同。

Here is how! 这是怎么回事! On your server send message to a user Device using Firebase . 在您的服务器上,使用Firebase向用户设备发送消息。 You should send Data Messages so as to gain full control and because you do not need to show any notification to a user device. 您应该发送数据消息,以便获得完全控制权,并且因为不需要向用户设备显示任何通知。 When that message reaches to the user. 该消息到达用户时。 You should Logout the user. 您应该注销用户。 Remember all this happens in the background the user does not notice anything or any notification shown.You can learn more about message types here . 请记住,所有这些都是在后台发生的,用户不会注意到任何内容或显示的任何通知。您可以在此处了解有关消息类型的更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android- Real设备比模拟器消耗更多的内存 - Android- Real device consumes more memory than emulator android - adb 不止一个设备/模拟器 - android - adb more than one device/emulator 如何限制安卓播放器同时播放多个媒体文件? - How to restrict android player from playing more than one media file parallely? 如何在 ItemList.Builder (Android- Auto) 中添加超过 6 个项目? - How to add more than 6 items in ItemList.Builder (Android- Auto)? 如何使用 java 在 android 工作室应用程序中由多个注册用户访问 Firebase Firestore 集合? - How to access Firebase Firestore collection by more than one registered users in android studio app using java? Android Firebase:防止在多个设备上共享帐户问题 - Android Firebase: Prevent the sharing of account on more than one device issue android-如何锁定设备(在android 1.6及更高版本中) - android- how to lock the device (in android 1.6+) Android-如何在特定用户下将图像上传到Firebase - Android- How to upload image to Firebase under specific users 如何在Android中实例化多个AsyncTask? - How to instantiate more than one AsyncTask in android? 如何将多个蓝牙音频设备与Android手机连接,一个设备应录音而另一设备应播放? - How to connect more than one Bluetooth audio devices with android phones, one device should record and other should play?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM