Building a 1s mobile application. How I stumbled in the "mobile application builder" configuration. An example of developing a mobile application for an online store courier using the "Mobile Application Builder"

Building a 1s mobile application. How I stumbled in the "mobile application builder" configuration. An example of developing a mobile application for an online store courier using the "Mobile Application Builder"

This article is for those who are interested in the mobile client. We will look at installing a mobile client on Android, connecting debugging and assembling an apk application in the “Mobile Application Builder” configuration.

Finally, the test mobile platform 8.3.12 has appeared, and now we can test the operation of the mobile client. I don’t know about you, but many developers I know have been waiting for this since the publication of the article on “1C: Through the Looking Glass” (Mobile client).

I assume that you are familiar with installing a mobile application and the mobile application builder, and also that you already have Android SDK, Apache Ant, etc. installed. There are already plenty of articles on this topic.

For our experiments, let’s take the “Managed Application” demo configuration and, first, let’s try to connect it to a ready-made mobile client. In my case, the client distribution is the file “1cem-client-arm.apk”. The ability to install applications from unknown sources must first be enabled on your smartphone. For me it looks like this:

The mobile client is an analogue of the web client, therefore, to access the database, it must be published on the web server. Everything is standard here, I publish to an IIS web server named “demo”. My database is file-based, so I need to give rights to the directory to the IUSR user. I'm glad that the system itself reminded me of this.

Connect the database in the mobile client:

Of course, it was not possible to enter the database right away. The whole point is that the Administrator opens processing for working with email and tries to set an icon for the taskbar, which is not present in the mobile client. Since this functionality is also not available in the web client, the code is framed in compilation directives “#If Not WebClient Then”. We just need to find all the places where this directive is used and change it to “#If Not WebClient AND Not MobileClient Then”. For starters, this is quite enough, and we can finally see the mobile client working. The command interface looks like this:

Here is the list of counterparties:

Of course, these are not all the places that need to be adapted for the mobile client. You can check the configuration using “Main menu - Configuration - ---Check configuration”:

I found 84 errors, including unsupported metadata objects. Plus those three places in the code that I have already limited with directives. So you still have to work on adaptation, but this is certainly not the same as writing a mobile application from scratch.

Launching under other roles occurs the same way, you just need to set the right to launch the mobile client.

If we don’t understand what the error is, debugging will help us. It is available in the mobile client, but only HTTP debugging is used. I have a file database, so I will use the local debugging server (“Tools - Options - Debugging”) and set up an automatic connection for the mobile client (“Debugging - Connection - Automatic connection”):

Specify the parameters and you're done:

The setup for the pre-prepared apk client from 1C is complete.

Now let's build our apk using the mobile application builder. Frankly, I spent several hours trying to build the application the first time. The assembly proceeded, but an empty list of databases opened.

And so, we have an archive of the mobile version of the platform. We upload it to the “Mobile versions” directory:

In the collector settings, a separate item has appeared for SDK 26 and higher (for those, like me, who have not updated for a long time, launch the SDK Manager and download new packages):

Next you need to prepare a configuration file. It was with this step that I had problems at the very beginning. Then I opened the documentation and everything became a little clearer. The developer's guide says the following about this: "Each configuration that can work in the mobile client contains some auxiliary information that allows you to track the configuration substitution."
The configuration file must be signed. In this case, for each configuration its own private key is generated, and the public key (DSAKey field) is uploaded to the 1cemca.xml file, with which the configuration signature is compared.

To generate a key and signature, go to the properties of the “Mobile client signature” configuration (immediately under the required permissions, if your properties are divided by category and not alphabetically) and see the signature settings:

First, we create a private key and hide it from spies and enemies. Next, we create a configuration signature. For the future, the manual advises going to “Main Menu - Configuration - Mobile Client - Setting up the use of the mobile client.” In the dialog, select the “Verify mobile client signature when updating the database configuration” checkbox and click the “OK” button. Judging by the manual, the signature will change if we change the composition or names of metadata object types, as well as the names and/or composition of register entry keys. Those. changing the forms definitely does not affect the signature and, judging by the description, changing the composition of the details of existing directories and documents (but this is not certain).

