Paolodc
Member
I've been implementing firebase ml in my app. But it works untill I open the camera activity.
Could anyone help me? I'm very consufing!
PROJECTS LIBRARIES
Could anyone help me? I'm very consufing!
MANIFEST EDITOR:
AddManifestText(
<uses-sdk android:minSdkVersion="28" android:targetSdkVersion="31"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:largeHeap,"true")
' FIREBASE ML
'AddPermission(android.permission.INTERNET)
'AddPermission(android.permission.CAMERA) ' Required to be able' FIREBASE ML
AddPermission(android.permission.CAMERA) ' Required to be able to access the camera device.
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE) ' Allows an application to write to external storage.
AddApplicationText(
<service android:name="com.google.firebase.components.ComponentDiscoveryService" >
<meta-data
android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
android:name="com.google.firebase.components:com.google.firebase.iid.Registrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
android:name="com.google.firebase.components:com.google.firebase.auth.FirebaseAuthRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
android:name="com.google.firebase.components:com.google.firebase.storage.StorageRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
android:name="com.google.firebase.components:com.google.firebase.firestore.FirestoreRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar"/>
<meta-data
android:name="com.google.firebase.components:com.google.firebase.database.DatabaseRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar"/>
<meta-data
android:name="com.google.firebase.components:com.google.firebase.ml.common.CommonComponentRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
android:name="com.google.firebase.components:com.google.firebase.ml.vision.VisionRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
</service>
)
'*****************************************
'CreateResourceFromFile(Macro, Themes.DarkTheme)'or LightTheme
'******************************************
' ' ' ' Firebase resources
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
CreateResourceFromFile(Macro, FirebaseAnalytics.FirebaseAnalytics)
CreateResourceFromFile(Macro, FirebaseAuth.FirebaseAuth)
'******************************************
'IME
SetActivityAttribute(main, android:windowSoftInputMode, adjustResize|stateHidden)
SetActivityAttribute(chatpagesc, android:windowSoftInputMode, adjustResize|stateHidden)
SetActivityAttribute(homePage, android:windowSoftInputMode, adjustResize|stateHidden)
'******************************************
' TAN STRIP
CreateResource(drawable, background_tab.xml,
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime">
<item android:state_pressed="true" android:drawable="[USER=45325]@Color[/USER]/background_tab_pressed" />
<item android:state_focused="true" android:drawable="[USER=45325]@Color[/USER]/background_tab_pressed"/>
<item android:drawable="@android:color/transparent"/>
</selector>)
CreateResource(values, colors.xml,
<resources>
<color name="background_tab_pressed">#6633B5E5</color>
</resources>)
'******************************************
'NOTIFICATION
AddApplicationText(
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="$PACKAGE$.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
)
CreateResource(xml, provider_paths,
<external-files-path name="name" path="shared" />
)
'Activities _
AddApplicationText(<activity android:name="b4a.example3.backendprocesses_service$backendprocesses_service_BR"/>)
'_________
'******************************************
ADDITIONAL JARS:
#MultiDex: True
'FIREBASE jar resources
#AdditionalJar: com.google.android.gms:play-services-base
#AdditionalJar: com.google.firebase:firebase-core
#AdditionalJar: com.google.android.gms:play-services-tasks
#AdditionalJar: com.google.firebase:firebase-ml-vision
#AdditionalJar: com.google.firebase:firebase-ml-vision-face-model
#AdditionalJar: com.google.firebase:firebase-ml-vision-image-label-model
#AdditionalJar: com.google.firebase:firebase-ml-common
#AdditionalJar: com.google.firebase:firebase-ml-model-interpreter
ACTIVITY CREATE - MAIN:
Dim rp As RuntimePermissions
rp.CheckAndRequest(rp.PERMISSION_CAMERA)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
rp.CheckAndRequest(rp.PERMISSION_READ_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
Activity.LoadLayout("C_CameraMain")
Try
Log(1)
vision.Initialize("MLVision",vision.TEXT_DETECTION)
Log(2)
detector.Initialize("MLVision",CameraSourcePreview1,GraphicOverlay1, Null,vision.TEXT_DETECTION)
Log(3)
detector.Facing = 0
' text.Initialize
Catch
Log(LastException)
End Try
PROJECTS LIBRARIES