看着似乎isRateLimitingActive()
方法,如果你没有留给ShortcutManager
API (因此“0”)任何剩余的调用返回false的源代码。我想速度限制是需要的,因为API是资源密集型的。我可以想像,至少如果你更新的快捷方式将发生以下情况:
- 的桌面应用(和其他听众)需要通知并开始更新它的UI或任何需要(取决于发射器);
- 系统需要store新的动态快捷的信息;
您可以使用此方法,以找出是否到setDynamicShortcuts()
,addDynamicShortcuts()
或updateShortcuts()
通话甚至会试图这样做之前成功。
Source:
/**
* Return {@code true} when rate-limiting is active for the caller application.
*
* <p>See the class level javadoc for details.
*
* @throws IllegalStateException when the user is locked.
*/
public boolean isRateLimitingActive() {
try {
return mService.getRemainingCallCount(mContext.getPackageName(), injectMyUserId())
== 0;
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
奖励:setDynamicShortcuts()
,addDynamicShortcuts()
或updateShortcuts()
返回false,如果他们没有成功,由于速率限制。
很好的解释! –