How to make 1c mobile application step by step. Mobile client: installation, debugging, assembly for Android." Mobile platform device

Practice of developing a mobile application 1C 8.3 (part 1)

In this article we will talk about what we tried and what mistakes we made before we managed to make a more or less normal application for tablets. The application was initially designed only for Android, based on the 1C: Orders configuration, and mobile app for development.

Initially, the “wrong” approach was chosen: compiling the application and uploading it to the tablet manually. Let me remind you that to build mobile applications, you use the “Mobile Application Creation Assistant” (MobileAppWizzard). Then, on one of the forums, a beautiful solution was found using a mobile application for development. This application is included in the installation kit mobile platform. At the time of development, platform version 8.3.3.24 was used. In the “Android” folder you can find the 1cem.apk file. This is a mobile application for development. Its biggest advantage, which saved us a lot of time, is that you can publish a mobile application on a web server, and on a tablet you can specify a path like http://[ Web server address]/[ Mobile application name].

On a tablet PC, in the settings of the added application, you can check the “Update from the configurator” checkbox, and each time you start the application, it will try to connect to the web server and check for updates.

After the mobile application was deployed, the process of refining it began.

What was required:

1. Set up exchange between the central database and the mobile device.

2. Organize asymmetric synchronization: download data on product items, counterparties, balances of goods in the warehouse and mutual settlements from the central database, and download only customer orders from the mobile application.

3. Implement a simple interface for managers, where they can quickly view balances, prices and mutual settlements.

At the testing stage, the “Managed Application” intermediate database was used, due to the fact that the 1C:Orders demo application was initially designed for exchange with the Managed Application.

The first pancake came out lumpy. Literally. For exchange with the central database, v82.ComConnector was used. I won’t go into details about setting it up; there are a lot of separate materials about this. I will only go through the difficulties that I encountered.

1.Using com- objects on a 64-bit server OS. A wrapper was used to solve the problem COM+ Applications which is configured in Component Services.

2. Remote call Com from another server. The server being called must have the role Application Server and it should be configured COM+ Network Access. In addition, the server Apache must have the appropriate rights (i.e. run as a service on behalf of an authorized user)

Having suffered with Com connections, we decided to transfer the working base to web services.

A lot has also been written about publishing web services, but it is written about how it works. I’ll share below how it does NOT work.

The working base is deployed on platform 8.2, the mobile application, respectively, on 8.3.

When publishing applications 8.3 first, and then 8.2. periodically caught the glitch “Stream format error” in the web client 8.3, or the error message “the versions of the client and server platforms differ.” Republishing doesn't help, nor does restarting Apache. But disabling publication and connecting again helps.

Next, I caught a funny error when authorizing a user (when creating ws Definitions). When testing on a computer, authorization with a long name is easy. When you try to authorize the same user from a tablet running Android, authorization ended before it began. Experimentally, it was possible to calculate that in Cyrillic the length of a login is limited to 22 characters. At the same time, the combination of Cyrillic characters and numbers allowed me to log in with a login of 27 characters long. There is a suspicion that this is due to the conversion of Cyrillic characters. So, for example, in the browser Firefox line from Wikipedia "ivo" is converted to "».

Technologically, the 8.3.3 mobile platform currently has a number of limitations. The most anticipated innovation, in my opinion, is query support. But, since the mobile platform does not yet support arbitrary queries in dynamic lists, we had to “take a different route.”

To solve the problem of displaying a product directory with prices and balances, the following approach was used:

1. Two tables have been created in the form of a nomenclature reference book. The first is a dynamic list, the directory itself. Filter dynamic list configured to display only groups. The second table is the actual balances and prices. When a dynamic list line is activated, a table of values ​​is filled on the server, which is then output to the second table. An object model was used to obtain prices and balances. All these dances with a tambourine were performed only because the usual thick client method “when outputting a line” or “when receiving data” does not exist, and it is impossible to dynamically draw numbers in a column.

A similar approach was used in the form of selection

2. For displaying a line with current prices, FormattedString was perfect.

