我有问题。我的android穿戴模拟器不显示通知。 这里是我的移动代码:Android穿不显示通知
private void notifyToWear() {
NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender()
.setHintShowBackgroundOnly(true);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("Request text")
.setContentText("Speak something then your phone will search it.")
.extend(wearableExtender);
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
notificationManager.notify(0, notificationBuilder.build());
}
我把它当MainActivity点击按钮。在我的手机显示通知,但在Android穿模拟器不显示。 笔记: +我已连接Android手机& android wear emualtor。我使用Android Wear App中的卡片示例进行了测试。它正在工作。
谢谢。
- 更新 - 代码执行单击按钮:
(findViewById(R.id.btn_request_text)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(MyActivity.this, "Call request", Toast.LENGTH_SHORT).show();
notifyToWear();
}
});
当我点击按钮Toast是表演。
---更新--- 我也运行ElizaChat &食谱Assist in Wear Sample。 但它不工作。
你可以发布按钮的代码?看看你如何调用这段代码? – Elior 2014-09-03 10:39:48
我更新了问题。你能帮我吗 ? – quangson91 2014-09-03 10:44:12
看到我的答案.. – Elior 2014-09-03 11:42:32