{"record":{"id":"58000e6e13b4a379","repo":"microg/GmsCore","slug":"minupdateintervalmillis-must-be-greater-than-or-eq","errorCode":null,"errorMessage":"minUpdateIntervalMillis must be greater than or equal to 0, or IMPLICIT_MIN_UPDATE_INTERVAL","messagePattern":"minUpdateIntervalMillis must be greater than or equal to 0, or IMPLICIT_MIN_UPDATE_INTERVAL","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"play-services-location/src/main/java/com/google/android/gms/location/LocationRequest.java","lineNumber":797,"sourceCode":"            this.minUpdateDistanceMeters = minUpdateDistanceMeters;\n            return this;\n        }\n\n        /**\n         * Sets the fastest allowed interval of location updates. Location updates may arrive faster than the desired interval\n         * ({@link #setIntervalMillis(long)}), but will never arrive faster than specified here.\n         * <p>\n         * This may be set to the special value {@link #IMPLICIT_MIN_UPDATE_INTERVAL} in which case the minimum update interval will\n         * be the same as the interval. {@link FusedLocationProviderClient} APIs make some allowance for jitter with the minimum\n         * update interval, so clients need not worry about location updates that arrive a couple milliseconds too early being\n         * rejected.\n         * <p>\n         * The default value is {@link #IMPLICIT_MIN_UPDATE_INTERVAL}.\n         */\n        @NonNull\n        public Builder setMinUpdateIntervalMillis(long minUpdateIntervalMillis) {\n            if (minUpdateIntervalMillis < 0 && minUpdateIntervalMillis != IMPLICIT_MIN_UPDATE_INTERVAL)\n                throw new IllegalArgumentException(\"minUpdateIntervalMillis must be greater than or equal to 0, or IMPLICIT_MIN_UPDATE_INTERVAL\");\n            this.minUpdateIntervalMillis = minUpdateIntervalMillis;\n            return this;\n        }\n\n        @NonNull\n        @Deprecated\n        @PublicApi(exclude = true)\n        public Builder setModuleId(@Nullable String moduleId) {\n            this.moduleId = moduleId;\n            return this;\n        }\n\n        /**\n         * Sets the {@link Priority} of the location request.\n         * <p>\n         * The default value is {@link Priority#PRIORITY_BALANCED_POWER_ACCURACY}.\n         */\n        @NonNull","sourceCodeStart":779,"sourceCodeEnd":815,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-location/src/main/java/com/google/android/gms/location/LocationRequest.java#L779-L815","documentation":"LocationRequest.Builder.setMinUpdateIntervalMillis() accepts values >= 0 or the special sentinel IMPLICIT_MIN_UPDATE_INTERVAL (-1); anything else is rejected. The library throws this IllegalArgumentException for negative intervals other than the sentinel.","triggerScenarios":"Calling setMinUpdateIntervalMillis(long) with a negative long that is not LocationRequest.IMPLICIT_MIN_UPDATE_INTERVAL, e.g. -1000 or a miscalculated interval.","commonSituations":"Confusing IMPLICIT_MIN_UPDATE_INTERVAL (-1) with arbitrary negative values, computing an interval as a difference that came out negative, or copying a sentinel incorrectly as a literal -2 or similar.","solutions":["Pass a non-negative millisecond value, or use the constant LocationRequest.IMPLICIT_MIN_UPDATE_INTERVAL.","Clamp negative computed intervals to 0 before calling.","Use the IMPLICIT_MIN_UPDATE_INTERVAL constant instead of a raw -1/negative literal.","Omit the call to accept the default (IMPLICIT_MIN_UPDATE_INTERVAL)."],"exampleFix":"// before\nbuilder.setMinUpdateIntervalMillis(-1000L);\n// after\nbuilder.setMinUpdateIntervalMillis(Math.max(0L, minIntervalMillis));\n// or explicitly: builder.setMinUpdateIntervalMillis(LocationRequest.IMPLICIT_MIN_UPDATE_INTERVAL);","handlingStrategy":"validation","validationCode":"if (minUpdateIntervalMillis < 0 && minUpdateIntervalMillis != LocationRequest.IMPLICIT_MIN_UPDATE_INTERVAL) {\n    throw new IllegalArgumentException(\"invalid minUpdateIntervalMillis\");\n}\nbuilder.setMinUpdateIntervalMillis(minUpdateIntervalMillis);","typeGuard":null,"tryCatchPattern":"try {\n    builder.setMinUpdateIntervalMillis(interval);\n} catch (IllegalArgumentException e) {\n    builder.setMinUpdateIntervalMillis(LocationRequest.IMPLICIT_MIN_UPDATE_INTERVAL);\n}","preventionTips":["Always use the IMPLICIT_MIN_UPDATE_INTERVAL constant instead of raw negative literals","Clamp computed intervals to >= 0","Avoid deriving intervals via subtraction that can go negative"],"tags":["android","location","argument-validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"157c9d86ac46c195a86c2f15ab55c84036223f95","analyzedAt":"2026-09-06T17:27:33.892Z","contentChangedAt":"2026-09-06T17:27:33.892Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}