[Android] Get proper intent to launch VLC

Geoffrey Métais git at videolan.org
Fri Aug 21 16:57:59 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Aug 21 16:53:41 2015 +0200| [49e982f02143bfca563608ebacb83b55d9e081f0] | committer: Geoffrey Métais

Get proper intent to launch VLC

Whether it's a TV or Vanilla build

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=49e982f02143bfca563608ebacb83b55d9e081f0
---

 vlc-android/src/org/videolan/vlc/PlaybackService.java |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index b2164fb..d29250e 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -503,9 +503,7 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
              * Launch the activity if needed
              */
             if (action.startsWith(ACTION_REMOTE_GENERIC) && !mMediaPlayer.isPlaying() && !hasCurrentMedia()) {
-                Intent iVlc = new Intent(context, MainActivity.class);
-                iVlc.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
-                context.startActivity(iVlc);
+                context.startActivity(getPackageManager().getLaunchIntentForPackage(getPackageName()));
             }
 
             /*
@@ -876,7 +874,8 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
                 pendingIntent = PendingIntent.getBroadcast(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
             } else {
                 /* Resume AudioPlayerActivity */
-                final Intent notificationIntent = new Intent(PlaybackService.this, MainActivity.class);
+
+                final Intent notificationIntent = getPackageManager().getLaunchIntentForPackage(getPackageName());
                 notificationIntent.setAction(AudioPlayerContainerActivity.ACTION_SHOW_PLAYER);
                 notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);
                 pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);



More information about the Android mailing list