[ACCEPTED]-Do Android devices have a static IP address?-ip

Accepted answer
Score: 14

This depends entirely on what they are connected 5 to. By default, no. Most Android devices 4 are configured for DHCP for wireless networks 3 and I don't know of any carriers that assign 2 static IP addresses to mobile devices on 1 their data networks.

Score: 9

As other people have already answered, no, mobile 7 devices generally don't have a static IP 6 address and instead use DHCP to get a dynamic 5 IP address.

However, to answer your base 4 question, you can generate a unique token 3 for the user using the java.util.UUID class. Save this generated 2 token to your app's SharedPreferences and 1 you can use it to identify your users:

public static String getDeviceUuid(Context context) {
    final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);

    // Attempt to get an existing device uuid
    String uuid = preferences.getString("device_uuid_key", "");
    if (TextUtils.isEmpty(uuid)) {
        // We don't have a device id, generate one!
        uuid = UUID.randomUUID().toString();

        // Persist the new id to shared preferences
        final Editor editor = preferences.edit();
        editor.putString("device_uuid_key", uuid);
    return uuid;
Score: 6

An Android device can both be connected 3 via WiFi, and 3G, which obviously has different 2 IPs.
The IP address on 3G will also change 1 every time it reconnects.

Score: 1

The mobile operators uses DHCP (Dynamic 5 Host Configuration Protocol) is an application 4 layer protocol which is used to assign an 3 IP address to the devices which are connected 2 to its network newly and also assigns reusable 1 IP addresses to the mobile devices.

More Related questions