notification channel

This commit is contained in:
Page Asgardius 2022-10-10 12:49:41 -07:00
parent d9cac31962
commit 5f63674799

View file

@ -4,6 +4,8 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.app.AppOpsManager; import android.app.AppOpsManager;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.app.PictureInPictureParams; import android.app.PictureInPictureParams;
import android.content.Context; import android.content.Context;
@ -71,6 +73,12 @@ public class VideoPlayer extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_player); setContentView(R.layout.activity_video_player);
if(Build.VERSION.SDK_INT >=Build.VERSION_CODES.O){
NotificationChannel channel= new NotificationChannel("playback","Test Notification",NotificationManager.IMPORTANCE_DEFAULT);
NotificationManager manager =getSystemService(NotificationManager.class);
manager.createNotificationChannel(channel);
}
appOpsManager = (AppOpsManager)getSystemService(Context.APP_OPS_SERVICE); appOpsManager = (AppOpsManager)getSystemService(Context.APP_OPS_SERVICE);
mediaSession = new MediaSessionCompat(this, getPackageName()); mediaSession = new MediaSessionCompat(this, getPackageName());
mediaSessionConnector = new MediaSessionConnector(mediaSession); mediaSessionConnector = new MediaSessionConnector(mediaSession);