11 Commits
Author SHA1 Message Date
adolfintel 6c65cb36f9 Release Alpha 6 2019-04-12 19:38:58 +02:00
Federico Dossena 24963be8bd Merge pull request #12 from nichbar/master
Add chinese translation
2019-04-12 19:35:10 +02:00
nich 5a82530057 Add chinese translation 2019-04-12 22:24:58 +08:00
Federico Dossena d6d8b3a586 Merge pull request #11 from jplitza/metadata
Move screenshots to fastlane location
2019-04-12 07:11:23 +02:00
Jan-Philipp Litza ae4f6ea1af Move screenshots to fastlane location
This will make F-Droid find and display them.

References:
https://staging.f-droid.org/en/docs/All_About_Descriptions_Graphics_and_Screenshots/
https://docs.fastlane.tools/actions/supply/#images-and-screenshots
2019-04-11 20:09:15 +02:00
Federico Dossena f771481a2d Merge pull request #10 from jplitza/german
Add German translation
2019-04-11 19:41:32 +02:00
Jan-Philipp Litza 44580f2f2a Add German translation 2019-04-11 19:27:05 +02:00
adolfintel c043ade2d9 Added possible workaround for #7. More testing required 2019-04-07 10:07:51 +02:00
adolfintel 4138d440b2 Release Alpha 5 2019-03-29 19:20:25 +01:00
adolfintel dcd886c84b Added more debug logging 2019-03-28 07:36:29 +01:00
adolfintel 9248bdcf96 Improved event handling and filtering (hopefully) 2019-03-27 20:05:07 +01:00
10 changed files with 71 additions and 12 deletions
+2 -2
View File
@@ -6,8 +6,8 @@ android {
applicationId "com.dosse.airpods" applicationId "com.dosse.airpods"
minSdkVersion 23 minSdkVersion 23
targetSdkVersion 28 targetSdkVersion 28
versionCode 4 versionCode 6
versionName '0.4' versionName '0.6'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {
@@ -6,7 +6,9 @@ import android.app.NotificationManager;
import android.app.Service; import android.app.Service;
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothHeadset;
import android.bluetooth.BluetoothManager; import android.bluetooth.BluetoothManager;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.le.BluetoothLeScanner; import android.bluetooth.le.BluetoothLeScanner;
import android.bluetooth.le.ScanCallback; import android.bluetooth.le.ScanCallback;
import android.bluetooth.le.ScanResult; import android.bluetooth.le.ScanResult;
@@ -53,7 +55,7 @@ public class PodsService extends Service {
* What we did to workaround this issue is this: * What we did to workaround this issue is this:
* - When a beacon arrives that looks like a pair of AirPods, look at the other beacons received in the last 10 seconds and get the strongest one * - When a beacon arrives that looks like a pair of AirPods, look at the other beacons received in the last 10 seconds and get the strongest one
* - If the strongest beacon's fake address is the same as this, use this beacon; otherwise use the strongest beacon * - If the strongest beacon's fake address is the same as this, use this beacon; otherwise use the strongest beacon
* - Filter for signals stronger than -70db * - Filter for signals stronger than -60db
* - Decode... * - Decode...
* *
* Decoding the beacon: * Decoding the beacon:
@@ -83,6 +85,8 @@ public class PodsService extends Service {
byte[] data = result.getScanRecord().getManufacturerSpecificData(76); byte[] data = result.getScanRecord().getManufacturerSpecificData(76);
if (data == null||data.length!=27) return; if (data == null||data.length!=27) return;
recentBeacons.add(result); recentBeacons.add(result);
if(ENABLE_LOGGING) Log.d(TAG,""+result.getRssi()+"db");
if(ENABLE_LOGGING) Log.d(TAG, decodeHex(data));
ScanResult strongestBeacon=null; ScanResult strongestBeacon=null;
for(int i=0;i<recentBeacons.size();i++){ for(int i=0;i<recentBeacons.size();i++){
if(SystemClock.elapsedRealtimeNanos()-recentBeacons.get(i).getTimestampNanos()>RECENT_BEACONS_MAX_T_NS){ if(SystemClock.elapsedRealtimeNanos()-recentBeacons.get(i).getTimestampNanos()>RECENT_BEACONS_MAX_T_NS){
@@ -93,7 +97,7 @@ public class PodsService extends Service {
} }
if(strongestBeacon!=null&&strongestBeacon.getDevice().getAddress().equals(result.getDevice().getAddress())) strongestBeacon=result; if(strongestBeacon!=null&&strongestBeacon.getDevice().getAddress().equals(result.getDevice().getAddress())) strongestBeacon=result;
result=strongestBeacon; result=strongestBeacon;
if(result.getRssi()<-70) return; if(result.getRssi()<-60) return;
String a=decodeHex(result.getScanRecord().getManufacturerSpecificData(76)); String a=decodeHex(result.getScanRecord().getManufacturerSpecificData(76));
String str = ""; //left airpod (0-10 batt; 15=disconnected) String str = ""; //left airpod (0-10 batt; 15=disconnected)
String str2 = ""; //right airpod (0-10 batt; 15=disconnected) String str2 = ""; //right airpod (0-10 batt; 15=disconnected)
@@ -163,7 +167,7 @@ public class PodsService extends Service {
private static final String TAG="AirPods"; private static final String TAG="AirPods";
private static long lastSeenConnected=0; private static long lastSeenConnected=0;
private static final long TIMEOUT_CONNECTED=30000; private static final long TIMEOUT_CONNECTED=30000;
private static boolean maybeConnected =true; private static boolean maybeConnected =false;
private class NotificationThread extends Thread{ private class NotificationThread extends Thread{
private boolean isLocationEnabled(){ private boolean isLocationEnabled(){
LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE); LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE);
@@ -199,9 +203,9 @@ public class PodsService extends Service {
if(notificationShowing){ if(notificationShowing){
if(ENABLE_LOGGING) Log.d(TAG,"Removing notification"); if(ENABLE_LOGGING) Log.d(TAG,"Removing notification");
notificationShowing=false; notificationShowing=false;
mNotifyManager.cancel(1);
continue; continue;
} }
mNotifyManager.cancel(1);
} }
if(isLocationEnabled()) { if(isLocationEnabled()) {
mBuilder.setCustomContentView(notificationSmall); mBuilder.setCustomContentView(notificationSmall);
@@ -294,11 +298,13 @@ public class PodsService extends Service {
if(action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)){ if(action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)){
int state= intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR); int state= intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
if(state==BluetoothAdapter.STATE_OFF||state==BluetoothAdapter.STATE_TURNING_OFF){ //bluetooth turned off, stop scanner and remove notification if(state==BluetoothAdapter.STATE_OFF||state==BluetoothAdapter.STATE_TURNING_OFF){ //bluetooth turned off, stop scanner and remove notification
if(ENABLE_LOGGING) Log.d(TAG,"BT OFF");
maybeConnected =false; maybeConnected =false;
stopAirPodsScanner(); stopAirPodsScanner();
recentBeacons.clear(); recentBeacons.clear();
} }
if(state==BluetoothAdapter.STATE_ON){ //bluetooth turned on, start/restart scanner if(state==BluetoothAdapter.STATE_ON){ //bluetooth turned on, start/restart scanner
if(ENABLE_LOGGING) Log.d(TAG,"BT ON");
startAirPodsScanner(); startAirPodsScanner();
} }
} }
@@ -321,7 +327,34 @@ public class PodsService extends Service {
try{ try{
registerReceiver(btReceiver,intentFilter); registerReceiver(btReceiver,intentFilter);
}catch(Throwable t){} }catch(Throwable t){}
if(((BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter().isEnabled())startAirPodsScanner(); //if BT is already on when the app is started, start the scanner without waiting for an event to happen //this BT Profile Proxy allows us to know if airpods are already connected when the app is started. It also fires an event when BT is turned off, in case the BroadcastReceiver doesn't do its job
BluetoothAdapter ba=((BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter();
ba.getProfileProxy(getApplicationContext(), new BluetoothProfile.ServiceListener() {
@Override
public void onServiceConnected(int i, BluetoothProfile bluetoothProfile) {
if(i==BluetoothProfile.HEADSET){
if(ENABLE_LOGGING) Log.d(TAG,"BT PROXY SERVICE CONNECTED");
BluetoothHeadset h=(BluetoothHeadset)bluetoothProfile;
for(BluetoothDevice d:h.getConnectedDevices()){
if(checkUUID(d)){
if(ENABLE_LOGGING) Log.d(TAG,"BT PROXY: AIRPODS ALREADY CONNECTED");
maybeConnected=true;
break;
}
}
}
}
@Override
public void onServiceDisconnected(int i) {
if(i==BluetoothProfile.HEADSET){
if(ENABLE_LOGGING) Log.d(TAG,"BT PROXY SERVICE DISCONNECTED ");
maybeConnected=false;
}
}
},BluetoothProfile.HEADSET);
if(ba.isEnabled())startAirPodsScanner(); //if BT is already on when the app is started, start the scanner without waiting for an event to happen
} }
private boolean checkUUID(BluetoothDevice bluetoothDevice){ private boolean checkUUID(BluetoothDevice bluetoothDevice){
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="intro1">Diese App erlaubt es dir, den Status deiner AirPods auf einem beliebigen Android-Gerät zu überprüfen</string>
<string name="intro2">Um zu funktionieren, benötigen wir die Berechtigungen um Bluetooth LE (Standort) zu benutzen und im Hintergrund zu laufen</string>
<string name="introAllow">Erlauben</string>
<string name="main1">Die App zeigt eine Benachrichtigung wenn deine AirPods verbunden sind</string>
<string name="main2">Du kannst die App jetzt verstecken wenn du möchtest</string>
<string name="mainHide">App verstecken</string>
<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>
</resources>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="intro1">此应用可以让您在任何安卓设备上查看 AirPods 的状态</string>
<string name="intro2">我们需要蓝牙、定位以及在后台运行的权限来正常运作</string>
<string name="introAllow">允许</string>
<string name="main1">当您的 AirPods 接入时,我们会在通知栏显示通知</string>
<string name="main2">您可以隐藏此应用</string>
<string name="mainHide">隐藏</string>
<string name="hideClicked">桌面图标很快就会隐藏掉</string>
<string name="noBtText">看起来您的设备并不支持蓝牙</string>
<string name="locationDisabledText">您需要开启定位来让 OpenPods 读取状态</string>
<string name="supportedDevices">支持的设备:\n&#8226; Apple AirPods 一代</string>
</resources>
+5 -5
View File
@@ -1,4 +1,4 @@
![OpenPods Logo](https://github.com/adolfintel/OpenPods/blob/master/.github/logo.png?raw=true) ![OpenPods Logo](fastlane/metadata/android/en-US/images/featureGraphic.png)
# OpenPods # OpenPods
The Free and Open Source app for monitoring your AirPods on Android The Free and Open Source app for monitoring your AirPods on Android
@@ -26,10 +26,10 @@ Right now, this project should be considered in alpha state. It was not extensiv
[Donate with PayPal](https://www.paypal.me/sineisochronic) [Donate with PayPal](https://www.paypal.me/sineisochronic)
## Screenshots ## Screenshots
![Screenshot: notification](https://github.com/adolfintel/OpenPods/blob/master/.github/screen1.png?raw=true) ![Screenshot: notification](fastlane/metadata/android/en-US/images/phoneScreenshots/screen1.png)
![Screenshot: notification](https://github.com/adolfintel/OpenPods/blob/master/.github/screen2.png?raw=true) ![Screenshot: notification](fastlane/metadata/android/en-US/images/phoneScreenshots/screen2.png)
![Screenshot: permissions](https://github.com/adolfintel/OpenPods/blob/master/.github/screen3.png?raw=true) ![Screenshot: permissions](fastlane/metadata/android/en-US/images/phoneScreenshots/screen3.png)
![Screenshot: main app](https://github.com/adolfintel/OpenPods/blob/master/.github/screen4.png?raw=true) ![Screenshot: main app](fastlane/metadata/android/en-US/images/phoneScreenshots/screen4.png)
## License ## License
Copyright (C) 2019 Federico Dossena Copyright (C) 2019 Federico Dossena

Before

Width:  |  Height:  |  Size: 111 KiB

After

Width:  |  Height:  |  Size: 111 KiB

Before

Width:  |  Height:  |  Size: 815 KiB

After

Width:  |  Height:  |  Size: 815 KiB

Before

Width:  |  Height:  |  Size: 994 KiB

After

Width:  |  Height:  |  Size: 994 KiB

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB