MlKit
Stay organized with collections
Save and categorize content based on your preferences.
Public entry point to manually initialize ML Kit.
Inherited Method Summary
From class java.lang.Object
Object
|
clone()
|
boolean |
|
void |
finalize()
|
final Class<?>
|
getClass()
|
int |
hashCode()
|
final void |
notify()
|
final void |
notifyAll()
|
String
|
toString()
|
final void |
wait(long arg0, int arg1)
|
final void |
wait(long arg0)
|
final void |
wait()
|
Public Methods
public static void initialize (Context
context)
Initializes ML Kit with the given context
.
It is only necessary to call this method if you disable the content provider
declared in the manifest(e.g. when you want to use ML Kit feature in Application
).
Under normal circumstances the content provider will automatically initialize ML Kit at
application startup.
How to disable ML Kit initialization content provider:
<provider
android:name="com.google.mlkit.common.internal.MlKitInitProvider"
android:authorities="${applicationId}.mlkitinitprovider"
tools:node="remove" />
Parameters
context |
a Context
used to initialize ML Kit. This does not have to be the application context
itself. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[null,null,["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eMlKit\u003c/code\u003e is the public entry point for manual initialization of ML Kit functionalities within your Android application.\u003c/p\u003e\n"],["\u003cp\u003eIt provides a static \u003ccode\u003einitialize()\u003c/code\u003e method that requires an Android \u003ccode\u003eContext\u003c/code\u003e for setup, typically necessary when the automatic initialization via content provider is disabled.\u003c/p\u003e\n"],["\u003cp\u003eDisabling the default content provider initialization, achieved by removing the \u003ccode\u003eMlKitInitProvider\u003c/code\u003e from your manifest, might be desirable for scenarios like using ML Kit features within your application class.\u003c/p\u003e\n"],["\u003cp\u003eIn typical cases, ML Kit automatically initializes during application startup thanks to its content provider, eliminating the need for manual calls to \u003ccode\u003eMlKit.initialize()\u003c/code\u003e.\u003c/p\u003e\n"]]],["The `MlKit` class serves as a manual entry point for initializing ML Kit. It offers a static `initialize` method, which takes a `Context` as a parameter. This method is required only when the default content provider, which automatically initializes ML Kit at application startup, is disabled. To disable it, remove the `MlKitInitProvider` declaration from the manifest. Under normal use cases the method does not need to be called.\n"],null,["# MlKit\n\npublic class **MlKit** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nPublic entry point to manually initialize ML Kit. \n\n### Public Method Summary\n\n|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static void | [initialize](/android/reference/com/google/mlkit/common/MlKit#initialize(android.content.Context))([Context](//developer.android.com/reference/android/content/Context.html) context) Initializes ML Kit with the given `context`. |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Methods\n--------------\n\n#### public static void **initialize** ([Context](//developer.android.com/reference/android/content/Context.html) context)\n\nInitializes ML Kit with the given `context`.\n\nIt is only necessary to call this method if you disable the content provider\ndeclared in the manifest(e.g. when you want to use ML Kit feature in [Application](//developer.android.com/reference/android/app/Application.html)).\nUnder normal circumstances the content provider will automatically initialize ML Kit at\napplication startup.\n\nHow to disable ML Kit initialization content provider: \n\n```\n\u003cprovider\n android:name=\"com.google.mlkit.common.internal.MlKitInitProvider\"\n android:authorities=\"${applicationId}.mlkitinitprovider\"\n tools:node=\"remove\" /\u003e\n``` \n\n##### Parameters\n\n| context | a [Context](//developer.android.com/reference/android/content/Context.html) used to initialize ML Kit. This does not have to be the application context itself. |\n|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|"]]