[Android] Set ActivityCbListener for ICS+ devices only

Geoffrey Métais git at videolan.org
Fri Sep 15 15:09:44 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Sep 15 14:52:31 2017 +0200| [c66953c33b6b9913e95d24aadfb4bba0a1b1671a] | committer: Geoffrey Métais

Set ActivityCbListener for ICS+ devices only

> https://code.videolan.org/videolan/vlc-android/commit/c66953c33b6b9913e95d24aadfb4bba0a1b1671a
---

 vlc-android/src/org/videolan/vlc/VLCApplication.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/VLCApplication.java b/vlc-android/src/org/videolan/vlc/VLCApplication.java
index 1c3ac87ee..6d4c360b1 100644
--- a/vlc-android/src/org/videolan/vlc/VLCApplication.java
+++ b/vlc-android/src/org/videolan/vlc/VLCApplication.java
@@ -115,6 +115,8 @@ public class VLCApplication extends Application {
         });
         if (sActivityCbListener != null)
             registerActivityLifecycleCallbacks(sActivityCbListener);
+        else
+            NetworkMonitor.register(instance);
     }
 
     @Override
@@ -288,7 +290,7 @@ public class VLCApplication extends Application {
     }
 
     private static int sActivitiesCount = 0;
-    private static ActivityLifecycleCallbacks sActivityCbListener = new ActivityLifecycleCallbacks() {
+    private static ActivityLifecycleCallbacks sActivityCbListener = AndroidUtil.isICSOrLater ? new ActivityLifecycleCallbacks() {
         @Override
         public void onActivityCreated(Activity activity, Bundle savedInstanceState) {}
 
@@ -315,5 +317,5 @@ public class VLCApplication extends Application {
 
         @Override
         public void onActivityDestroyed(Activity activity) {}
-    };
+    } : null;
 }



More information about the Android mailing list