2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-31 14:15:14 +00:00

Using Settings.Secure.ANDROID_ID instead of TelephonyManager.getDeviceId as deviceId because id didn't work on devices without SIM card

This commit is contained in:
Albert Vaca
2013-08-08 18:45:55 +02:00
parent 93288e9e54
commit 4d6c741bf1

View File

@@ -2,6 +2,7 @@ package org.kde.connect;
import android.content.Context;
import android.os.Build;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.util.Log;
@@ -131,9 +132,9 @@ public class NetworkPackage {
NetworkPackage np = new NetworkPackage(NetworkPackage.PACKAGE_TYPE_IDENTITY);
final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
String deviceId = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
try {
np.mBody.put("deviceId",tm.getDeviceId());
np.mBody.put("deviceId", deviceId);
np.mBody.put("deviceName", Build.BRAND + " " + Build.MODEL);
} catch (JSONException e) {
}