The signature is ready, we can continue. Let me tell you right away that background processes are not available in the mobile client, so they need to be disabled in the mobile client permissions. File sharing from a PC is also not available. I additionally disabled geopositioning so that during assembly there would be no error due to the lack of a key for working with maps. I ended up with the following list of permissions:

An example of developing a mobile application in 1C:Enterprise 8.3 for the work of an online store courier when delivering goods to customers. The "Mobile Application Builder" configuration was used for development.

An example of developing a mobile application for an online store courier using the "Mobile Application Builder"

So, we have developed a mobile application for the work of an online store courier when delivering goods to customers. Of course, it is quite schematic and cannot cover all the tasks that actually arise during the work of a courier. But it implements all the functionality that we wanted to show in this book.

Now, after the development is completed, all we have to do is assemble our mobile application into one file and download it to the tablet.

Although we will use a special configuration for assembly Mobile Application Builder, which facilitates the assembly process, is still not easy or quick to do for the first time. Therefore, you need to be patient and carefully and carefully follow the sequence of actions described below.


Where to download and how to install Mobile Application Builder

Configuration Mobile Application Builder supplied as part of the mobile platform. In the first chapter of the book, in the section “Mobile platform 1C: Enterprise”, we unpacked the archive with the mobile platform onto the computer. In this directory there is a MobileAppMaker folder with a Setup.exe file for installing the configuration template. Let’s run this file and install the configuration template into the “1C:Enterprise” templates directory (Fig. 5.1).

Rice. 5.1. Installing the Mobile Application Builder configuration template

Then we will add a new information base to the list of information bases “1C:Enterprise” and create an information base from the previously created template (Fig. 5.2).

Rice. 5.2. Creating the “Mobile Application Builder” information base from a template

Then we will open this database in the configurator and add the Administrator user with the 1C:Enterprise Authentication properties, the Administrator and User roles and the Russian language (Fig. 5.3).

Rice. 5.3. Creating an "Administrator" user

Let's save the configuration, close it and open it in 1C:Enterprise mode as the Administrator user. Now this database is empty. We must fill it with all the necessary parameters for the assembly, which will be saved and used for further assemblies.

First (if the database is empty), general help information about the mobile application builder opens on the application's initial page. You can also access it from the main menu – Main Menu > Help > Help Contents > Mobile Application Builder. In addition, additional help pages about assembling mobile applications are opened from individual configuration forms (Fig. 5.4).

Rice. 5.4. Mobile Application Builder configuration help


Configuring Application Solution Parameters

First we have to configure the collector settings. To do this, from the Tools menu, call the Application Settings item. We will not be building a mobile application for Apple now, so we will leave the corresponding checkbox empty.

In the settings form, we need to fill out the table Component directories on computers participating in the build process, which will contain the paths to the software components necessary to build the mobile application. To do this, click the Create button above this table (Fig. 5.5).

Rice. 5.5. Creating a table entry “Component catalogs...”

The Component Paths form will open. By calling help from this form, you can see links to obtain software components and their descriptions (Fig. 5.6).

Rice. 5.6. Help describing paths to components

First you need to install the Java SDK and in the JDK field indicate the directory in which this component is installed. The Java SDK can be obtained from: http://www.oracle.com/technetwork/java/javase/downloads/index.html. It is recommended to download the Java Platform Package (JDK).

On the page that opens, at the top you need to click on the Download button (Fig. 5.7).

Rice. 5.7. Getting the Java SDK

On the next page you need to accept the license agreement (check the Accept License Agreement box) and click on the link with the desired distribution in the Download column (for 64-bit Windows - this is the jdk-8u60-windows-x64.exe package), Fig. 5.8.

Rice. 5.8. Getting the Java SDK

The resulting installer needs to be launched and the Java SDK installed, for example, in the directory: C:\Program Files\Java\jdk1.8.0_60 (Fig. 5.9).

Rice. 5.9. Installing Java SDK

