尽管我从firebase控制台获取了代码,并且我很确定firebase正确集成了
FirebaseVisionImage image = FirebaseVisionImage.fromBitmap(bitmap);
FirebaseVisionTextRecognizer detector = FirebaseVision.getInstance()
.getOnDeviceTextRecognizer();
Task<FirebaseVisionText> result =
detector.processImage(image)
.addOnSuccessListener(new OnSuccessListener<FirebaseVisionText>() {
@Override
public void onSuccess(FirebaseVisionText firebaseVisionText) {
// Task completed successfully
// ...
Toast.makeText(MainActivity.this, "Inn On Success Method", Toast.LENGTH_SHORT).show();
}
})
.addOnFailureListener(
new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
// Task failed with an exception
// ...
Toast.makeText(MainActivity.this, "Inn On failure Method", Toast.LENGTH_SHORT).show();
}
});
我添加了吐司消息只是为了检查执行哪种方法。