Running 1C mobile applications from external sources

1C Developer team

17.12.2020 7 min


Implemented in the mobile platform version 8.3.18

At the moment, the only way to run a mobile application created on the 1C mobile platform (or 1C mobile client) without directly clicking the application icon is through PUSH or a local notification.

Mobile platform version 8.3.18 will be capable of starting 1C:Enterprise mobile application (an application created on the 1C mobile platform, or 1C mobile client) from another mobile application or using some URL.

This feature may be required to solve various problems of integrating mobile applications (both external applications and services with 1C mobile applications, and 1C mobile applications with each other).

In particular, the following new features will be introduced:

·        Calling a specific function of a mobile application from another application.

·        Using some URL in order to open a mobile application on a specific object or function.

Examples of new functionality usage scenarios:

·        The user received an e-mail (SMS, message in the messenger) with a promotion using a promotional code. The user clicks the "Use" link, the 1C mobile application opens, the field with the promotional code is automatically filled in.

·        The user is sent a link to the document in the client application in the corporate 1C system (for example, in an email, or through the Collaboration System). When the link is clicked, the mobile application starts and the required object opens.

To implement calling a mobile application from another application, deep linking features are used. A deep link is a URL that points to a resource on a website or in the application. And deep linking is a feature that allows a mobile operating system to associate a URL and a mobile application installed on a device.

A deep link can be generated in two ways:

·        Using proprietary schema (e.g. myfuncapp://). In this case, the call URL will be myfuncapp://comand?params.

·        Using the HTTP(S) schema. This method assumes that the deep link URL belongs to the http:// or https:// schemas. Deep linking, in this case, is only available using a real website, which must be accessible by the mobile application developer (or, more globally, the entire application-site integration scheme). This access is required to place certain files in a specific directory of the site (from a deep link).

Added the feature to implement a new handler in the application module:

Procedure NavigationByURLProcessing(URLNavigationData, StandardProcessing)

            // Insert handler content.
EndProcedure


In case of following a deep link in the mobile application, this handler will be called.

Feature usage example

Assume, we want our mobile application to be able to run externally with navigation links generated using myapp schema as well as links starting with https://my.site.com/path/for/service.
To do this, we need to do the following:

1.     Create a my.site.com website with all nested structure my.site.com/path/for/service and make it accessible via https. In addition, certain files must be placed on the website (as described above, see the documentation for more details).

2.     In our configuration, we need to implement a NavigationByURLProcessing() event handler. This handler will receive full information about the URL, clicking on which caused transition to our mobile application, as parameters.

3.     Specify which schemas or URL fragments the configuration is "subscribed to" (via the new "Mobile application navigation links" property) in the Designer.
1

4.     Specify which configuration of the mobile application being built will handle which scheme or URL in the mobile application builder. Also, using a builder, the mobile application being built receives all the settings that are needed to implement the application's response to deep links.

The following sequence of events will occur on a mobile device, during the operation of our application:

  • Once installed on a mobile device, the application registers deep links in the mobile operating system, which it (the application) can handle.

  • When a user navigates via deep link, the mobile operating system determines which application is handling that link.

  • The application found is started and the deep link used is passed to that application for parsing by the application itself.

  • In the mobile application, the ОбработкаПереходаПоНавигационнойСсылке event handler is triggered, which receives a deep link as input, which caused the mobile application to run.

Starting a 1C mobile application in Android using intents

When starting a 1C mobile application via a URL, we can pass additional parameters only in string form. In addition, there is a limitation on the length of the URL (it depends on the specific OS version).
In Android, we additionally supported the feature to start 1C mobile applications from other applications via intents. This allows various data kinds to be passed to the application (for example, arrays), which increases the amount of information passed to the application.

As an illustration, here is the 1C code (similar code can be written in any language supported by Android):

Running = New MobileDeviceApplicationRun("android.intent.action.VIEW","myappfunc://testPath?key1=" + numericParameter); 
Running.AdditionalData.Add("key2", stringParameter);
If Running.RunningSupported() Then

               Running.Run(False);
EndIf;

Consider the following when using this functionality:

·        Currently only android.intent.action.VIEW action is supported.

·        The myappfunc:// schema must be listed as supported for Android OS in the mobile application being built.

In this example, two parameters are passed to the called mobile application:

1.     The key1 numeric parameter is passed directly to the deep link URL.

2.     The key2 string parameter is passed by explicitly specifying the parameter in the object's additional data list that describes the intent call.

For the called mobile application to react to this call, a handler of the following type must be described in the client application module:

Procedure NavigationByURLProcessing(URLNavigationData, StandardProcessing)

               baseURL = URLNavigationData.BaseURL;
               path = URLNavigationData.RelativeURL;
               extrasData = URLNavigationData.MobileApplicationNavigationExtrasData;      
               parameter1 = URLNavigationData.URLOptions.Get("key1");
               parameter2 = extrasData.Get("key2");
               textMessage = "The link was launched:" + Chars.LF +
                              "Base URL: " + baseURL + Chars.LF +
                              "Relative URL: " + path + Chars.LF +
                              "Parameter 1: " + parameter1 + Chars.LF +
                              "Parameter 2: " + parameter2;

                Message(textMessage);
                StandardProcessing = False;

 EndProcedure


Be the first to know tips & trick on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.