Then this path must be specified in the JDK field of the form for setting paths to components of the Mobile Application Builder application (Fig. 5.10).

Rice. 5.10. Configuring paths to components of the Mobile Application Builder application

In the next field of the configuration form, Working directory and builder cache, you need to specify any directory in Latin in which the build program will place service files. The user on whose behalf the mobile applications will be built must have full rights for this directory (Fig. 5.11).

Rice. 5.11. Configuring paths to components of the Mobile Application Builder application

In the Android SDK field, specify the path to the directory where the SDK Manager is located. We installed the Android SDK in Chapter 1, in the “Android SDK” section (Fig. 5.12).

Rice. 5.12. Configuring paths to components of the Mobile Application Builder application

Then you need to install Apache ANT and in the Apache ANT field specify the directory in which this component is installed. Apache ANT is required to build a mobile application for Android OS. Apache Ant can be obtained.

From this page we need to download the apache-ant-1.9.6-bin.zip archive (Fig. 5.13).

Rice. 5.13. Getting Apache ANT

Unzip this file to your computer and specify the path to it in the form of setting paths to components (Fig. 5.14).

Rice. 5.14. Configuring paths to components of the Mobile Application Builder application

Then you need to install the PuTTY system and in the PuTTY field specify the directory in which this component is installed. PuTTY can be obtained.

PuTTY is used if you are building a mobile application for Apple. To build mobile applications, the pscp.exe and plink.exe utilities are required. Just in case, let’s download the entire installation package putty-0.65-installer.exe (Fig. 5.15).

Rice. 5.15. Getting PuTTY

The resulting installer needs to be launched and PuTTY installed, for example, in the directory: C:\Program Files (x86)\PuTTY (Fig. 5.16).

Rice. 5.16. Installing PuTTY

Then we indicate the path obtained when installing PuTTY in the form for setting paths to components (Fig. 5.17).

Rice. 5.17. Configuring paths to components of the Mobile Application Builder application

This completes the configuration of component paths. Click Record and Close.


Configuring Provider Options

Now we need to configure the provider settings. To do this, call the Edit supplier parameters item from the Tools menu.

The Suppliers form will open, in which you need to specify an arbitrary name of the supplier on the General parameters tab, and also set the Application ID Prefix. This field must be filled out in Latin and begin with the line “com”. The rules for filling out this field can be found in the contextual help, which can be opened by clicking the button with the “?” sign.

Then you need to note for which operating systems the mobile application is being built. In our case, select the For Android OS checkbox.

To work with push notifications through the auxiliary service “1C:Enterprise” we will specify the parameters for accessing the service. To do this, click the Add button above the table at the bottom of the supplier form. In the window that opens, Settings for access to the auxiliary service “1C:Enterprise”, check the Register for – selected user option, select the collector user – Administrator and indicate the email address and password under which we previously registered on the service when testing work with push notifications. Click the Save and Close button. In addition, you can register for the 1C:Enterprise service directly from this form using the Register in the 1C:Enterprise service button, if this has not already been done (Fig. 5.18).

Rice. 5.18. Configure Mobile App Builder app provider settings

In addition, you can call the window for setting parameters for access to the 1C:Enterprise service from the Tools menu, item Access parameters for the 1C:Enterprise service.

After this, you need to fill in the Developer Key group of fields on the Settings for Android OS tab. To do this, first create a developer key by clicking on the Create a developer key link. In the Create a developer key form that opens, fill in the fields randomly (for the Country field you need to specify the code of Russia in the ISO standard - ru) and click the Generate key button (Fig. 5.19).

Rice. 5.19. Configure Mobile App Builder app provider settings

After this, the developer key parameter fields will be filled in automatically (Fig. 5.20).

Rice. 5.20. Configure Mobile App Builder app provider settings

The value in the SHA1 Hash field of the developer key will be used in the future to obtain the key for working with Google maps. This value is required if the mobile application will use geolocation tools on the Android platform.

This completes the configuration of the supplier parameters. Click Record and Close.


Loading the mobile platform

