gpt4 book ai didi

service - 安卓穿戴: Listen to incoming notifications

转载 作者:行者123 更新时间:2023-12-02 16:46:53 25 4
gpt4 key购买 nike

是否可以在可穿戴 Android 应用程序中监听传入通知?我尝试实现 NotificationListenerService,但该服务的 onNotificationPosted() 从未被调用:

public class MyListenerService extends NotificationListenerService {

@Override
public void onCreate() {
super.onCreate();
Log.d("NotificationListener", "This works....");
}

@Override
public void onNotificationPosted(StatusBarNotification sbn) {
Log.i("NotificationListener", "... but this method won't be called.");
}
}

最佳答案

试试这个:

adb shell 设置将安全的enabled_notification_listeners com.google.android.wearable.app/com.google.android.clockwork.stream.NotificationCollectorService:$YOUR_PACKAGE/$YOUR_PACKAGE.$YOUR_NOTIFICATION_LISTENER

关于service - 安卓穿戴: Listen to incoming notifications,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27185609/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com