Below is a code example.

&OnServerWithoutContext Function RemainingWhenActivatingStringsOnServer(nom)RecordSet = InformationRegisters.ProductPrices.CreateRecordSet(); RecordSet.Selection.Product.Value = nom; RecordSet.Selection.Product.Use = True; Recordset.Read(); ArrayFormatStrings = New Array; For Each Set Row From the Set of Records, cycle Array of Formatted Rows.Add(New Formatted Row(Set Row.Price Type.Name,WebColors.Blue)); Array of FormattedStrings.Add(New FormattedString(" " + String(SetString.Price) + " ")); EndCycle; Return New FormattedString(ArrayFormatStrings); // Insert the contents of the handler. EndFunction

3. To load directories, balances and prices into the mobile application, a web service was used, which receives a parameter structure as input and returns a value store as output. Another unpleasant discovery was the exchange crash when too long-term processing on the server side. It seems that there is some kind of timeout, after which the application “believes” that the connection has been interrupted (although in fact, data is still being processed in the working database via a ws connection), and stops the exchange with an error.

To avoid this, it was decided to split the full exchange into portions with the focus returning back to the mobile application. Those. first synchronize the items, then counterparties, then balances, etc.

4. To obtain reports, the same approach is used as in the 1C: Orders configuration. A web service with parameters is called, a working database is formed on the server side spreadsheet document, and then the finished spreadsheet document is returned to the mobile application.

Good afternoon, dear readers, we bring to your attention a short article on creating a simple mobile application based on the 1C: Enterprise mobile platform for Android without compiling into an apk file.

To begin with, let’s briefly define the basic concepts and software that we will need for development.

1.Basic concepts

Mobile platform- a tool that allows you to implement applications that operate on mobile devices running iOS, Android, Windows Phone operating systems.

Mobile app - is end result development . It is installed on a mobile device and has the ability to exchange information with the main application in Off-line mode. The following information transfer channels are available for exchange: File exchange, e-mail, Web services, etc.

The configurator acts as a development environment; the only thing that needs to be taken into account is that not all configuration objects and system mechanisms are supported by the mobile application.

2.Software setup

2.1 InstallationWeb servers

First, let's install a Web server. Work is possible with both Internet information services from Microsoft and with Apache. In our example we will consider Apache because it is easier to set up and stable in operation.

Using the " Next » go to the next window:

Into the fields "Network Domain" And "Server name" write " localhost" (or 127.0.0.1). This means that the server will run on the local computer.

In field « Administrators Email Address» let's indicate mailing address, server responses will be sent to it.

Default Apache works with port 80. Many popular programs work with the same port by default, for example TeamViewer, Skype, which will not allow you to launch in the future Apache. There are 2 options to solve this problem, disable the use of this port in these programs, or change the port Apache.

To find out which programs are using port 80, you need to run cmd.exe (click Start - type cmd into the search - click right click“Run as administrator”) in the window that appears, enter the command netstat -ab.

In the screenshot we see that port 80 is occupied by Skype.

Let's leave the default port 80. Click " Next » select a standard installation. Click " Next » , change the installation directory if necessary, in the next window click “ Install, after which the installation process will start.

After the installation is complete, an icon will appear in the system tray; if we double-click on it, the following window will open:

If you still have problems with the standard port, you can always change it manually, to do this you need to go to the folder where it is installed Apache, select the folder " conf", open the file in it “ httpd.conf" Find the parameter in it "Listen" and change its values ​​to the port you need, for example 8080.

After changing the port number, save the file and restart Apache. To do this, click on the icon in the tray

With the left mouse button in the menu that appears, select “ Restart».

Let's make sure that the Web server is working, go to the browser and enter http://localhost:8080/ in the address input field (where 8080 is the port that we installed), the following page should appear on the screen:

2.2 Platform setup

For successful operation, the following components must be installed:

2.3 Installation of the mobile platform

Download the mobile platform from the 1C website https://users.v8.1c.ru/. In our example, version 8.3.8.70 is used.