Now we need to download the 1C:Enterprise mobile platform, under which the assembled mobile application will run. There may be several versions of the mobile platform, but they must be no lower than version 8.3.4.

The Mobile Platforms directory is intended for downloading and storing different versions of the mobile platform. A separate entry must be created for each platform version in this directory.

From the application command panel, open the Mobile platforms directory and click the Create button. After this, a file selection dialog will appear in which you need to select the file with the archive of the mobile platform mobile.zip, which we saved on the computer when receiving the mobile platform in the first chapter of the book, in the section “Mobile platform 1C: Enterprise”. Select it and click the Open button.

If the platform is successfully loaded, the form for creating a directory item Mobile platforms will open, in which the Mobile platform version and Name fields will be filled in automatically, and the Mobile platform files loaded checkbox will appear (Fig. 5.21).

Click Record and Close.


Loading mobile configuration

Now we need to load the mobile configuration of the Courier Online Store that we have developed. Let's open this configuration in the configurator. In the configuration properties palette, set the properties Vendor – myfirm and Version – 1.0.0 (Fig. 5.22).

Rice. 5.22. Properties of the mobile configuration of “Courier Online Store”

Then we will upload this configuration to a file by executing the configurator command Configuration > Mobile application > Write to file...

The Mobile Configurations reference book is used to download and store different versions of mobile application configurations. The directory assumes a two-level structure: groups describe application solutions, and elements in the groups represent different versions of the configurations of these application solutions. To download a new version of the configuration, you need to go to the group corresponding to the application solution and create a new element in this group.

From the command panel of the application, open the Mobile Configurations directory and click the Create group button with the name of our configuration Online Store Courier (Fig. 5.23).

Rice. 5.23. Creating a directory group "Mobile configurations"

Then in this group we will create a new directory element.

After this, a file selection dialog will appear in which you need to select the 1cema.xml file into which we just saved our mobile configuration. Select it and click the Open button.

If the configuration is successfully loaded, all form fields will be filled in automatically and should not be changed manually. The permissions table will indicate all the permissions for the mobile application to work with multimedia, geopositioning, notifications, etc., which we set during its development. In addition, messages will be displayed about the impossibility of working with calendars and contacts, permissions for which we did not set (Fig. 5.24).


Click Record and close.


Description of mobile application parameters

Now we need to describe the parameters of the mobile application that we will collect in the Mobile Applications reference book.

The reference book should have a two-level structure, where the group describes the main assembly parameters, and the group element specifies the assembly parameters for a specific version of the mobile application. A separate group must be created for each mobile application, and for each version of the mobile application in this group you must create its own element.

From the application command panel, open the Mobile Applications directory and click the Create group button. In the form that opens, set the name of the mobile application Courier Online Store.

We have only one supplier - My company. It will fill in automatically. The For Android OS checkbox will also be selected. Leave the Mobile platform field empty - the latest version of the platform will be automatically used during assembly.

In the Solution ID field, enter an arbitrary string in Latin. The next field will be filled in automatically (Fig. 5.25).

Rice. 5.25. Creating a directory group “Mobile applications”

After this, the Parameter for obtaining a key for working with Google maps field will be automatically filled in (the value of the parameter Hash SHA1 of the vendor developer key My Company from the supplier settings form is inserted into this field, see Fig. 5.20 + solution identifier line) - we will need this to obtain the key for working with Google maps. To do this, we must contact the Google service and, after receiving the key, write it down in the Key for working with Google maps field.

Mobile application development is always associated with the need to learn additional technologies. What if we reconsider the question and use already familiar tools?

For the first time, the 1C company tried to enter mobile development market in 2006 year. At that time, there was a real rush to automate the work of remote employees using PDAs. New programs for solving such problems appeared like mushrooms, and a vendor like 1C with successful products for automating various business areas could not miss the chance to enter a profitable market.

By mid-2006, the company presented the release of a new product with the promising name “1C:Enterprise 8. Extension for handheld computers.” 1C developers, who saw the prospects of the 8th platform, began to hope that now, using one tool, it became possible without much difficulty to develop for the mobile operating system “Windows Mobile”, which was popular in those years.

