Skip to content

Commit

Permalink
Update MusicControlModule.java
Browse files Browse the repository at this point in the history
  • Loading branch information
hiennguyen92 authored Jun 18, 2020
1 parent dbbb160 commit ddc5bec
Showing 1 changed file with 4 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,25 +233,10 @@ public void onServiceConnected(ComponentName name, IBinder service)
MusicControlNotification.NotificationService.LocalBinder binder = (MusicControlNotification.NotificationService.LocalBinder) service;

// The getter method to acquire the service.
MusicControlNotification.NotificationService myService = binder.getService();

// getServiceIntent(context) returns the relative service intent
//Intent myIntent = new Intent(context, MusicControlNotification.NotificationService.class);
//if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// context.startForegroundService(myIntent);
//} else {
// context.startService(myIntent);
//}

// This is the key: Without waiting Android Framework to call this method
// inside Service.onCreate(), immediately call here to post the notification.
//if(MusicControlModule.INSTANCE.notification == null){
// init();
//}
//Notification notification = MusicControlModule.INSTANCE.notification.prepareNotification(MusicControlModule.INSTANCE.nb, false);
//myService.startForeground(NOTIFICATION_ID, notification);
if (myService != null) {
myService.forceForeground();
MusicControlNotification.NotificationService notificationService = binder.getService();

if (notificationService != null) {
notificationService.forceForeground();
}
// Release the connection to prevent leaks.
context.unbindService(this);
Expand Down

0 comments on commit ddc5bec

Please sign in to comment.