Android的穿不显示通知 [英] Android wear not show notification
问题描述
我已经probblem。我的Android模拟器穿不显示通知。
这里是我的code移动:
I've probblem. My android wear emulator not show notification. Here is my code for mobile:
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的磨损emualtor。我在Android Wear与应用实例卡进行测试。它的工作。
I call it when button in MainActivity click. In my phone it show notification but in android wear emulator not show. Notes: + I've connected between android phone & android wear emualtor. I tested with Card Example in Android Wear App. It's working.
感谢。
- 更新 -
code进行单击按钮:
-- Update -- Code perform click button:
(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是表演。
When I click to button Toast is show.
--- ---更新
我也跑ElizaChat&安培; RecipeAssistant在磨损样品。
但它不工作了。
--- Update --- I also run ElizaChat & RecipeAssistant in Wear Sample. But it not working too.
推荐答案
请确保你已经给到您的通知设备访问Android Wear应用。
Make sure that you have given the Android Wear app on your device access to notifications.
在4.4:设置>安全>通知访问
输入L preVIEW:设置>声音和放大器;通知>的通知访问
在通知接入屏幕,确保 Android Wear 被选中。
Within the Notification access screen, make sure that Android Wear is checked.
这篇关于Android的穿不显示通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!