Skip to content

Commit f1e5a2d

Browse files
committed
Move exception handler set to start of oncreate
1 parent 9abcf88 commit f1e5a2d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,9 @@ private boolean initCheck(){
11071107
@Override
11081108
public void onCreate() {
11091109
super.onCreate();
1110-
//This must be done regardless of if this service shuts down or not
1110+
//Add this first to avoid the runtime exceptions for the entire lifecycle of the service
1111+
setRouterServiceExceptionHandler();
1112+
//This must be done regardless of if this service shuts down or not
11111113
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
11121114
hasCalledStartForeground = false;
11131115
enterForeground("Waiting for connection...", FOREGROUND_TIMEOUT/1000, false);
@@ -1179,8 +1181,6 @@ protected void deployNextRouterService(){
11791181

11801182
public void startUpSequence(){
11811183

1182-
setRouterServiceExceptionHandler();
1183-
11841184
IntentFilter disconnectFilter = new IntentFilter();
11851185
disconnectFilter.addAction(BluetoothDevice.ACTION_CLASS_CHANGED);
11861186
disconnectFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);

0 commit comments

Comments
 (0)