This page describes the steps required to connect an Android device to a local Docker container for development and testing.
You will need:
A Docker host machine
An Android device running the Warehouse app – installed either from the Google Play store or from a .apk file
The host and the Android device must be connected to the same network – usually a wireless network
The navcontainerhelper PowerShell module
This can be acquired from the PowerShell Gallery by running Install-Module navcontainerhelper in an elevated PowerShell prompt
Create the Container
Use the New-NavContainer function to create a new Business Central container. Use the additionalParameters parameter with a value of -P. This tells Docker to expose the ports that are used by the container to random ports on the Docker host e.g.
New-NavContainer test -accept_eula -imageName mcr.microsoft.com/businesscentral/sandbox -additionalParameters ‘-P’
(you will need to provide more parameters than these to create a new container, see https://freddysblog.com/category/navcontainerhelper/ for more information)
You will need Clever Config, Clever Handheld Framework and Clever Handheld for Warehousing apps installed into the container to connect the Android device.
Run ipconfig in a command prompt and make a note of the IP Address that the host machine has been given. The host may have multiple IP Addresses be sure to note the address from the network that the Android device is connected to. For example:
Ethernet adapter vEthernet (Marvell AVASTAR Wireless-AC Network Controller Virtual Switch):
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::4dd:ac87:5936:217d%5
IPv4 Address. . . . . . . . . . . : 10.231.59.183
Subnet Mask . . . . . . . . . . . : 255.255.248.0
Default Gateway . . . . . . . . . : 10.231.56.254
Web Service Port
Business Central hosts web services on port 7047 inside the container. Using the -P parameter (see above) causes Docker to map that port to a random port on the host. Run docker ps to see which port 7047 has been mapped to e.g.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
69994422af0d mcr.microsoft.com/businesscentral/sandbox:latest-ltsc2019 "powershell -Command…" 5 hours ago Up 5 hours (healthy) 0.0.0.0:62696->80/tcp, 0.0.0.0:62695->443/tcp, 0.0.0.0:62694->1433/tcp, 0.0.0.0:62693->7045/tcp, 0.0.0.0:62692->7046/tcp, 0.0.0.0:62691->7047/tcp, 0.0.0.0:62690->7048/tcp, 0.0.0.0:62689->7049/tcp, 0.0.0.0:62688->8080/tcp bc
Indicates that port 7047 inside the container has been mapped to port 62691 on the host.
Handheld Whse. Setup
Once the apps are installed navigate to the Handheld Whse. Setup page. Apply the default configuration from the action bar. Expand the bottom Registration Setting tab and populate the fields with the following details:
Web Service URL: browse to the Web Services page and find the entry for Codeunit 9059253 (Web Service CHHFTMN). Copy the SOAP URL value and paste into the Web Service URL field in Handheld Whse. Setup e.g. http://bc:7047/NAV/WS/My%20Company/Codeunit/HandheldFramework
Replace the host name (bc in this example) with the IP address noted above
Replace port 7047 with the host port noted above
In this example the URL should read http://10.231.59.183:62691/NAV/WS/My%20Company/Codeunit/HandheldFramework
Domain, User, Password – the credentials that should be used to authenticate with the web service
This is user that all Handheld activity will be posted in Business Central as
This user will require sufficient permissions in Business Central to post the different types of transaction
It is good practice to generate a Web Service Access Key on the User Card and copy this into the password field as this can be expired and regenerated separately to the user’s password
After populating these fields with the correct values you are ready to connect the Warehouse app. Click on the Connect Device App. action on the Handheld Whse. Setup page.
Follow the instructions on the page that pops up to scan the token in the Warehouse app. The settings entered above will be downloaded to the app and used to connect to the web service.
Note: the token will expire after 30 minutes. Further tokens can be generated in the same way if required.