This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
entityExtractor | |
.downloadModelIfNeeded() | |
.addOnSuccessListener { _ -> | |
/* Model downloading succeeded, you can call extraction API here. */ | |
} | |
.addOnFailureListener { _ -> /* Model downloading failed. */ } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val entityExtractor = | |
EntityExtraction.getClient( | |
EntityExtractorOptions.Builder(EntityExtractorOptions.ENGLISH) | |
.build()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
implementation 'com.google.mlkit:entity-extraction:16.0.0-beta2' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
implementation 'com.google.firebase:firebase-ml-vision:24.0.1' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val listener: InstallStateUpdatedListener? = InstallStateUpdatedListener { installState -> | |
if (installState.installStatus() == InstallStatus.DOWNLOADED) { | |
// After the update is downloaded, show a notification | |
// and request user confirmation to restart the app. | |
Log.d(TAG, "An update has been downloaded") | |
showSnackBarForCompleteUpdate() | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
appUpdateManager.startUpdateFlowForResult( | |
// Pass the intent that is returned by 'getAppUpdateInfo()'. | |
appUpdateInfo, | |
// Or 'AppUpdateType.FLEXIBLE' for flexible updates. | |
AppUpdateType.FLEXIBLE, | |
// The current activity making the update request. | |
this, | |
// Include a request code to later monitor this update request. | |
MY_REQUEST_CODE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun checkUpdate() { | |
// Returns an intent object that you use to check for an update. | |
val appUpdateInfoTask = appUpdateManager?.appUpdateInfo | |
// Checks that the platform will allow the specified type of update. | |
Log.d(TAG, "Checking for updates") | |
appUpdateInfoTask?.addOnSuccessListener { appUpdateInfo -> | |
if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE | |
&& appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)) { | |
// Request the update. | |
Log.d(TAG, "Update available") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContent { | |
Text("Hello Text") | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:background="@color/white" | |
android:layout_height="match_parent"> | |
<androidx.core.widget.NestedScrollView | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity: AppCompatActivity() { | |
private var lensFacing = CameraX.LensFacing.BACK | |
private val TAG = "MainActivity" | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
view_finder.post { startCamera() } |