The downloaded platform is an archive that consists of the following folders:

  1. Android- contains files for assembly for Android;
  2. iOS- contains files for assembly for iPhone;
  3. Windows- contains files for assembly for Windows Phone;
  4. MobileAppMaker- contains the “Application Builder” configuration files.

Since we will be developing the application for a device running Android OS, we are interested in the first directory.

Let's look at its contents:

  • 1cem-arm.apk is a mobile developer platform for the ARM architecture, the most commonly used;
  • 1cem-x86.apk - mobile development platform for x86 architecture, used for Intel processors;
  • prjandroid-arm.zip - a mobile platform designed for building mobile applications (for ARM architecture);
  • prjandroid-x86.zip is a mobile platform designed for building mobile applications (for x86 architecture).

We will install the mobile platform on the device; to do this, copy the file “1cem-arm.apk” to the phone’s memory, or if your device uses Intel processor, "1cem-x86.apk".

Let's go to the file manager on the mobile device, find our file and run it

During installation, you may receive a message about blocking applications not received from the Play Store.

In this case, you need to click the “ Settings" and in the window that appears, check the box " unknown sources»

and repeat the installation.

2.4 Configuration settings

After everything software We're set to start developing our mobile application. Let's create a new information base and go into it in configuration mode.
Go to the menu Tools -> Options and check the boxes as shown in the screenshot:

Do you have a question or need help from a consultant?

Next, call the properties of the root configuration node and set the “Use Purpose” parameter as “Mobile Device”, flag “ Personal Computer"We remove it. After this, the mobile application objects will become available. Some configuration objects will become unavailable.

2.5 Publishing application configuration

The next step is to transfer the configuration to the phone. To do this, first of all, we will create a directory; the path to this directory should be short, not contain spaces and consist only of Latin characters, for example C:\MobileApp. Further go to Configuration -> Mobile Application -> Publish . In the window that appears, fill in the parameters:

  • Name - The name of the mobile application. The name must not be the same as the database publication name for the thin client.
  • Update the mobile application - if this parameter installed, then each time the configuration is updated, the configuration on the device will be automatically updated
  • Directory - path to the folder where the mobile application files will be stored.

Let's make sure that everything works, go to the browser at http://localhost:8080/Mobapp/, we should see the following xml file:

In the address field, enter the IP of the computer on which the configuration is published and the name of the publication itself separated by a slash. In our example, a non-standard port is used, so the address will look like this:

Click the download button, after downloading the following settings window should appear:

Set the parameters:

  • « Restart from the configurator" - The application will be automatically updated when the XML configuration file located on the web server is updated.
  • « Debugging enabled» - step-by-step debugging of the application on a mobile device is possible from the Configurator on the developer’s computer. Press the button " OK».

If after pressing the button " Download"a similar error will occur:

Now our database has been added to the mobile device, and we can launch it, click on it in the database selection list. The window that appears is empty because we haven't added any metadata objects yet. Let's start development.

  1. Setting up exchange between the Central Bank and the mobile application

Let's assume that we have a certain source database that contains only one directory: “Nomenclature”. And it must exchange information with our mobile application.

Let's go to the mobile application configurator and create a hierarchical directory called “Nomenclature”. Let's add a list form.

Let's go to the work area home page and add the “Nomenclature” directory list form there, set the “Start Page Template” parameter as “One Column”.

Click the button " Update", the application on your phone should update automatically. If not, then display a button on the panel and press it. The following window should appear on the screen:

The next step is to create a new information security. We will add the “Nomenclature” directory to it, the structure of which will completely repeat the “Nomenclature” directory of the mobile application. This database will act as a Source.

Let's create a new Web service, call it "MobileExchange". In the properties, set the URI of the “MobileExchange” namespace. In this Web service, we will add a new operation and call it “Download Products”

Now let's write code that will return a list of products from the source database in the form xml file. Let's go to the properties of the "Upload Products" operation and create new feature from the field " Method name" We will write the following code in the function:

