New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check for BT Permission in SdlRouterService.onCreate() #405
Conversation
askirk
commented
Jan 25, 2017
•
edited
edited
- To resolve issue Process does not have BLUETOOTH permission: java.lang.SecurityException #376
- this may contribute to NPE in SdlRouterService.bluetoothAvailable() : BluetoothAdapter.getDefaultAdapter().isEnabled() call #378
- We just stop the service if permission isn't there, any further handling will be done at a future time
Checking in onCreate()
@@ -53,6 +54,7 @@ | |||
import android.os.Parcel; | |||
import android.os.Parcelable; | |||
import android.os.RemoteException; | |||
import android.support.v4.content.ContextCompat; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want to use any of the support libraries. That would force our developers to use the same support library. I suggest trying to use the normal context method if android version is 23+, or fully qualified contextcompat with a try catch
@@ -783,6 +785,11 @@ public void onCreate() { | |||
stopSelf(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section is getting a bit large and should be moved to a single function with a name like initCheck() that returns a boolean if the checks passed.
-Still need to find a way to use ContextCompat without importing support library
build.gradle
Outdated
@@ -13,7 +13,7 @@ dependencies { | |||
} | |||
|
|||
android { | |||
compileSdkVersion 18 | |||
compileSdkVersion 23 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't up the compile version with approval from the SDLC
@@ -851,6 +875,8 @@ public void startUpSequence(){ | |||
|
|||
@Override | |||
public int onStartCommand(Intent intent, int flags, int startId) { | |||
if(!initPassed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please include brackets around this if statement
Brackets around IF