In practice, everything looked much worse. This tool did not allow us to implement original ideas. Plastic bag " Extension for handheld computers» was more of an add-on for certain typical configurations than a full-fledged development solution. There was no provision to expand the configuration functionality by adding new metadata objects. Very simple things were left to third-party programmers: creating new forms for user interaction, processing user events.

Yes, there were all sorts of workarounds for the restrictions, but even they didn’t allow for real development. In addition to technical limitations, consumers felt a serious financial barrier. Companies that decided to implement the solution from 1C were required to purchase productive PDAs, purchase licenses for Windows Mobile, and also pay 1C for the delivery of the solution and the final application.

The solution from 1C was too expensive. Companies accustomed to saving money continued to use alternative solutions. Moreover, the developers of alternatives managed to equip their products with functionality for interaction with standard 1C solutions.

Technical limitations and high cost did not allow the product to repeat the colossal success of the desktop platform. The idea to conquer the mobile market of the building.

applications failed miserably.

Step forward

The loss and losses from an unsuccessful project did not put an end to the development of a promising direction. In 2013, the 1C company introduced the first stable version of the new platform 8.3, which has the function of developing mobile applications.

1C completely rethought its approach to solving the mobile “theorem” and took into account the mistakes of the previous unsuccessful product. The result is a completely new tool that has nothing in common with its predecessor and is focused on the most current mobile platforms - Android and iOS.

Mobile applications in 1C style

To fully get acquainted with the development capabilities for mobile platforms, we will try to develop a small configuration. Using an end-to-end example, you can better evaluate the available functionality and decide on the possibility of using the 1C platform to solve problems.

To work, you will need the latest release of the 1C:Enterprise 8.3 platform. The educational version of the distribution is available on the official 1C website. There is more than enough to recreate an example of its capabilities.

In addition to the 1C:Enterprise 8.3 platform, we will need a number of additional tools. This article will look at an example of developing an Android application. In this regard, you will have to download: Android SDK and Apache WEB server. The first component contains everything needed to build the application and an emulator for testing, and the WEB server is useful for quickly downloading the application to the mobile OS.

We will also require delivery of a “Mobile Developer Platform”. It contains a configuration to simplify the process of building the created mobile application, as well as a mobile developer platform. It must be installed on a mobile device or emulator.

To build an application ready for distribution via Google Play, you will need to download Apacheant And JavaJDK. This topic is beyond the scope of the article, so you can find out more about working with these tools and assembling the application in the corresponding section of my.

Configuring tools

Platform " 1C:Enterprise 8.3" and the Apache web server are supplied with installers and are installed in a standard way. Android SDK you just need to unzip it into a separate directory and run “ sdk manager.exe" A window will appear in front of you with a selection of available packages for installation. To test the example discussed in this article, you will need to select and install: Android SDK Tools, A ndroid Platform Tools, SDK Platform API 17.

The last step will be to create a new information base. For those who are not involved in development under " 1C:Enterprise“I’ll explain that any solution for this platform consists of an information base and configuration. Adding a new database is done by clicking the " Add» start window. After adding the database, open it in " Configurator».

First mobile configuration

In the main menu of the configurator we will find the section “ Configuration" and select "Open configuration". The configuration tree (the objects that will make up the future application) will be displayed on the left side of the window. Select the configuration root in it and press the key combination “ Alt+Enter" The properties editor will open in the right part of the configurator window.

Let's call the configuration " TODO" and in the "Purpose of use" property we indicate " Mobile device" Please note that after performing the last action, some nodes of the configuration tree will become inactive. Unfortunately, it is not possible to use all metadata objects on the mobile platform.

To solve our problem, we will need to create several metadata objects in the configuration tree:


Procedure AddTask(Task) ExportRecordManager = CreateRecordManager(); RecordManager.Period = CurrentDate(); RecordManager.Task = Task; RecordManager.Status = Task.Status; RecordManager.Record(); End of Procedure

Listing 2. Code of the function “Get List of Unclosed Tasks()”

