1

私はAndroidのNougatで元の音楽プレーヤーを使用しています。音楽はロック画面で再生されていますが、このスクリーンショットのようにButtomでアニメーションが表示されます。Android Nougat Media Playerのロックアニメーションはどのようにロック画面に表示されますか?

enter image description here

しかし、私はロック画面に同じAndroidのヌガーと同じデバイスで自分のApp Media Playerを使用しているアニメーションを表示さいけません。

enter image description here

質問は:どのように私は私のメディアプレーヤーアプリケーションでそのアニメーションを追加することができますか?アニメーションは音楽のリズムに移動するため、gif画像ではありません。

**これは私の通知方法です** **もし私が何かを見逃している、または何かを追加しなければならない場合。

ublic void Custom_Notificacion(){ 

    Notification notification = new Notification(R.drawable.logobubble, null, System.currentTimeMillis()); 

    notificationView = new RemoteViews(getPackageName(), R.layout.layout_notificacion_personalizada); 

    notificationView.setImageViewBitmap(R.id.id_FotoAlbumNotif,FotoNotif); 
    notificationView.setTextViewText(R.id.id_NombreMp3Notif,NommbreArtista); 
    notificationView.setTextViewText(R.id.id_NombreCancionNotif,NombreCancion); 

    notification.contentView = notificationView; 
    notification.flags |= Notification.FLAG_NO_CLEAR; 

    startForeground(constantes.NOTIFICATION_ID.FOREGROUND_SERVICE,notification); 

} 

答えて

1

私はこの記事を読んだが、実現可能な解決策は、カスタムロック画面のページで、あなたがLOCK_SCREEN放送、スタートを聞いてサービスを必要とし、これを達成するために、その中にアニメーションのビューを表示しますLockScreenActivity;システムロック画面を同時に交換してください。ここ は、いくつかのコードセグメントは役立つかもしれないです:メソッドを受け取る

private BroadcastReceiver mScreenOffReceiver = new BroadcastReceiver() { 
@SuppressWarnings("deprecation") 
@Override 
public void onReceive(Context context, Intent intent) { 
    if (intent.getAction().equals(NOTIFY_SCREEN_OFF)) { 
     Intent mLockIntent = new Intent(context, LockScreenActivity.class); 
     mLockIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK 
       | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); 
     startActivity(mLockIntent); 
    } 
} 

ロック画面を無効にし

KeyguardManager mKeyguardManager = (KeyguardManager)getSystemService(Context.KEYGUARD_SERVICE); 
KeyguardManager.KeyguardLock mKeyguardLock = mKeyguardManager.newKeyguardLock("CustomLockScreen"); 
mKeyguardLock.disableKeyguard(); 

登録ブロードキャストレシーバー

IntentFilter mScreenOffFilter = new IntentFilter(); 
mScreenOffFilter.addAction(Intent.ACTION_SCREEN_OFF); 
registerReceiver(mScreenOffReceiver, mScreenOffFilter); 

//・ホープ、この少し助けになるかもしれない

+0

私はあなたのanwserのおかげでこれを試してみます。 –

関連する問題