用不同的电话号码运行几款Android模拟器 [英] Running several Android emulators with different phone numbers

查看:165
本文介绍了用不同的电话号码运行几款Android模拟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第一次的海报这里。

我工作的一个客户端 - 服务器的Andr​​oid应用程序,并试图找出如何识别不同的手机/用户到服务器明确。我第一次尝试将使用的电话号码的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.

不管怎样,我一直试图弄清楚,因为我没有实际的Andr​​oid手机,如何改变仿真器的手机的电话号码,以模拟不同的用户。是否有可能或者我应该只是想想鉴定替代办法?

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模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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