示例#1
0
 public void setAsForeground() {
   PendingIntent pi =
       PendingIntent.getActivity(
           getApplicationContext(),
           0,
           new Intent(getApplicationContext(), AudioActivity.class),
           PendingIntent.FLAG_UPDATE_CURRENT);
   NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
   Notification notification =
       builder
           .setSmallIcon(R.drawable.defaultpic)
           .setContentTitle("Regaplay")
           .setContentText(MediaStoreHelper.getSong(songId).getTitle())
           .setAutoCancel(true)
           .build();
   startForeground(0, notification);
 }
示例#2
0
  public void addSong(Long id) {
    if (id != null) {

      songsList.add(songsList.size(), MediaStoreHelper.getSong(id));
    }
  }