Let's publish a Web service, for this we go Administration ->Publish on Web -Server . In the window that appears, set the name of the Web service “MobileExchange” and uncheck the “Publish thin client and Web client” checkbox. After that, press the button “ Publish».

After publishing the Web service, let’s go to the configuration of the mobile platform, open the list form of the “Nomenclature” directory and add new team“Update item” in the command panel of the form. Before doing this, it is recommended to uncheck “ Autocomplete" at this panel.

Create a new action for the “Update item” command and write the following code:

We update the configuration.

This completes the development. We go to the user configuration mode of the Source and fill out the nomenclature directory in an arbitrary way

We go to the mobile device, launch the application, and click the “Update item” button. If everything is done correctly, the following data should appear on the screen:

Conclusion

Let's summarize our work - we managed to configure and develop a mobile application from scratch and set up its exchange with another database. It is worth noting that the 1C Mobile platform allows you to do this quickly and conveniently.

So we come to 1C: Enterprise in the form of a mobile application -A short overview of the mobile application from the inside.

The mobile application is a self-contained application with its own database for working with user information. For now, mobile applications from 1C can run on the three most popular platforms - Android, Apple iOS, and Windows.


Installation of the mobile application is carried out from the “markets” on these platforms. If the application is not published, you can install it by transferring the distribution file to your mobile device.

You can configure and program the mobile application itself only in the full Configurator mode, and then assemble it using the special configuration Mobile Application Builder.
This is a huge plus, since the development of a mobile application can be carried out by a 1C configuration developer who maintains your 1C: Enterprise program.
Of course, the mobile application has fewer capabilities than the desktop platform: for example, there are no objects such as Reports, Accounting Registers, Business Processes.




Another minus - you will not be able to connect to a 1C database that runs on a desktop platform in a file or server version.


But there is functionality for using mobile advantages: when developing a mobile application, you can use the Contact Book, make a call from the application through the “ T telephony”, obtain location data through Geopositioning.

You ask: " How to work with a regular 1C database? Why is such an application even needed?

To communicate with the “outside world” there are severalmechanisms, such as Exchange Plans. They allow you to link a full-fledged 1C database and a mobile application database - approximately the same way they work distributed databases data.

A mobile application must perform the function of a mobile application and the corresponding functionality, so all data from one database to another is not completely synchronized, and they could not due to the object limitation described above.
This exchange implementation is available, for example, in a combination of 1C programs: Enterprise 8 Trade Management rev. 11 andmobile application "1C:Orders" . The databases exchange information about counterparties, customer orders, product ranges and prices. At the same time, the mobile application can work offline and, if the Internet is available, exchange data.
The mobile application looks decent, there is a visually recognizable style compared to the desktop version of 1C, as well as a set of standard operations performed with objects, such as: “Pass”, “Mark for deletion” and the like. Therefore, users of the mobile application will be familiar with the work context.

This is what the application interface looks like in the latest versions:


The second popular way of communication between a mobile application and an accounting system
1C:Enterprise 8 is work through web services

The general organization scheme is as follows: in the application solution 1C: Enterprise 8, or more simply - in the configuration, a web service is described that performs some functions on the side where the service is published and can transmit data.

Simply put: from the mobile application online you can access the 1C: Enterprise 8 accounting system, perform any function described in the service - for example, obtain data on a report or create a new counterparty

More details:

The service may transmit data in the format described in XDTO package, and the developer himself describes this data model. You can transfer primitive types: numbers, strings, dates. You can transfer complex types, you can transfer binary data - for example, pictures, or PDF documents, XLS. We will show a simple example where a package with tasks is described - task number and title. An example of what the package looks like:

In turn, inIn the mobile application, an object with type WS-Link is created. It specifies the address of the web service, after which the data types and methods that the service operates are automatically loaded:

All is ready! In the mobile application you can now call the 1C: Enterprise 8 service function or receive the necessary data.

What about licenses for mobile applications from 1C?

This issue is covered in the information letter from 1C. The excerpt is below.

