Skip to content

Commit

Permalink
Resume service after updating
Browse files Browse the repository at this point in the history
  • Loading branch information
nkming2 committed Nov 4, 2018
1 parent e59f82a commit 62e87bb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,11 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

<receiver android:name=".UpgradeReceiver">
<intent-filter>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
</application>
</manifest>
25 changes: 25 additions & 0 deletions src/main/kotlin/com/nkming/powermenu/UpgradeReceiver.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.nkming.powermenu

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent

class UpgradeReceiver: BroadcastReceiver()
{
companion object
{
private val LOG_TAG = UpgradeReceiver::class.java.canonicalName
}

override fun onReceive(context: Context, intent: Intent?)
{
if (intent?.action != Intent.ACTION_MY_PACKAGE_REPLACED)
{
return
}
Log.i("$LOG_TAG.onReceive", "Package upgraded")

PersistentViewHelper.startIfNecessary(context)
SystemOverrideService.startIfNecessary(context)
}
}

0 comments on commit 62e87bb

Please sign in to comment.