From 070c6db5ed83e7e95d9126df54800a9c7930ef7c Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Fri, 23 Jan 2015 11:32:58 +0100 Subject: [PATCH] Resolve caller names by phone number before sending to Pebble --- app/src/main/AndroidManifest.xml | 2 ++ .../BluetoothCommunicationService.java | 36 ++++++++++++++++++- .../gadgetbridge/PhoneCallReceiver.java | 1 + 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 843efd562..80ee36ac1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -4,6 +4,8 @@ + + 0) { + contactLookup.moveToNext(); + name = contactLookup.getString(contactLookup.getColumnIndex(ContactsContract.Data.DISPLAY_NAME)); + } + } finally { + if (contactLookup != null) { + contactLookup.close(); + } + } + + return name; + } + + private class BtSocketAcceptThread extends Thread { private final BluetoothServerSocket mmServerSocket; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/PhoneCallReceiver.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/PhoneCallReceiver.java index 769ae5ae7..3244e801d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/PhoneCallReceiver.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/PhoneCallReceiver.java @@ -26,4 +26,5 @@ public class PhoneCallReceiver extends BroadcastReceiver { context.startService(startIntent); } } + }