Android Question Path to read/write file on a USB memory stick

Sergio83

Member
Licensed User
Longtime User
Hi all of you,

My purpose is to capture MJPEG stream from wifi camera and read/write the stream content on a usb memory stick.

Connecting to cameras and catching theire mjpeg streams is OK, but where I bug is to find the path of the USB memory stick to record the streams.

While walking across the forum I found many pieces of code but no one gave me an answer to really fix my problem

My environment:

Android TV box
2 USB port (host)
OS version 4.4.4 (seems to be important)

Many thanks by advance to anybody able to help me!

Regards
 

Sergio83

Member
Licensed User
Longtime User
Try RuntimePermissions.GetAllSafeDirsExternal. It returns all known accessible paths.
hello erel,

Many thanks for your quick reply, but as I said I walked across the forum a lot and, in deed, I found what you said but i'm using B4A version 5.50 so I think runtime permission is not available.

So ... what can I do ?

Regards
 
Upvote 0

Sergio83

Member
Licensed User
Longtime User
Hi Erel

To be frank that's not the reply I was really waiting for, but ... I understand the situation, I've ordered the upgrade to version 6.50

Do I have to start again the full installation or just it is an upgrade simple procedure?

Regards
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
Hi Erel

To be frank that's not the reply I was really waiting for, but ... I understand the situation, I've ordered the upgrade to version 6.50

Do I have to start again the full installation or just it is an upgrade simple procedure?

Regards
What mean ?
If you have B4A 6.50 you must install , you can choose or in another directory so you have 5.80 ands 6.50 or you can update the folder where you have 5.80 so you will be only 6.50
 
Upvote 0

Sergio83

Member
Licensed User
Longtime User
What mean ?
If you have B4A 6.50 you must install , you can choose or in another directory so you have 5.80 ands 6.50 or you can update the folder where you have 5.80 so you will be only 6.50
OK Erel,

I've installed 6.50 version in a spefici directory so now I've the two versions (5.50 & 6.50) functionnal in two different directories.

I can right now test the RuntimePermissions.GetAllSafeDirsExternal and let you now what is going on ...

Regards
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Marco is not Erel.
So if it is Marco who answered you should adress your answer to Marco.
Ignoring him and talking to Erel is not fair.
 
Last edited:
Upvote 0

Sergio83

Member
Licensed User
Longtime User
Hi Erel,

Bad news when selectionning the runtime permission library and when compiling I got the error message:

Organizing libraries. Error
Maven artifact not found: com.android.support/support-v4

What's going on ?

Regards
 
Upvote 0

Sergio83

Member
Licensed User
Longtime User
MARCO is not Erel.
So if MARCO answered you should talk to MARCO.
Ignoring him and talking to Erel is not fair.

Hello DonManfred,

I fully agree with you and I'm so sorry to have done that way!

I apologie Marco I was very focused on my problem, I began my thread with Erel and didn't take care that you, Marco,replied me and not Erel

Best regards
 
Upvote 0

Sergio83

Member
Licensed User
Longtime User
Follow the steps here: https://www.b4x.com/b4a.html
Especially the point with the two Maven-Repositories.

SS-2016-06-21_14.53.36.png


Maybe you are using some old libraries which depends on the old support-libary?

Hi DonManfred,

I'm again in touch with you, updating my SDK took me a while ...

Then, now I'm facing a new situation, no more problem with "the two Maven-Repositories", thanks a lot for your help regarding that issue!

Now I'm facing to an installation package issue at compile time:

B4X:
B4A version: 6.50
Parsing code.  (0.09s)
Compiling code.  (0.31s)
Compiling layouts code.  (0.03s)
Organizing libraries.  (0.00s)
Generating R file.  (0.19s)
Compiling generated Java code.  (3.17s)
Convert byte code - optimized dex.  (11.89s)
Packaging files.  (16.08s)
Copying libraries resources  (1.06s)
   Found 208 resource files.
Signing package file (debug key).  (11.63s)
ZipAlign file.  (0.70s)
Installing file to device.  Error

In your reply you wondered about somme old libraries, may be it is a good track!

Here after is a list of the libraries which are involved in my app:

B4X:
Animation (1.02)
Core (6.50)
Hotspotlib (1.00)
HTTPserver (1.00)
IME (1.10)
JMQTT (1.00) 
JMqttBroker (1.04)
Livewallpaper (1.01)
network (1.51)
phone (2.40)
randomaccessfile (2.20)
reflection (2.40)
runtimepermission (1.01)
TTS (1.00)
ViewBadger (0.25)

This app was compiled and working well under B4A 5.50 without the "runtime permission" library, if it can help ....

Regards

PS: sorry for my english speaking, that's not my mother language, I've a better practice of "la langue de Molière" ... may you to ?
 
Upvote 0

Sergio83

Member
Licensed User
Longtime User
Hi DonManfred,

