我正在编写一个有一些通知的应用程序。如果手机处于 Android Auto 驾驶模式,我希望推迟通知,因为驾驶员无论如何都无法采取任何行动。此外,如果它在导航中间,我想推迟到当前路线的 ETA。
在我的想象中,它是这样实现的:
void onAlarm() {
if (AndroidAutoAPI.isInDrivingMode())
snoozeUntil(AndroidAutoAPI.getCurrentETA());
else
getSystemService(NotificationManager.class).notify(...);
}
但我找不到任何关于任何 API 的文档。它们完全可用吗?