6 Commits
Author SHA1 Message Date
Federico Dossena 35a9d96398 2nd gen Airpods support, bumped version to Alpha 8
2nd gen Airpods support, bumped version to Alpha 8
2019-07-24 15:58:23 +02:00
Federico Dossena 298ce85990 Merge pull request #18 from maxtauro/Gen2Support
Added support for gen 2 airpods
2019-07-24 15:57:23 +02:00
dosse91 18158d70b2 Fixed a typo 2019-07-24 13:53:44 +02:00
dosse91 0f74a0607e Updated README.md and screenshots 2019-07-19 07:02:55 +02:00
dosse91 3bd3ec74e7 Added initial gen2 support 2019-07-19 06:59:27 +02:00
maxwelltauro 5c39fb37f7 Added support for gen 2 airpods 2019-07-18 22:34:41 -04:00
9 changed files with 42 additions and 11 deletions
+2 -2
View File
@@ -6,8 +6,8 @@ android {
applicationId "com.dosse.airpods"
minSdkVersion 23
targetSdkVersion 28
versionCode 7
versionName '0.7'
versionCode 8
versionName '0.8'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
@@ -11,7 +11,10 @@ import android.bluetooth.BluetoothManager;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.le.BluetoothLeScanner;
import android.bluetooth.le.ScanCallback;
import android.bluetooth.le.ScanFilter;
import android.bluetooth.le.ScanFilter.Builder;
import android.bluetooth.le.ScanResult;
import android.bluetooth.le.ScanSettings;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -21,13 +24,13 @@ import android.os.Build;
import android.os.IBinder;
import android.os.ParcelUuid;
import android.os.SystemClock;
import android.provider.Settings;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import android.view.View;
import android.widget.RemoteViews;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* This is the class that does most of the work. It has 3 functions:
@@ -78,7 +81,20 @@ public class PodsService extends Service {
btScanner = btAdapter.getBluetoothLeScanner();
if (btAdapter == null) throw new Exception("No BT");
if (!btAdapter.isEnabled()) throw new Exception("BT Off");
btScanner.startScan(new ScanCallback() {
List<ScanFilter> filters = getScanFilters();
ScanSettings settings = new ScanSettings.Builder().setScanMode(2).setReportDelay(2).build();
btScanner.startScan(
filters,
settings,
new ScanCallback() {
@Override
public void onBatchScanResults(List<ScanResult> scanResults) {
for (ScanResult result : scanResults) onScanResult(-1, result);
super.onBatchScanResults(scanResults);
}
@Override
public void onScanResult(int callbackType, ScanResult result) {
try {
@@ -128,6 +144,21 @@ public class PodsService extends Service {
}
}
private List<ScanFilter> getScanFilters() {
byte[] manufacturerData = new byte[27];
byte[] manufacturerDataMask = new byte[27];
manufacturerData[0] = 7;
manufacturerData[1] = 25;
manufacturerDataMask[0] = -1;
manufacturerDataMask[1] = -1;
Builder builder = new Builder();
builder.setManufacturerData(76, manufacturerData, manufacturerDataMask);
return Collections.singletonList(builder.build());
}
private void stopAirPodsScanner(){
try{
if(btScanner!=null){
@@ -9,5 +9,5 @@
<string name="hideClicked">Das Icon wird bald verschwinden</string>
<string name="noBtText">Es sieht so aus als hätte dieses Gerät kein Bluetooth LE</string>
<string name="locationDisabledText">Du musst Standortinformationen aktivieren, damit OpenPods den Status deiner AirPods auslesen kann</string>
<string name="supportedDevices">Unterstützte Geräte:\n&#8226; Apple AirPods 1st gen</string>
<string name="supportedDevices">Unterstützte Geräte:\n&#8226; Apple AirPods 1st gen\n&#8226; Apple AirPods 2nd gen</string>
</resources>
@@ -8,6 +8,5 @@
<string name="hideClicked">El ícono desaparecerá pronto</string>
<string name="noBtText">Parece que este dispositivo no tiene Bluetooth LE</string>
<string name="locationDisabledText">Necesitas encender Localización para permitir que OpenPods lea el estado</string>
<string name="supportedDevices">Dispositivos compatibles:\n
&#8226; Apple AirPods 1st gen</string>
<string name="supportedDevices">Dispositivos compatibles:\n&#8226; Apple AirPods 1st gen\n&#8226; Apple AirPods 2nd gen</string>
</resources>
@@ -9,5 +9,5 @@
<string name="hideClicked">L\'icona sarà rimossa presto</string>
<string name="noBtText">Questo dispositivo non supporta Bluetooth LE</string>
<string name="locationDisabledText">Attiva la posizione per permttere a OpenPods di leggere lo stato</string>
<string name="supportedDevices">Dispositivi supportati:\n&#8226; Apple AirPods 1st gen</string>
<string name="supportedDevices">Dispositivi supportati:\n&#8226; Apple AirPods 1st gen\n&#8226; Apple AirPods 2nd gen</string>
</resources>
@@ -9,5 +9,5 @@
<string name="hideClicked">桌面图标很快就会隐藏掉</string>
<string name="noBtText">看起来您的设备并不支持蓝牙</string>
<string name="locationDisabledText">您需要开启定位来让 OpenPods 读取状态</string>
<string name="supportedDevices">支持的设备:\n&#8226; Apple AirPods 一代</string>
<string name="supportedDevices">支持的设备:\n&#8226; Apple AirPods 1st gen\n&#8226; Apple AirPods 2nd gen</string>
</resources>
+1 -1
View File
@@ -9,5 +9,5 @@
<string name="hideClicked">The icon will disappear soon</string>
<string name="noBtText">It looks like this device doesn\'t have Bluetooth LE</string>
<string name="locationDisabledText">You need to turn on Location to allow OpenPods to read the status</string>
<string name="supportedDevices">Supported devices:\n&#8226; Apple AirPods 1st gen</string>
<string name="supportedDevices">Supported devices:\n&#8226; Apple AirPods 1st gen\n&#8226; Apple AirPods 2nd gen</string>
</resources>
+1
View File
@@ -16,6 +16,7 @@ The project is currently in Alpha.
## Supported devices
* Apple AirPods 1st gen
* Apple AirPods 2nd gen
## Project status
Right now, this project should be considered in alpha state. It was not extensively tested, it may not be stable or work at all on your device.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 63 KiB