Our recommendations:
Mobile applications from 1C are quite New Product, but in the usual “wrapper” - development can be carried out by a full-time 1C specialist. They open new horizons for expanding interaction with the accounting system and consolidating data for management accounting. We recommend using this option when the stationary option of working with 1C is not suitable and mobile functionality will be sufficient, for example, access to only part of the data or part of a process.

And according to tradition, the case:

Task:

The customer has central office and several points in its trading network. At each point there are several sales managers and one workplace sales of goods with an accounting program.

Wherein , the central office gives instructions to sellers- for example, collect an order for another point from your leftovers or disassemble the specified product.

To set tasks, the Customer first used email and phone calls, But -There was only one automated workstation and workers could not quickly receive tasks and respond to them. The central office had difficulties in monitoring such tasks, since when set over the phone, the task was not written down anywhere, and it was difficult to review mail for uncompleted tasks.

Solution:

We proposed the following solution. Develop the necessary functionality for setting tasks for employees based on the 1C: Orders mobile application and integrate it with the central accounting system.

As a platform for launching and working with a mobile application, an employee of a retail outlet could use his own mobile phone, and for those who didn’t have them, the central office purchased inexpensive smartphones for them.

Due to the fact that the mobile application and the central accounting system work in one information space- the efficiency of setting tasks and addressing exactly the employee for whom it was intended was achieved.

The accuracy of information transfer has increased - if previously e-mail the manager in the office wrote - “prepare goods according to Order No. ___”, but now in the task he simply indicated a link to the required order, which the point employee could open on the phone.

The level of control over tasks increased - they did not disappear anywhere and had a status that was assigned to them by the employee in the process of completing the task. And the central office could always control the task.

Anatoly Nikulin

Mobile platform "1C:Enterprise 8" is the name of the technology that allows you to develop solutions that work on smartphones and tablets Google Android or Apple iOS. An important advantage of the 1C platform is that solutions are developed in one version for both mobile operating systems and then simply exported for Android and for iOS without any additional modification and writing platform-dependent program code.

Both the 1C:Enterprise platform and the information base itself (configuration, in 1C terms) are immediately installed on the mobile device. Information base on the device contains a version of a file database (for storing various data that the user works or will work with) and the application itself (software bytecode that runs on a tablet or smartphone).

An example of a mobile client for the EDMS “Corporate Document Flow” created on the mobile platform “1C:Enterprise 8.3”

The platform supports downloading and deployment of applications by users on their devices from stores App Store or Google Play. The distribution kit contains all the components necessary to get started.

Various solutions can be created based on the 1C mobile platform, but the main solution option is mobile off-line clients for accounting systems. These solutions are designed to support mobile users in remote workplaces. Data exchange is carried out through regular synchronization with the central database. Data exchange is possible through the following mechanisms:

  • Web services
  • File sharing
  • Email
  • and other mechanisms
    An alternative option is to work online using a web client.

The developed mobile application is a separate, complete software product and can exchange data with several central databases at once. For example, in one mobile application you can implement access and work with documents from the accounting database and tasks from the enterprise document management system.


On September 28 of this year, 1C, without much noise and pathos, released an evaluation version of the platform 8.3.2.163, which was intended for testing. Full list changes and improvements, those who wish can read or, if they have a subscription, .
Of the listed improvements, the “1C Mobile Platform: Enterprise 8” seems to me to be quite “tasty”, which allows you to create an application for Android or iOS mobile operating systems using the usual 1C tools

Mobile platform, as the developers themselves write, “this is the general name for technology that allows you to create applications that run on mobile devices running operating systems Android systems or iOS."
“A mobile application installed on a device is a combination of a mobile platform and an information base.”

That is, to put it simply, you can compile your written configuration into an application for Android (.apk) or iOS (.zip). Then all this stuff can be posted on Google Play or AppStore. True, if a program for Android can be signed with the key created there immediately in 1C, and it will be ready for publication immediately, then to publish the application in the AppStore it will first have to be compiled using the Xcode program on a computer with an operating system Mac system OS X. And, of course, to publish in any of these stores you need a developer license.
Everything sounds good, and I naturally wanted to try out the new features in action.

