- fixed restart with null intent

- upgraded gradle version
This commit is contained in:
Juha Heinanen
2018-08-21 21:21:03 +03:00
parent 5ec6047fb1
commit 8a81fc48e0
3 changed files with 13 additions and 4 deletions
+1
View File
@@ -140,6 +140,7 @@
<action android:name="com.tutpro.baresip.Restart" /> <action android:name="com.tutpro.baresip.Restart" />
</intent-filter> </intent-filter>
</receiver> </receiver>
</application> </application>
</manifest> </manifest>
@@ -83,11 +83,19 @@ class BaresipService: Service() {
super.onCreate() super.onCreate()
} }
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int { override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
Log.d(LOG_TAG, "Received onStartCommand action ${intent.getAction()}") val action: String
when (intent.getAction()) { if (intent == null) {
action = "Start"
Log.d(LOG_TAG, "Received onStartCommand with null intent")
} else {
action = intent.getAction()
Log.d(LOG_TAG, "Received onStartCommand action $action")
}
when (action) {
"Start" -> { "Start" -> {
val pm = getSystemService(Context.POWER_SERVICE) as PowerManager val pm = getSystemService(Context.POWER_SERVICE) as PowerManager
+1 -1
View File
@@ -7,7 +7,7 @@ buildscript {
google() google()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.1.3' classpath 'com.android.tools.build:gradle:3.1.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong