Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android emulators with phone numbers?

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.

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?

like image 826
Janne Avatar asked Apr 14 '09 06:04

Janne


2 Answers

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);

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.

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.

like image 112
dar Avatar answered Sep 22 '22 04:09

dar


You should use the number present by the emulator. Eg. usually first emulator that is running has number 5554, second 5555, and so on.

You can use these numbers to make calls, send text messages from emulator to emulator. This, I think, simulates different numbers/users for your purposes.

like image 25
Marcin Gil Avatar answered Sep 19 '22 04:09

Marcin Gil