2015-01-03 15 views
12

私は現在、摩耗デバイスに表示されている通知付きのアプリを開発中です。この通知には、通知カード(.setContentAction(0))にバインドされたアクションが含まれています。アンドロイドウェアの保留中のインテントアクションの確認を無効にする

enter image description here

すべてが、それは毎回誰かがカードをクリックし、確認メッセージが表示されていることを除いて、正常に動作しています。

​​3210

カードは、すぐに誰かがそれをクリックすると更新されるので、確認を表示する必要はありません。

確認を中止する方法がある場合は、公式の文書(https://developer.android.com/training/wearables/ui/confirm.html#show-confirmation)を既に確認していますが、残念ながらこれまで解決策が見つかりませんでした。

編集2015年7月9日

NotificationCompat.Builder builder = new NotificationCompat.Builder(context) 
            .setGroup("GROUP") 
            .setGroupSummary(false) 
            .setAutoCancel(false) 
            .setPriority(Notification.PRIORITY_HIGH) 
            .setSmallIcon(R.drawable.ic_timer_white_48dp); 

ArrayList<NotificationCompat.Action> actions = new ArrayList<>(); 
NotificationCompat.Action control = new NotificationCompat.Action.Builder(icon, null, pendingTimeIntent).build(); 

actions.add(control); 

builder.extend(new NotificationCompat.WearableExtender().addActions(actions).setContentAction(0).setBackground(background)); 

NotificationManagerCompat notificationManager = 
      NotificationManagerCompat.from(context); 
notificationManager.notify(Constants.NOTIFICATION_ID_WEAR, builder.build()); 
+0

これにはどんな解決策がありましたか? – Debugger

+0

いいえ、そういうわけで私はバウンスを始めました。 – Lukas

+0

スタンドアロンウェアラブルアプリケーションはありますか?私は最近、SmartWatchアプリを開発しましたが、この問題はありませんでした。いくつかのコードを投稿できますか? – Blackbelt

答えて

0

あなたのようなあなたのコンストラクタを変更してみてください:

NotificationCompat.Builder builder = new NotificationCompat.Builder(context) 
            .setGroup("GROUP") 
            .setGroupSummary(false) 
            .setAutoCancel(false) 
            .setPriority(Notification.PRIORITY_HIGH) 
            .setShowWhen(true)                     
.setSmallIcon(R.drawable.ic_timer_white_48dp); 

注ライン:

.setShowWhen(true); 

そして、あなたはテントのフラグを変更することができますが偽へ:

Intent intent = new Intent(this, ConfirmationActivity.class); 
intent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE, 
       ConfirmationActivity.SUCCESS_ANIMATION); 
intent.putExtra(ConfirmationActivity.EXTRA_MESSAGE, 
       getString(R.string.msg_sent)); 
intent.putExtra(ConfirmationActivity.EXTRA_SHOW_WHEN, false); 
startActivity(intent); 

正常に動作するかどうかわかりませんが、手がかりを与えることを願っています。

+1

NotificationCompat.WearableExtender()。addActions(actions)は、NotificationCompat.Action型のアクションしか取らないので、これは機能しません。これはpendingintentsで動作します。保留中のインテントに余分なものを追加することはできません。 – Lukas

+0

これは機能しません。wearextenderの通知アクション保留中の意図セットは確認アクティビティの意図ではないため、この通知は着信アプリではなく電話アプリからトリガーされるため – Libin

関連する問題