Italian Problemi con l'inizializzazione della fotocamera

Star-Dust

Expert
Licensed User
In effetti la class che avevo io era in versione 1.1 mentre quella del thread è 1.3.
Ora su uno smartphone con android 6 va bene mentre su uno con android 11 si è generato un problema con la libreria httpUtils2:

Error: java.net.UnknownServiceException: CLEARTEXT communication to 51.xx.xx.xx not permitted by network security policy error in httputils2
Questo riguarda il fatto che usi connessioni in chiaro (non https)
 

Star-Dust

Expert
Licensed User
Sono riuscito a by-passarlo modificando nel manifest da android:targetSdkVersion="30" a android:targetSdkVersion="26".
Ma c'è un altro sistema?
Si
 

LucaMs

Expert
Licensed User
Longtime User
Prova a cercare con Google:

site:b4x.com -"Search Results" "java.net.UnknownServiceException: CLEARTEXT communication"
 

Star-Dust

Expert
Licensed User
Ti manca di aggiornare la tua app per le versioni recenti di sdk. Risolveresti tutti i problemi
 

Star-Dust

Expert
Licensed User
Proprio per quello devi aggiormare il codice per adattarlo alle nuove restrizioni.
 

Walter Scafati

Active Member
Licensed User
Longtime User
Buongiorno, rimane un ultimo problema (spero), se installo la app da b4a (release) sul telefono con android 11 non ho problemi, ma se la installo facendo il download dal mio server, quando deve leggere la memoria interna da questo errore sempre riguardo i privilegi:


java.io.FileNotFoundException: /storage/emulated/0/Android/data/b4a.verdeco/files/1.jpg: open failed: EACCES (Permission denied)
at libcore.io.IoBridge.open(IoBridge.java:492)
at java.io.FileInputStream.<init>(FileInputStream.java:160)
at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:215)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize(CanvasWrapper.java:516)
at anywheresoftware.b4a.keywords.Common.LoadBitmap(Common.java:1342)
at b4a.verdeco.main._timer1_tick(main.java:3616)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:263)
at android.app.ActivityThread.main(ActivityThread.java:8278)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1006)
Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
at libcore.io.Linux.open(Native Method)
at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254)
at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:8160)
at libcore.io.IoBridge.open(IoBridge.java:478)
... 15 more


Il manifest l'ho modificato con tutto quello che serviva ma non capisco dove sbaglio

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.basic4ppc.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="30"/>
<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:usesCleartextTraffic, "true")
SetApplicationAttribute(android:requestLegacyExternalStorage, true)

'la riga successiva puo' risolvere problemi di grafica per Ver. 5.0
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")
AddManifestText(<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>)
AddManifestText(<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>)
AddManifestText(<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>)
'AddManifestText(<uses-permission android:name="android.permission.CAMERA"/>)
'End of default text.
AddManifestText(<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="19" />)
AddManifestText(<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="18" />

AddPermission(android.permission.READ_EXTERNAL_STORAGE)

AddReceiverText(eu.dgconsulting.appupdating.newinst2,
  <intent-filter>
  <action android:name="android.intent.action.PACKAGE_REPLACED" />
    <data android:scheme="package" />
  </intent-filter>)
 
  SetApplicationAttribute(android:theme, "@style/MyAppTheme")

CreateResource(values, theme.xml,
<resources>
    <style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">#0098FF</item>
        <item name="colorPrimaryDark">#007CF5</item>
        <item name="colorAccent">#AAAA00</item>
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="android:windowTranslucentNavigation">false</item>
         <item name="android:windowTranslucentStatus">true</item>
    </style>
</resources>
)

CreateResourceFromFile(Macro, Core.NetworkClearText)

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,
   <files-path name="name" path="shared" />
)
 

Walter Scafati

Active Member
Licensed User
Longtime User
Buongiorno, rimane un ultimo problema (spero), se installo la app da b4a (release) sul telefono con android 11 non ho problemi, ma se la installo facendo il download dal mio server, quando deve leggere la memoria interna da questo errore sempre riguardo i privilegi:


java.io.FileNotFoundException: /storage/emulated/0/Android/data/b4a.verdeco/files/1.jpg: open failed: EACCES (Permission denied)
at libcore.io.IoBridge.open(IoBridge.java:492)
at java.io.FileInputStream.<init>(FileInputStream.java:160)
at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:215)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize(CanvasWrapper.java:516)
at anywheresoftware.b4a.keywords.Common.LoadBitmap(Common.java:1342)
at b4a.verdeco.main._timer1_tick(main.java:3616)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:263)
at android.app.ActivityThread.main(ActivityThread.java:8278)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1006)
Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
at libcore.io.Linux.open(Native Method)
at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254)
at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:8160)
at libcore.io.IoBridge.open(IoBridge.java:478)
... 15 more


Il manifest l'ho modificato con tutto quello che serviva ma non capisco dove sbaglio

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.basic4ppc.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="30"/>
<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:usesCleartextTraffic, "true")
SetApplicationAttribute(android:requestLegacyExternalStorage, true)

'la riga successiva puo' risolvere problemi di grafica per Ver. 5.0
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")
AddManifestText(<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>)
AddManifestText(<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>)
AddManifestText(<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>)
'AddManifestText(<uses-permission android:name="android.permission.CAMERA"/>)
'End of default text.
AddManifestText(<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="19" />)
AddManifestText(<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="18" />

AddPermission(android.permission.READ_EXTERNAL_STORAGE)

AddReceiverText(eu.dgconsulting.appupdating.newinst2,
  <intent-filter>
  <action android:name="android.intent.action.PACKAGE_REPLACED" />
    <data android:scheme="package" />
  </intent-filter>)
 
  SetApplicationAttribute(android:theme, "@style/MyAppTheme")

CreateResource(values, theme.xml,
<resources>
    <style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">#0098FF</item>
        <item name="colorPrimaryDark">#007CF5</item>
        <item name="colorAccent">#AAAA00</item>
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="android:windowTranslucentNavigation">false</item>
         <item name="android:windowTranslucentStatus">true</item>
    </style>
</resources>
)

CreateResourceFromFile(Macro, Core.NetworkClearText)

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,
   <files-path name="name" path="shared" />
)
Buongiorno come si può risolvere questa malfunzione?
Grazie.
 

Star-Dust

Expert
Licensed User
Apri un nuovo thread per questo nuovo problema
 
Top