Support for new features of mobile devices

1C Developer team

28.08.2019 10 min

We continue to expand our support for functionality specific to mobile devices. The new features that we have implemented in the platform will allow you to develop more convenient and functional applications.

Improved notifications

Some time ago, we taught mobile apps to work with push and local notifications. If a notification arrives on a phone at the time when the application is not active or is not running, it is processed by the operating system. For example, it can play a sound to attract the user's attention.

And if a notification comes at the time when the application is active, it is delivered immediately to the application, where it is processed by the notification handler assigned by you. Previously, 1C:Enterprise did not offer a feature that would attract the user's attention while 1C:Enterprise script is executed. We do offer it now.

We have added a new PlaySoundAlert() method to the MultimediaTools object. It plays back a brief sound and/or vibrating alarm on your mobile device. You can choose either a standard sound signal or use an audio file that you included in the mobile application.

Audio playback

The mobile platform was already able to create audio recordings in the past. Now we have expanded its capabilities by adding several new audio playback methods to the MultimediaTools object.

If necessary, you can use the GetAudioDuration() method to find out how long the audio is in seconds. You can use PlayAudio() and StopAudioPlayback() methods to start and stop playback.

When you start playback of audio recordings, you can assign a procedure that will handle playback stopping or interrupting events. In this procedure, you will be able to see the second, at which the playback was interrupted. If you wish to continue audio playback, you will need to specify the second, from which the playback must be started, in the PlayAudio() method.

Speech synthesis

Our mobile platform now offers a brand-new feature - text playback using a speech synthesizer on a mobile device.

Firstly, you can use new methods of the MultimediaTools object to find out if your mobile device is capable of playing the text back in the language of your choice. For this purpose, we have implemented a new TextPlaybackSupported() method.

Two other methods, PlayText() and StopAudioPlayback() respectively, allow you to start and stop text. You can choose the language, playback speed, and timbre of the synthesized voice. Similarly to when you start playback of audio recordings, you have the option to assign a procedure that will handle text playback stopping or interrupting events.

Using 1C:Enterprise script for call handling

Our mobile platform already supported several telephony functions in the past. Now you have the ability to use 1C:Enterprise script to handle different events associated with telephone calls ("incoming call”, “answer a call”, “end a call", and other events). To this end, we improved the TelephonyTools object.
Phone call handling functionality is not available in all mobile operating systems, but only in Android. Therefore, we have implemented the CallHandlingSupported() method. You can use it to find out if call handling makes sense.

If the functionality is supported, the only thing you need to do next is to attach the procedure that will handle calls. You can do it using the new AttachCallsHandler() method.

This procedure is called when a new call is coming in, when a call is answered, and when a call is ended. The procedure has several parameters. First of all, it is the date of the call and the phone number, to which the call is addressed or from which the call is received. You will also know the call type: Incoming, Outgoing, or Missed. For a more detailed analysis, we provided you with the event types: StartIncomingRinging, StartIncoming, StartOutgoing, EndIncoming, and EndOutgoing.

When the need to handle phone calls disappears, you can detach the handler using the DetachCallsHandler() method.

Waiting for a suitable Internet connection

Another interesting scenario that we implemented for the mobile platform is the selection of a suitable Internet connection. This is how it looks.

The user moves, and their Internet connection method is changing. Let us suppose that in order to perform certain actions, the user must have a reliable and fast connection. In this case, the mobile application can request information about the existing connection. If it is suitable to perform the action, the action is performed. If the Internet connection is not fast enough, the application prompts you to perform the postponed action when you have a different connection.

You can implement this scenario using the InternetConnectionInformation object. It is available as a global context property.
It has two methods that provide the desired information:
  • GetConnectionType(): CellularData, WiFi, LAN, or NoConnection
  • GetExpectedConnectionSpeed() - returns the connection speed in kbps
In addition, it has the AttachInternetConnectionChangeHandler() method. This method attaches the procedure that is called when the current connection type or speed is changed. Changing connection type also refers to the loss of all available connection types. For example, if you enable the airplane mode. The expected speed can change when you change the cellular data connection mode (GPRS, EDGE, LTE, etc.).

When tracking your Internet connection is no longer necessary, you can detach the handler using the DetachInternetConnectionChangeHandler() method.
Be the first to know tips & tricks 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.