mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
fix crash on some devices when creating a test notification in debug menu
This commit is contained in:
+7
-2
@@ -209,7 +209,13 @@ public class BluetoothCommunicationService extends Service {
|
|||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
|
|
||||||
|
if (intent == null) {
|
||||||
|
Log.i(TAG, "no intent");
|
||||||
|
return START_NOT_STICKY;
|
||||||
|
}
|
||||||
|
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
|
|
||||||
if (action == null) {
|
if (action == null) {
|
||||||
Log.i(TAG, "no action");
|
Log.i(TAG, "no action");
|
||||||
return START_NOT_STICKY;
|
return START_NOT_STICKY;
|
||||||
@@ -260,8 +266,7 @@ public class BluetoothCommunicationService extends Service {
|
|||||||
deviceType = GBDevice.Type.MIBAND;
|
deviceType = GBDevice.Type.MIBAND;
|
||||||
mGBDeviceProtocol = new MibandProtocol();
|
mGBDeviceProtocol = new MibandProtocol();
|
||||||
mGBDeviceIoThread = new MibandIoThread(btDeviceAddress);
|
mGBDeviceIoThread = new MibandIoThread(btDeviceAddress);
|
||||||
}
|
} else if (btDevice.getName().indexOf("Pebble") == 0) {
|
||||||
else if (btDevice.getName().indexOf("Pebble") == 0) {
|
|
||||||
deviceType = GBDevice.Type.PEBBLE;
|
deviceType = GBDevice.Type.PEBBLE;
|
||||||
mGBDeviceProtocol = new PebbleProtocol();
|
mGBDeviceProtocol = new PebbleProtocol();
|
||||||
mGBDeviceIoThread = new PebbleIoThread(btDeviceAddress);
|
mGBDeviceIoThread = new PebbleIoThread(btDeviceAddress);
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ public class DebugActivity extends Activity {
|
|||||||
ncomp.setContentTitle("Test Notification");
|
ncomp.setContentTitle("Test Notification");
|
||||||
ncomp.setContentText("This is a Test Notification from Gadgetbridge");
|
ncomp.setContentText("This is a Test Notification from Gadgetbridge");
|
||||||
ncomp.setTicker("This is a Test Notification from Gadgetbridge");
|
ncomp.setTicker("This is a Test Notification from Gadgetbridge");
|
||||||
ncomp.setSmallIcon(R.drawable.ic_launcher);
|
ncomp.setSmallIcon(R.drawable.ic_notification);
|
||||||
ncomp.setAutoCancel(true);
|
ncomp.setAutoCancel(true);
|
||||||
nManager.notify((int) System.currentTimeMillis(), ncomp.build());
|
nManager.notify((int) System.currentTimeMillis(), ncomp.build());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user