fix notification launching LocalRepoActivity

It was not working on my Nexus 7 running stock 4.4.2.  This seems to be the
recommend fix:
https://code.google.com/p/android/issues/detail?id=61850
This commit is contained in:
Hans-Christoph Steiner 2014-05-16 16:23:54 -04:00
parent d25a395936
commit 248cefe1f3
2 changed files with 7 additions and 5 deletions

View File

@ -35,8 +35,8 @@
<string name="system_installer_on">Use system permissions to install, update, and remove packages</string>
<string name="system_installer_off">Do not use system permissions to install, update, and remove packages</string>
<string name="local_repo_bonjour">Broadcast Local Repo</string>
<string name="local_repo_bonjour_on">Advertize your local repo using Bonjour (mDNS)</string>
<string name="local_repo_bonjour_off">Do not advertize your local repo.</string>
<string name="local_repo_bonjour_on">Advertise your local repo using Bonjour (mDNS)</string>
<string name="local_repo_bonjour_off">Do not advertise your local repo.</string>
<string name="search_results">Search Results</string>
<string name="app_details">App Details</string>

View File

@ -97,7 +97,8 @@ public class LocalRepoService extends Service {
// launch LocalRepoActivity if the user selects this notification
Intent intent = new Intent(this, LocalRepoActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, 0);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent,
PendingIntent.FLAG_CANCEL_CURRENT);
notification = new NotificationCompat.Builder(this)
.setContentTitle(getText(R.string.local_repo_running))
.setContentText(getText(R.string.touch_to_configure_local_repo))
@ -223,9 +224,10 @@ public class LocalRepoService extends Service {
localRepoBonjourChangeListener = null;
}
if (jmdns != null) {
if (pairService != null)
if (pairService != null) {
jmdns.unregisterService(pairService);
pairService = null;
pairService = null;
}
jmdns.unregisterAllServices();
try {
jmdns.close();