Function GetList of UnClosedTasks() Export Request = New Request; Query.Text = "SELECT |TaskStatusSliceLast.Task AS Task, |TaskStatusSliceLast.Task.ExecutionDate AS ExecutionDate |FROM |Information Register.TaskStatus.SliceLast(&CurrentDate, Status<>VALUE(Enumeration.TaskStatuses.Completed)) AS StateTasksSliceLast | |ORDER BY | Execution Date DESC"; Request.SetParameter("CurrentDate", CurrentDate()); Return Request.Execute().Unload(); EndFunction

We've sorted out getting data from the information register and recording it, now let's teach our directory how to work with the register. To do this, add a common module to the configuration tree with the name “ Working With Tasks" You can do without it, but I would immediately like to focus on the possibility of breaking the code into modules. Many 1C developers still neglect this recommendation and describe all the logic in one place, thereby complicating subsequent code maintenance. Let's create a new procedure in the module " Create NewTask"(see Listing 3).

Listing 3. Code for the “Create NewTask” procedure

Procedure CreateNewTask(Link) Export If Link.ThisGroup Then Return; endIf; Request = New Request; Query.Text = "SELECT |TaskStatusSliceLast.Status |FROM |Information Register.TaskStatus.SliceLast(&CurrentDate, Task = &Task) AS TaskStatusSliceLast"; Query.SetParameter("CurrentDate", CurrentDate()); Request.SetParameter("Task", Link); Result = Query.Run().Select(); If Result.Next() Then If Result.Status<>Link.Status Then Information Registers.Task Status.AddTask(Link); endIf; Otherwise Information Registers.TaskStatus.AddTask(Link); endIf; End of Procedure

Before creating a new record, a check is made for the presence of existing records for the task. If the record already exists, then you need to compare task statuses. If the status from the register does not differ from the status of the element being written, there is no need to create an additional entry.

As a finishing touch, let’s open the form of the “Tasks” directory item and create an event handler “ AfterRecordingOnServer" In it we will write a call to the procedure described in the third listing:

WorkWithTasks.CreateNewTask(CurrentObject.Link);

We are working on the interface

The main functionality of the application is ready - the user can create tasks, and each new task creates an entry in the periodic information register. Now let's move on to the interface. Let's bring work with tasks to the forefront. Surely it would be logical to immediately display a list of unclosed tasks and the ability to create a new one immediately after launching the application?

Let's find the node " General forms" and add a new form called " Desktop" Let's open the created form in the interface designer and add an attribute like " Table of Values" Let's call it “OpenZachi”. The table will contain two columns - “ Task"(Reference Link.Tasks) and " Execution Date" (Date of).

The next step is to drag the added props onto the form. We should have an interface for a simple table. We won’t specify any dimensions; we’ll leave the worry of scaling the interface to the platform.

For the created table, in the Property Inspector, set the checkbox for the property " View only", and the property " Command Panel Position» set the value “No”. We will fill the table with dynamic information, so there is no point in editing it on the user's part.

Now let’s describe the “When CreatedOnServer” event handler for the form. Let's add one line of code to it:

OpenTasks.Load(InformationRegisters.TaskStatus.GetListofUnClosedTasks());

In the code, we refer to the procedure we described " Get the List of Unclosed Tasks” and the result of its execution is placed in the table.

Let's go back to the form designer and add a group of type “Regular group without display” with two buttons: “ Create" And " Update" Property " Grouping"For the added group, set the value to "Horizontal". To make the buttons more expressive, add images and change the default font.

Now select the button " Create" and give it the global command " Tasks: create" This will allow you to create tasks without entering the directory itself. By clicking the second button, we will update the contents of the table with tasks. To do this, you will need to create an additional form command.

All new form commands are created on the tab of the same name " Teams" The principle is simple - we add a new command, describe the action code in it and then associate the command with the interface, in our case with a button.

We should also not forget that we are developing a managed application, so we need to clearly distinguish between client and server code. When the button is clicked there will be a context " OnClient", and we will receive data from the database from the server. In code it looks like this:

