带电话号码的Android模拟器

带电话号码的Android模拟器

本文介绍了带电话号码的Android模拟器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个客户端服务器Android应用程序,并试图弄清楚如何明确地向服务器识别不同的电话/用户.我的第一个尝试是使用SIM卡上的电话号码.尽管现在我已经考虑过了,但如今,例如换承运人?我猜这取决于国家/地区等.

I'm working on a client-server Android application and trying to figure out how to identify different phones/users to the server unambiguously. My first attempt would be to use the phone number on the SIM card. Although now that I think about it, how common is it these days that your phone number changes when you e.g. change carrier? I guess it depends from country to country etc.

无论如何,由于我没有实际的Android手机,因此我一直在尝试找出如何更改模拟器手机的电话号码以模拟不同的用户.我是否可能或者应该只考虑其他身份识别方式?

Anyway, I've been trying to figure out, since I don't have actual Android phones, how to change the phone number of the emulator phone to simulate different users. Is it possible or should I just think about alternative ways of identification?

推荐答案

android_id应该唯一地标识设备,但是,如果您知道欺骗android_id

The android_id is supposed to uniquely identify the device, however, it has been noted that the id can be changed if you know how Spoofing android_id

import android.provider.Settings.System;

String android_id = System.getString(this.getContentResolver(), System.ANDROID_ID);

在仿真器中,android_id没有值,因此您将需要放入调试例程来自己分配值.

In the emulator, the android_id does not have a value, so you will need to put a debugging routine in to assign a value yourself.

但是,如果要标识用户,并让该用户使用一个用户ID从不同的设备访问您的服务,最好给他们分配一个用户ID,并使用该用户ID作为其凭据来对您的服务进行身份验证.这样一来,他们可以在许多不同的设备上使用其ID,除非您将其与android_id结合使用(并且没有欺骗过android_id),则可以将它们限制为一台设备.

However, if you want to identify the user, and let the user access your service from different devices with one user id you are better off assigning them a user id and having them authenticate to your service using this user id as their credential. This would let them use their id's on many different devices, unless you used it in conjunction with the android_id (and the android_id wasn't spoofed) then you could limit them to one device.

这篇关于带电话号码的Android模拟器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 08:13