fix crash on some devices when creating a test notification in debug menu

This commit is contained in:
Andreas Shimokawa 2015-04-03 22:39:25 +02:00
parent a36885bcd5
commit 74f2b8c1c2
2 changed files with 8 additions and 3 deletions

View File

@ -209,7 +209,13 @@ public class BluetoothCommunicationService extends Service {
@Override
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();
if (action == null) {
Log.i(TAG, "no action");
return START_NOT_STICKY;
@ -260,8 +266,7 @@ public class BluetoothCommunicationService extends Service {
deviceType = GBDevice.Type.MIBAND;
mGBDeviceProtocol = new MibandProtocol();
mGBDeviceIoThread = new MibandIoThread(btDeviceAddress);
}
else if (btDevice.getName().indexOf("Pebble") == 0) {
} else if (btDevice.getName().indexOf("Pebble") == 0) {
deviceType = GBDevice.Type.PEBBLE;
mGBDeviceProtocol = new PebbleProtocol();
mGBDeviceIoThread = new PebbleIoThread(btDeviceAddress);

View File

@ -151,7 +151,7 @@ public class DebugActivity extends Activity {
ncomp.setContentTitle("Test Notification");
ncomp.setContentText("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);
nManager.notify((int) System.currentTimeMillis(), ncomp.build());
}