Creating a mobile application on 1C

For this we need a new version platforms (), the file that is taken, android SDK and JDK.
I’ll warn you right away: I’m not currently setting myself the task of showing the process of developing something specific on 1C, but I just want to check and show you that - yes, the world has gone crazy and you can really write a program for Android on 1C.
Well, let's try to write a kind of “helloWorld” for Google Phone. Let's make a program for test purposes - a configuration with one general form, which we will put on the “desktop”.
So, we create a new configuration in managed mode, and the first thing we must do, if we are writing for a mobile platform, is to indicate “Purpose of use” in the properties of the configuration itself.

And here we immediately notice that many configuration objects have become unavailable for use. We will no longer be able to use subsystems, routine tasks, XDTO packages, Web services, reports, business processes and much more. Also, many procedures and methods for some objects are not available. This should be taken into account when developing.
We make a “form”, create a string attribute with the title: “Hello, Habr!” - and throw it onto the form. Let's also create a button. In click processing, we will write a message output, for example.

&OnClient Procedure Command1(Command) Warning("It works!"); End of Procedure

This is enough for us to check its functionality, so let’s get to the fun part. We save the configuration to a file for the mobile application (Configuration->Mobile application->Write to file), launch in managed mode, and start processing MobileAppWizard.epf. This file is in the mobile.zip archive, which we downloaded at the very beginning.
And now we are asked to fill out the initial settings, where all required fields are underlined in red.

Mobile platform location - the directory in which the android.zip and ios.zip files necessary to form the delivery of the mobile application are located. They are all in the same mobile.zip archive.
We indicate the folder where we installed the Android SDK (you can download it). 1C sets the following requirements:
Android SDK Tools version - no lower than 20.0.3;
Version of Android SDK Platform-tools - not lower than 14;
SDK Platform version - API 8 (not lower than version 8.3).
And we also need a Java SDK (can be obtained at this address) Moreover, 1C warns us that JDK7 does not work in conjunction with the Android SDK.
We indicate the folders where our .apk file will be placed, the location of the signing key and an alias with a password. If you are doing this for the first time and you do not have a key, then you can fill in the “key parameters” and create a key for yourself (in this case, in the “key file” field you must indicate the folder where this key will be created).
Click “OK” and go to the second window.

In it, first of all, we indicate “Mobile application configuration” - the same file that we saved. Then the language, and only then click on the button with a “magnifying glass” and enter the representation there. We indicate “Application ID” - a unique name of the Java class that will be used in the future to perform the update. The identifier must be written in Latin, and 1C recommends starting its name with “com.e1c.” Fill in the version and build number and click the “Create” button. If everything goes well, the system will notify you that the .apk file has been successfully created.
We upload the resulting file to the phone and install it with our favorite manager, having previously allowed installation in the system settings third party applications. Or install the program on the emulator via adb. I’ll say right away: on the emulator everything is terribly slow, but on the phone (I only checked it on HTC Wildfire S) things are much better, but there are still problems. For example, my file turned out to weigh as much as 34 Mb, so the installation took quite a long time. After launch, we are greeted by a splash screen, and after a while the configuration itself starts. (sorry about the photo: I took it with a calculator)

So far, the new features look very “crude”: limited functionality of 1C, impossibility using the SDK directly, plus big size and some “brakes”... But the very possibility of writing a program for a mobile platform on 1C is a little surprising! Personally, I'm of two minds about this. On the one hand, this “feature” is still more like a toy, because there is no opportunity to do something truly worthwhile. But on the other hand, this is clearly a big step by the 1C company towards mobility, and if this direction is actively developed, it can bring a lot of benefits. As an example, you can equip storekeepers with tablets. If it is possible to use “on-board” cameras, then you can free yourself from reading devices, and scan codes directly from the tablet, you can provide them to car drivers, and send transportation tasks or track the vehicle’s route and time in motion. In general, there are many options, and the fact that it will all be in one information system, will greatly please customers/managers, because for some reason they always have a panicky fear of using large quantity various systems, they want to use all the functionality on a single platform.