Android Question Advice for migrating from VB.Net to B4A

Steve2

New Member
I'm a newcomer to B4X and would like some advice please.

I need to replace an existing Microsoft Windows Mobile device and a WM app (written in VB.Net) with an Android device and the "same" app written in B4A.
The app is a data collection app used to collect data (manually entered by the user) over a period (often several hours). The device is then brought to a PC (Windows 10/11) and the data uploaded to the PC (for use in an application on the PC).
I didn't write the WM app but I have the VB.Net source code.

What is the best way to approach this?
  1. Migrate/convert the VB.Net code? Are any conversion tools available? Is it practical?
    I saw some advice saying it would be better to migrate to B4J first. Would this be necessary as the VB.Net app was written for a mobile device (with a screen smaller than modern Android devices)?
  2. Write the application from scratch based on what the existing app does now? (bearing in mind I have no experience with B4A).
  3. Some mixture of the two?
Also, how would I transfer the data from the Android device to the Windows PC programmatically? (The WM device did this with a USB connection and using Microsoft ActiveSync).
The Android device will have USB, Bluetooth and WiFi. (WiFi may be difficult to use because of IT restrictions). The data is created (currently) in a flat .txt file. This file is then moved to the PC. (I'd prefer to avoid the use of USB if possible to avoid damage to the connectors with repeated use).

How would I update the B4A application to a new release remotely? The Android device will not have cellular phone connection. I can connect remotely to the PC the device would connect to (using MS Teams or TeamViewer).
 

Brian Dean

Well-Known Member
Licensed User
Longtime User
This is a well-written question but it still leaves a couple of points unclear. It sounds as though you have a twenty year old system that has been working well but needs to be brought up-to-date. You are expecting to replace a Windows Mobile device with an Android device but you do not say to what extent you are prepared to change the PC host application. If you expect the system to run for another twenty years then you probably need to change that too.

Also, how would I transfer the data from the Android device to the Windows PC programmatically?
I think that this is the question that you need to answer first. You cannot use ActiveSync any more, and you say that you would like to avoid both WiFi and USB. That leaves Bluetooth, which might be an unwelcome complication if this is going to be your first Android app, or transfer via some sort of cloud storage, which I think is the path that most people would use. I have several low-tech Android apps that communicate with host PCs via simple (sometimes free of charge) shared storage on the Net. The app sends data files to the cloud and the PC app and other device apps look at the file timestamps to pick up any new data. Not particularly secure, of course, but very simple, and the data has no value to anyone else. But if your device does not have a phone connection and you are unsure about WiFi then any cloud connection seems to be out. In any case it would probably require changes to the PC app. So you probably need to make your mind up between Bluetooth and USB.

How would I update the B4A application to a new release remotely?
Not a question that I can answer, I am afraid. In any case, what do you mean by "remotely"? Presumably not via USB and beyond Bluetooth range. So how will you communicate?
 
Upvote 0

Steve2

New Member
It sounds as though you have a twenty year old system that has been working well but needs to be brought up-to-date.
Correct. The system works fine but MS ActiveSync won't work on Windows 11 (and the Windows Mobile devices are getting old and less reliable).

to what extent you are prepared to change the PC host application.
I can change the PC host application. (It has already been updated to use Microsoft Azure for its data storage). But I would prefer to keep changes to a minimum.

you say that you would like to avoid both WiFi and USB.
I'm not opposed to using either. My concern with USB is getting the connectors damaged by continuously plugging a USB cable in and out several times a day (the Windows Mobile devices use a USB docking cradle to avoid this problem).
With WiFi I'm concerned it may be more complicated and would certainly require more involvement from IT who would be concerned about data security. If WiFi is the more practical answer we could probably go this route. Note the devices would not always be used in areas where WiFi is available, so storing data on the device and uploading it at a later stage is required.
Bluetooth seemed like a good alternative avoiding these issues.

How would I update the B4A application to a new release remotely? - what do you mean by "remotely"? Presumably not via USB and beyond Bluetooth range. So how will you communicate?
At several sites around the country. So occasionally I would need to send a new release of the Android app to each device. I can access the PCs remotely (all the PCs are on the same WAN) and so could transfer a new release to the PC for subsequent transfer to the Android device when it connects to the PC if that is possible.
 
Upvote 0

LucasHeer

Active Member
Licensed User
Longtime User
I'm a newcomer to B4X and would like some advice please.

I need to replace an existing Microsoft Windows Mobile device and a WM app (written in VB.Net) with an Android device and the "same" app written in B4A.
The app is a data collection app used to collect data (manually entered by the user) over a period (often several hours). The device is then brought to a PC (Windows 10/11) and the data uploaded to the PC (for use in an application on the PC).
I didn't write the WM app but I have the VB.Net source code.

What is the best way to approach this?
  1. Migrate/convert the VB.Net code? Are any conversion tools available? Is it practical?
    I saw some advice saying it would be better to migrate to B4J first. Would this be necessary as the VB.Net app was written for a mobile device (with a screen smaller than modern Android devices)?
  2. Write the application from scratch based on what the existing app does now? (bearing in mind I have no experience with B4A).
  3. Some mixture of the two?
Also, how would I transfer the data from the Android device to the Windows PC programmatically? (The WM device did this with a USB connection and using Microsoft ActiveSync).
The Android device will have USB, Bluetooth and WiFi. (WiFi may be difficult to use because of IT restrictions). The data is created (currently) in a flat .txt file. This file is then moved to the PC. (I'd prefer to avoid the use of USB if possible to avoid damage to the connectors with repeated use).

How would I update the B4A application to a new release remotely? The Android device will not have cellular phone connection. I can connect remotely to the PC the device would connect to (using MS Teams or TeamViewer).
Welcome to B4X!!! If you come from VB.NET, you are already halfway to mastering this architecture!

I agree with @Brian Dean

Bluetooth/BLE might be a bit complicated. However, you 100% can communicate via Bluetooth with VB.NET <-> B4A and B4J <-> B4A. I have done this, but the results were a bit finicky on the VB.NET side.

WiFi/USB might be the easiest options to implement.

A route I have gone before -- Ethernet Switch & Ethernet dongle for Android device (if supported). -- Run a TCP server (VB.NET or B4J) on the PC with a static IPv4 address, and connect via that IP on your Android app.

Maybe even use an empty access point or network extender plugged into your PC just for Android device to connect to.
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
How would I update the B4A application to a new release remotely?
I did not answer this question before, but now I know more about your environment.

I don't think that there are many options assuming that you want a low-tech path that is within your control. When you compile your app in B4A it produces an .apk file in the Objects folder. You need to get this file into the Android device; when your User selects it in the device's File Manager they will be offered the option to install it.

Until a couple of years ago you could simply e-mail the APK file and, if the user received the email on their phone, the APK would install itself. That path is now closed and you will probably have to send the APK to the user's PC using a file transfer service, and the user will need to transfer the file to the Android device and then locate it in their File Manager. But as long as your user is reasonably PC-competent this is an acceptable in-house procedure.
 
Upvote 0
Top