ปุ่ม/การกระทำไม่ปรากฏในการแจ้งเตือน Wear

ฉันกำลังพยายามสร้างแอปพลิเคชัน Android ที่ส่งการแจ้งเตือนไปยังอุปกรณ์ Android Wear

การแจ้งเตือนจำเป็นต้องมีชุดการดำเนินการด้านเนื้อหา เพื่อให้ผู้ใช้สามารถเปิดใช้งานการดำเนินการได้โดยตรงโดยคลิกที่ปุ่มที่แสดงในการแจ้งเตือน

อย่างไรก็ตาม เมื่อใช้โค้ดด้านล่าง การดำเนินการจะปรากฏในหน้าถัดไป เช่นเดียวกับการดำเนินการปกติ และจะไม่ปรากฏในการแจ้งเตือน:

Context context = getApplicationContext();

// Create an intent for the reply action
Intent actionIntent = new Intent(this, getClass());

PendingIntent actionPendingIntent =
        PendingIntent.getActivity(this, 0, actionIntent,
                PendingIntent.FLAG_UPDATE_CURRENT);

// Create the action
NotificationCompat.Action action =
        new NotificationCompat.Action.Builder(R.drawable.common_signin_btn_icon_dark, "ActionTitle", actionPendingIntent).build();

NotificationCompat.Builder builder =
        new NotificationCompat.Builder(context)
                .setSmallIcon(R.drawable.common_signin_btn_icon_dark)
                .setContentTitle("Title")
                .setContentText("Context Text")
                .addAction(action)
                .extend(new NotificationCompat.WearableExtender()
                        .setContentAction(0));

// Get an instance of the NotificationManager service
NotificationManagerCompat notificationManager =
        NotificationManagerCompat.from(this);

// Build the notification and issues it with notification manager.
notificationManager.notify(0, builder.build());

นี่คือลักษณะที่ปรากฏ:

ป้อนคำอธิบายรูปภาพที่นี่

หลังจากปัด:

ป้อนคำอธิบายรูปภาพที่นี่

มันควรจะอยู่ในหน้าเดียว โดยมีปุ่ม Action ฝังอยู่ในการแจ้งเตือน เช่นนี้

ป้อนคำอธิบายรูปภาพที่นี่

ผมทำอะไรผิดหรือเปล่า?


person corazza    schedule 08.08.2014    source แหล่งที่มา
comment
ไม่แน่ใจทั้งหมด (แสดงความคิดเห็นและไม่ตอบ) แต่ฉันเชื่อว่าการกระทำที่ปรากฏในหน้าหลักควรอยู่ใน .extend(new NotificationCompat.WearableExtender().setContentAction( /* HERE */ ));   -  person Budius    schedule 08.08.2014
comment
@Budius มันไม่เป็นเช่นนั้นในโครงการตัวอย่างซึ่งใช้งานได้ (แต่แตกต่างเกินกว่าที่จะคัดลอกโดยตรง) ฉันลองแล้วมันใช้งานไม่ได้   -  person corazza    schedule 08.08.2014
comment
@jco: คุณอ้างถึงโครงการตัวอย่างใด คุณได้ลองทำตามคำแนะนำใน stackoverflow.com/ คำถาม/25018086/ หรือ stackoverflow.com/questions/24601352/ ?   -  person Wayne Piekarski    schedule 09.08.2014
comment
@WaynePiekarski ContentAction อันที่มาพร้อมกับ SDK นอกจากนี้ ฉันเกือบจะแน่ใจว่าคำถามสองข้อที่คุณเชื่อมโยงไว้ข้างต้นสามารถตอบคำถามของฉันได้ ฉันจะทดสอบในวันจันทร์ และทำเครื่องหมายคำถามของฉันว่าซ้ำกันหากเป็นเช่นนั้น หรือคล้ายกันมากพอ   -  person corazza    schedule 09.08.2014


คำตอบ (1)