mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-04 01:09:47 +01:00
fix crash on some devices when creating a test notification in debug menu
This commit is contained in:
parent
a36885bcd5
commit
74f2b8c1c2
@ -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());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user