mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 07:13:00 +00:00 
			
		
		
		
	sync so I can clone this branch on another machine
This commit is contained in:
		| @@ -2,6 +2,7 @@ package org.schabi.newpipe; | ||||
|  | ||||
| import android.app.Notification; | ||||
| import android.app.NotificationManager; | ||||
| import android.app.PendingIntent; | ||||
| import android.app.Service; | ||||
| import android.content.Context; | ||||
| import android.content.Intent; | ||||
| @@ -50,6 +51,8 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare | ||||
|  | ||||
|     @Override | ||||
|     public void onCreate() { | ||||
|         PendingIntent pi = PendingIntent.getActivity(this, 0, | ||||
|                 new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); | ||||
|         super.onCreate(); | ||||
|     } | ||||
|     @Override | ||||
| @@ -124,7 +127,20 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare | ||||
|             }*/ | ||||
|             wifiLock.acquire(); | ||||
|             mediaPlayer.start(); | ||||
|  | ||||
| /* | ||||
|         1. For each button in the notification, create an Intent pointing to the handling class | ||||
|         2. From this, create a corresponding PendingIntent. | ||||
|         3. Then, for each button, call NotificationBuilder.addAction(). | ||||
|             the exact method signature will depend on whether you just specify the icon,label etc (deprecated), | ||||
|             or if you also have to create a Notification.Action (and Notification.Action.Builder). | ||||
|             in any case, in the class referred to in the explicit intent, | ||||
|         4. Write the method body of whatever callback android says to use for a service. | ||||
|             Probably onStartCommand. But isn't that only called when startService() is? and | ||||
|             we need to call this whenever a notification button is pressed! we don't want to restart | ||||
|             the service every time the button is pressed! Oh I don't know yet.... | ||||
|             see: http://www.vogella.com/tutorials/AndroidNotifications/article.html | ||||
|             and maybe also: http://stackoverflow.com/questions/10613524 | ||||
| */ | ||||
|             //mediaPlayer.getCurrentPosition() | ||||
|             int vidLength = mediaPlayer.getDuration(); | ||||
|     //todo: make it so that tapping the notification brings you back to the Video's DetailActivity | ||||
|   | ||||
| @@ -30,6 +30,6 @@ public interface StreamingService { | ||||
|  | ||||
|     /**When a VIEW_ACTION is caught this function will test if the url delivered within the calling | ||||
|     Intent was meant to be watched with this Service. | ||||
|     Return false if this service shall not allow to be callean through ACTIONs.*/ | ||||
|     Return false if this service shall not allow to be called through ACTIONs.*/ | ||||
|     boolean acceptUrl(String videoUrl); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Adam Howard
					Adam Howard