&On the Client Procedure UpdateTaskList(Command) UpdateList(); End of Procedure &On the Server Procedure When Created on the Server (Failure, Standard Processing) OpenTasks.Load(InformationRegisters.TaskStatus.GetListofUnClosedTasks()); End of Procedure

Now let's define our desktop form as the home page area. Open the configuration properties (select the topmost node and click “ Alt+Enter") and for the property "Working area of ​​the home page" set the value " One column", then add our form to the list " Desktop».

The application is completely ready and it's time to test it in action. Try running the example and creating several tasks with a status other than " Completed" The information register has been replenished with new entries (this can be viewed through the menu item “ All functions") and some of them are displayed on the desktop.

Landing on Android

The configuration works great on the desktop, and now is the time to test it on a mobile OS emulator. To prepare a new emulator, run the command interpreter ( cmd.exe) and go to the “toos” directory of the Android SDK distribution. Run the command " android.bat avd", which will launch the virtual Android device manager. In it, click the “Create” button and in the window that appears, specify the parameters of the virtual device. In my work environment I decided to emulate Nexus S with Android version 4.2.2. (API Level 17).

After creating the device, we will immediately launch it. While Android is loading, let's return to the configurator and publish our application on the web server. In the main menu of the configurator, select the item “ Configuration» -> « Mobile app» -> « Publish" In the publishing settings window, we specify the name of the application (can be anything), the web server (in our environment there should be one) and the directory for storing the settings.

Specifying as the name " todo-mobile", the application will be available at the address - " http://host/todo-mobile" Click “ok” and try to access the published application using a browser. If successful, the server will return the XML code of the created configuration.

Let's return to the emulator and load the application with the mobile developer platform into it. The application file itself is available along with the delivery of the mobile developer platform and is called “1cem-arm.apk”. To install this application in the emulator, we will use the utility “ adb.exe" from directory " platform-tools»: adb.exe install –r 1cem-arm.apk.

After successful installation, open the list of applications in the emulator and launch the mobile developer platform. In the window that opens, click “ Add application" and in the "address" field we indicate the URL to our web server. I have this http://192.0.168.106/todo-mobile. Click " Add"and our configuration is successfully transferred to the mobile platform. The application is ready to use. Test the result and return to the configurator, it’s time to provide the applications with “mobile functionality”.

Sending SMS/MMS messages

Functions for working with SMS/MMS messaging is supported differently by mobile platforms. For example, when running an application on Android, the developer has the opportunity to subscribe to SMS and gain access to new messages immediately after receiving them. Unfortunately, this same feature is not available on iOS, so documentation should be at hand during development.

An object is provided for sending SMS messages SMSMessage. Let's look at an example:

&OnClient Procedure SendSMSMessage(Recipient, MessageText) NewMessage = New SMSMessage(); NewMessage.Text = MessageText; NewMessage.Recipients.Add(Recipient); Telephony Tools.SendSMS(NewMessage); End of Procedure

The code is quite simple and hardly needs comments. Now let's look at subscribing to incoming messages:

&On the Client Procedure ConnectMessageReceivingHandler() SubscribeToMessages = New AlertDescription("ProcessingNewMessages", ThisObject); Telephony Tools.ConnectSMSMessageHandler(SubscribeToMessages); End of Procedure &On the Client Procedure Processing New Messages (Message, Additional Parameters) // Processing a new message // Message. Sender, Message. Text; End of Procedure

Procedure " Processing New Messages" will be called every time a new SMS is received. Through the parameter " Message" an object of type " is transmitted SMSMessage» and we can easily obtain the text of the message and information about the sender.

Working with MMS messages is performed in the same way. First we create an SMS message, and then we add an attachment (for example, images) to it. With this simple action, an SMS turns into an MMS:

NewMessage= New SMSMessage(); Attachment = New MMSAttachment; Attachment.Data = Image; Attachment.ContentType = "image/jpeg"; MMSMessage.Attachments.Add(Attachment);

Making calls from a mobile application