I'm again in touch with you, updating my SDK took me a while ...

Then, now I'm facing a new situation, no more problem with "the two Maven-Repositories", thanks a lot for your help regarding that issue!

Now I'm facing to an installation package issue at compile time:

B4X:
B4A version: 6.50
Parsing code.  (0.09s)
Compiling code.  (0.31s)
Compiling layouts code.  (0.03s)
Organizing libraries.  (0.00s)
Generating R file.  (0.19s)
Compiling generated Java code.  (3.17s)
Convert byte code - optimized dex.  (11.89s)
Packaging files.  (16.08s)
Copying libraries resources  (1.06s)
   Found 208 resource files.
Signing package file (debug key).  (11.63s)
ZipAlign file.  (0.70s)
Installing file to device.  Error

In your reply you wondered about somme old libraries, may be it is a good track!

Here after is a list of the libraries which are involved in my app:

B4X:
Animation (1.02)
Core (6.50)
Hotspotlib (1.00)
HTTPserver (1.00)
IME (1.10)
JMQTT (1.00)
JMqttBroker (1.04)
Livewallpaper (1.01)
network (1.51)
phone (2.40)
randomaccessfile (2.20)
reflection (2.40)
runtimepermission (1.01)
TTS (1.00)
ViewBadger (0.25)

This app was compiled and working well under B4A 5.50 without the "runtime permission" library, if it can help ....

Regards

PS: sorry for my english speaking, that's not my mother language, I've a better practice of "la langue de Molière" ... may you to ?

Hi again DonManfred,

Once I've compiled my apps with 6.50 version if I try to complile it with 5.50 version I get the same error message ...

regards

Better & better ... when I try to compile an app with version 5.50 which has never been compiled with version 6.50 I get the same error!

The constant seems to be the new the updated SDK ..
 
Last edited:
Upvote 0

Sergio83

Member
Licensed User
Longtime User
Create a new project and run it. Do you get this error?

How is the device connected? If you are using USB debug mode then monitor the unfiltered logs and see whether there is more information there.

Good morning Erel,

The connexion of my Android box is a wired connexion (because my app has a wifi hotspot to manage MQTT streams with my esp8266 devices), of course the "enable ftp server" of B4A-Bridge is checked

I created a very simple new project:

B4X:
#Region  Project Attributes
   #ApplicationLabel: B4A Example
   #VersionCode: 1
   #VersionName:
   'SupportedOrientations possible values: unspecified, landscape or portrait.
   #SupportedOrientations: unspecified
   #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
   #FullScreen: False
   #IncludeTitle: True
#End Region

Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.

End Sub

Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.

   Private Button1 As Button
   Private Label1 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
   'Do not forget to load the layout file created with the visual designer. For example:
   Activity.LoadLayout("main")

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub Button1_Click
   Label1.Text="this button has presssed: button1"
End Sub
#Region  Project Attributes
   #ApplicationLabel: B4A Example
   #VersionCode: 1
   #VersionName:
   'SupportedOrientations possible values: unspecified, landscape or portrait.
   #SupportedOrientations: unspecified
   #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
   #FullScreen: False
   #IncludeTitle: True
#End Region

Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.

End Sub

Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.

   Private Button1 As Button
   Private Label1 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
   'Do not forget to load the layout file created with the visual designer. For example:
   Activity.LoadLayout("main")

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub Button1_Click
   Label1.Text="this button has presssed: button1"
End Sub

The unmodified manifest is:

B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="19"/>
<supports-screens android:largeScreens="true"
  android:normalScreens="true"
  android:smallScreens="true"
  android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")

Regards
 
Upvote 0

Sergio83

Member
Licensed User
Longtime User
Sorry I forgot to state that the message error is the same ....

I tried with a HUAWEI phone with a WiFi connexion to B4A-Bridge: same message.

I never used the USB debug mode, so I'm not so sure I do right:

On my device I in settings there is a USB tab with a "connect to pc" option I checked it
I've also checked "USB debugging"

When I power on my device windows recognize the connexion of new usb device but I get the message "unknown peripheral" it seems there's no installed driver?

I read the post from Agraham related to IDE usb connexion but it is not very clear for me ...
 
Upvote 0

Sergio83

Member
Licensed User
Longtime User
SDK is installed on a data drive (note the system drive), in case of , I'm re-installing the SDK in another directory with API 23 and Maven-Repositories


I was already suspicious about Android SDk when talking with DonManfred:

B4X:
Hi again DonManfred,

Once I've compiled my apps with 6.50 version if I try to complile it with 5.50 version I get the same error message ...

regards

Better & better ... when I try to compile an app with version 5.50 which has never been compiled with version 6.50 I get the same error!

The constant seems to be the new the updated SDK ..

By the way, I don't undertsandand your proposal:
B4X:
Please open a command line in <android sdk>\platform-tools and run

How can I do that?
 
Upvote 0
Top