A programmatic call is made using the “Dial Number” method of the global object “Telephony Tools”. Before calling the method, it is highly advisable to check the possibility of making a call:

If Telephony Tools.SupportedDialing() Then Telephony Tools.DialNumber(PhoneNumber, CallImmediately); endIf;

Parameter " Call Immediately» affects dialing performance. When it is equal to " True", dialing is performed automatically through the standard calling application. If set to False, the user will also see the standard dialer interface, but will need to press the button to make a call. Call».

Call log

The mobile platform allows the developer to interact with the call log. For example, you can easily get a list of outgoing, missed or incoming calls. This feature is only supported on Android:

Call Log = Telephony Tools.GetCall Log(); Selection = NewDataCompositionSelection; Selection Element = Selection.Elements.Add(Type("DataCompositionSelection Element")); SelectionElement.LeftValue = NewDataCompositionField("CallType"); SelectionElement.ComparisonView = ComparisonTypeDataLayout.Equals; SelectionElement.RightValue = CallLogCallType.Missed; SelectionElement.Use = True; List of CallLog Entries = CallLog.FindRecords(Selection); //The List of Call Log Entries will contain a collection of entries

Geopositioning

Almost any modern smartphone has geolocation functions. You can use this functionality from the built-in 1C language. Obtaining the current coordinates of the device can be divided into 2 stages: selecting a geopositioning provider and processing the received coordinates:

//Let's provide the choice of provider to the platform IdealProvider = Geopositioning Tools.GetMost AccurateProvider(); Coordinates = GeoPositioningTools.GetLastLocation(IdealProvider); //If the coordinates were received a long time ago, then update If Coordinates = Undefined OR CurrentDate() – Coordinates.Date > 3600 Then Geopositioning Tools.UpdateLocation(IdealProvider, 60); Coordinates = GeoPositioningTools.GetLastLocation(IdealProvider); endIf;

Working with multimedia features

The developer has the opportunity to take pictures, videos, and audio recordings using the built-in language: Take a Photo(), Make a video recording(), Make an audio recording().

Which mobile OS is better to develop for on 1C?

Despite my love for Apple technology, it is best to create mobile applications using the 1C platform for Android. There are several reasons for this, but the most important one is the supported functions. Unfortunately, many necessary things are not supported under iOS. For example, the inability to programmatically subscribe to SMS messages or interact with call logs may make it impossible to implement some ideas. Android is more friendly in this regard. Don't forget about the cost of the devices themselves. Not every company will be ready to splurge on purchasing mobile devices from Apple.

Instead of completing

Platform " 1C:Enterprise 8» has proven in practice its readiness to become a simple tool for developing corporate development. Applications for mobile platforms. The examples discussed in the article are additional confirmation of this. It is not at all necessary to spend resources on learning native tools if the functionality of the application fits into the capabilities of the mobile platform and the company is dominated by 1C products.

Somehow quietly and without any special descriptions of the work, 1C released the “Mobile Application Collector” configuration, which is intended to become a kind of organizer for the development of mobile applications.

In the current latest version 1.0.3.17 there are several minor problems that at first glance look like bugs.

The first problem we encounter is the impossibility of launching the configuration without a user, we get the following error:

“The configuration version is different from the infobase version. It is necessary to update the configuration by running the application solution as a user with Administrator rights

This problem can be solved quite simply; you just need to launch the configurator and add a user with “Administrator” rights.

The second problem occurs when we try to create an element in the “Mobile Configurations” directory. We click the “Create” button and get the error “Items can only be created in groups”:

No problem, we click the “Create Group” button and suddenly again we receive the error message “Items can only be created in groups.”

The solution is to do the following:

On the top panel there is a “Create” button that brings up a submenu. In it, click on the “Mobile configuration” item:

After which a fairly friendly window opens, in which you can create groups:

There is also a problem when creating a directory item “Mobile applications”, we receive the following error message:

"The application ID prefix is ​​not set in the provider settings":

The exit is also quite close:

And we begin to enter data into the “Mobile Solution Providers” directory element.

The prefix must have a “dot” inside. And click “Create developer key”.

views