User Tools

Site Tools


en:wiki:2.-desarrollo-app:2.4.-scripting-modelo-objetos:b.-objetos-complementarios:start

Complementary Objects

AmazonAppStore


It is good for shopping at the Amazon Apps Store. Only available in Amazon devices.

Methods Description
Method 1requestAmazonAppStoreInstallation:It requests the downloading and installation of the Amazon apps store.
Method 2isAmazonAppStoreInstalled: It asks if the apps store is installed.
Method 3purchase: It requests the purchase of a virtual product. Parameters: sProductSKU
Method 4getUserData: It returns an object with user information.
Method 5validateSkus: It returns if a product SKU is valid.
Method 6isSandboxMode:It returns if it is executing in demo mode or it doesn´t.


AndroidIntent


It is useful for sending Android intents to other applications or components of the system. Its purpose will vary according the implementation that is being done.


Object com.xone.android.script.runtimeobjects.AndroidIntent
This is how an intent object is created:


var intent = createObject("AndroidIntent");


Examples:

   Ej1 Lanzar la aplicación de youtube:
 
    if (appData.getGlobalMacro("##DEVICE_OS##") != "android") {
        throw "Los intents sólo están disponibles en Android";
      }
    var intent = createObject("AndroidIntent");
   intent.setAction("android.content.Intent", "ACTION_VIEW");
   intent.setData("https://www.youtube.com/watch?v=SsYrJXy1c6M");
   intent.startActivity();
 
 
    Ej2 Lanzar aplicación de Facebook, con control de si está instalada:
   if (appData.getGlobalMacro("##DEVICE_OS##") != "android") {
        throw "Los intents sólo están disponibles en Android";
    }
\\ 
  ¿Está instalada la aplicación del Facebook?
\\
    if (ui.isApplicationInstalled("com.facebook.katana") == 0) {
        /* 
         * Sí lo está. Usamos los intents de Android para lanzar una página
         * con la aplicación nativa.
         */
        var intent = createObject("AndroidIntent");
        if (intent == undefined) {
            throw "El objeto AndroidIntent no existe";
        } else {
            intent.setAction("android.content.Intent", "ACTION_VIEW");
            intent.setData("fb://page/994713583879307");
            intent.startActivity();
        }
    } else {
        //No está instalada. Usamos el navegador.
        ui.openUrl("https://www.facebook.com/TheBestCatPage/");
  }
 
\\
 
Ej3 Lanzar una aplicación.
\\
  var intent = createObject("AndroidIntent");
  intent.getLaunchIntentForPackage("com.mcdonalds.android ");
  intent.startActivity();
\\
Ej4 Lanzar GPS.\\
\\
    if  (appData.getGlobalMacro("##DEVICE_OS##") == "android") {
        var sw = ui.isApplicationInstalled("com.google.android.apps.maps");
        if (sw == 0) {
            var intent = createObject("AndroidIntent");
            intent.setPackage("com.google.android.apps.maps");
            intent.setAction("android.content.Intent", "ACTION_VIEW");
            intent.setData("geo:0,0?q=34.99,-106.61(Aquí está el POI)");
            intent.startActivity();
        } else {
            throw "Error, Google Maps no está instalado.";
        }
    }


Methods Description
Method 1setAction: It defines the action and the intent type to make.
Method 2setData: It defines the data that will be passed by the intent.
Method 3setDataAndType: It defines the data and the type of data that will be passed by the intent.
Method 4startActivity: It starts the activity.
Method 5startActivityForResult: It starts the activity and keeps waiting for a result, when it receives it, it call to the function defined.
Method 6startService: It starts the service.
Method 7stopService: It stops the service.
Method 8endOrderedBroadcast: It sends a broadcast intent respecting the order and giving it permission to consum it.
Method 9sendBroadcast: It sends a broadcast intent.
Method 10setPackage: It defines the target application that the intent will receive, with the mame of the package.
Method 11putBooleanExtra: It adds a boolean to the intent parameters.
Method 12putDoubleExtra: It adds a double to the intent parameters.
Method 13putIntegerExtra: It adds an integer to the intent parameters.
Method 14putFloatExtra : It adds a float to the intent parameters.
Method 15putStringExtra: It adds a string to the intent parameters.
Method 16setClassName: It defines the target class that will recieve the intent.
Method 17setType: It defines an explicit type MIME for filtering the applications that the inentent will receive.
Method 18addFlag : It adds extra flags to the intent for modifying its behaviour.
Method 19addCategory : It adds a category for filtering the applications that will receive the intent.
Method 20getLaunchIntentForPackage : It returns an intent for launching the application passed as parameter, its package name. It is equal to click its icon onto the applications launcher.
Method 21getMyPackageName : It returns the application package name that is being executing. Usually is “com.xone.android.framework”


Animation


It is useful to make personalized animations to a control.

Methods Definition
Method 1setTarget: It defines the node to which is going to apply the animations, the name of the affected node will be passed as parameter.
Method 2setDuration: It defines the duration of the animations to be made, the time in milliseconds will be passed as parameter.
Method 3setAlpha: Animation that modifies the control alpha, the alpha level that we want to give to the node will be passed as parameter, being 0 for hidding completely the node and 1 for making it 100% visible.
Method 4setStartCallback: It will be defined the function to which it will call when the animation starts.
Method 5setEndCallback: It will be defined the function to which it will call when the animation ends.
Method 6setX: It defines the position at the X axis which we want to move the node to.
Method 7setY: It defines the position at the Y axis which we want to move the node to.
Method 8setZ: It defines the position at the X axis which we want to move the node to.
Method 9setRotation: It defines the degrees which we want to rotate the node to.
Method 10setRelativeRotation: It defines the degrees we want to rotate the node, the differrence with the setRotation, is that the degrees are added to those who already have control.
Method 11setRelativeX: It defines the position at the X axis which we want to move the node to, the difference with setX is that the value is being added to the position at the X axis that the node already has.
Method 12setRelativeY: It defines the position at the Y axis which we want to move the node to, the difference with setY is that the value is added to the position at the Y axis that the node already has.
Method 13setRelativeZ: It defines the position at the Z axis which we want to move the node to, the difference with setZ is that the value is added to the position at the Z axis that the node already has.
Method 14SetScaleX : It defines the scale at the X axis we want to give to the node.
Method 15SetScaleY : It defines the scale at the X axis we want to give to the node.
Method 16setRelativeScaleX : It defines the scale at the X axis we want to give to the node, the difference with SetScaleX, is that the value is added to the one the X axis already has that the node already has.
Method 17setRelativeScaleY: It defines the scale at the Y axis we want to give to the node, the difference with SetScaleY, is that the value is added to the one it has at the Y axis that the node already has.
Method 18getDuration : It gets the duration of the animation it is going to be made.
Method 19cancel: It cancels the animation in progress.
Method 20setWidth: It defines the new width that the control will have.
Method 21setHeight: It defines the new height that the control will have.
Method 22setBackgroundColor: It defines the new BgColor that the control will have.


Parameters Definition
fromColor Color from which it starts to make the transition among colors.
toColor Final color of the colors transition.


setInterpolation It defines the speed of change of an animation, this allows to accelerate, decelerate, repeat the basic effects of the animation. (it is only applied to the following animations: setWidth, setHeight, setBgcolor).
VALUES OF SetInterpolation DESCRIPTION
AccelerateDecelerateInterpolator The change rate starts and ends slowly, but it accelerates in the middle.
AccelerateInterpolator The change rate starts slowly and then accelerates.
AnticipateInterpolator The change starts backwards and then moves forward.
AnticipateOvershootInterpolator The change starts backwards, then moves forward and exceeds the target value and finally it returns to the final value.
BaseInterpolator
BounceInterpolator It bounces at the end.
CycleInterpolator It repeats the animation of a series of cycles, in this case twice.
DecelerateInterpolator It starts quickly and then decelerates.
FastOutLinearInInterpolator It accelerates quickly and keeps accelerating until the end.
FastOutSlowInInterpolator It accelerates quickly and decelerates slowly.
LinearInterpolator The change is constant.
LinearOutSlowInInterpolator It starts with a constant change and then decelerates.
OvershootInterpolator The change exceeds the target value and finally it returns to the final value.


setRevealCircular It reveals with a circular effect the control.


SetRevealCircular Parameters Description
X x coordinate where the circle will start, always within the control limits.
Y y coordinate where the circle will start, always within the control limits.
reveal this defines if we want the effect be for revealing or for hidding.



An animation object is created like this:

 var anim = createObject("Animation");

The property object is taken like this, in order to be able to assign it with the setTarget:

 var window = ui.getView(self);
 var property = window[“NOMBRE_DEL_PROP”];


Examples:

  Ejemplo de setAlpha : 
var window = ui.getView(self);
var property = window[sProp];
var anim = createObject("Animation");
anim.setTarget(property); 
anim.setDuration(3000);   
anim.setAlpha(0);
ui.sleep(4);
anim.setAlpha(1);
anim.setEndCallback(function() {
      anim.setDuration(nOldDuration);
      });
Ejemplo de setX y setY:
var window = ui.getView(self);
var property = window[sProp];
createObject("Animation").setTarget(property).setX(500).setY(400);
 Ejemplo de setRelativeX y setRelativeY
var window = ui.getView(self);
var property = window[sProp];
createObject("Animation").setTarget(property).setRelativeX(0).setRelativeY(50);


BluetoothSerialPort


It is to connect by series port to a bluetooth device. This object is low level and the programmer must implement its own protocol on it to communicate to the device.


Object com.xone.android.script.runtimeobjects.BluetoothSerialPort

Methods Description
Method 1selectBluetoothDevice: It shows a screen to select the bluetooth device.
Method 2sleep: It sleeps during x milliseconds.
Method 3disconnect: It cleanly disconnect the bluetooth socket.
Method 4setTimeout: It defiens a timeout for the reading-writing operations.
Method 5read: It reads X bytes from the socket bluetooth. It returns the result converted into string.
Method 6getDiscoverableBluetoothDevices: It is the result from BluetoothSerialPort.getDiscoverableDevices
Method 7write: It writes a string into the bluetooth socket.
Method 8connect: It connects to the MAC address specified by parameter, or to the one saved by BluetoothSerialPort.selectBluetoothDevice


DeviceInfo


It returns current information about the device.


Object com.xone.android.script.runtimeobjects.DeviceInfo


Methods Description
Method 1getBatteryTemperature : It gets the battery temperature.
Method 2getTxBytes: It gets the text bytes.
Method 3getThisApplicationTxBytes : It gets the Tx bytes of this application.
Method 4getBatteryLevel: It gets the battery level.
Method 5getBatteryVoltage: It gets the battery voltage.
Method 6getBatteryLevelPercentage: It gets the battery level percentage.
Method 7getThisApplicationRxBytes: It gets the Rx bytes of this application.
Method 8getRxBytes: It gets the Rx bytes.
Method 9getBatteryMaxLevel: It gets the battery maximum level.


GPSTools


Several things to control the GPS.

Object com.xone.android.script.runtimeobjects.GPSTools


Methods Description
Method 1startGPS: It starts the GPS.
Method 2stopGPS: It stops the GPS
Method 3DistanceBetweenCoordinates: It measures the distance among coordinates.



Methods to get data from the last coordinate


They are methods associated to the GPS control but they are called by the U.I.


Method 1getLastKnownLocation: it gets the last collection (Latitude, Longitude).
Method 2getLastKnownLocationLatitude: it gets the last latitude.
Method 3getLastKnownLocationLongitude: it gets the last Longitude.
Method 4getLastKnownLocationAltitude: it gets the last Altitude.
Method 5getLastKnownLocationSpeed: it gets the last Speed.
Method 6getLastKnownLocationAccuracy: it gets the last accuracy.
Method 7getLastKnownLocationBearing: it gets the last course.
Method 8getLastKnownLocationProvider: it gets the last provider.
Method 9getLastKnownLocationDateTime: it gets the last date and time.


ImageDrawing


Object to edit images in a basic way, by adding them text, images and colors. It gets also metadata and information about the image.
Object com.xone.android.script.runtimeobjects.ImageDrawing


Methods Description
Method 1getImageInfo: It is the object result of ImageDrawing.getImageInfo().
Method 2setBackgroundColor: It sets the background color.
Method 3addTextSetXY
Method 4copyExifMetadata
Method 5save: Save
Method 6create: Create
Method 7addImageSetXY
Method 8setFont: It sets the font type.
Method 9setBackground: It sets the background type.
Method 10setFontSize: It sets the font size.
Method 11setFontStyle: It sets the font style.


IniParser


Object to parse ini files and take values or edit them.
Object com.xone.android.script.runtimeobjects.IniParser


Methods Description
Method 1getValue: Get value.
Method 2parseFromFile: Parsing from file.
Method 3parseFromString: Parsing from string.
Method 4setValueBySection: Setting value by section.
Method 5getValueBySection: Setting value by section.
Method 6setValue: Setting value.
Method 7save: Saving .
Method 8getString: Getting string.


PushMessage


Object to send push messages. Only Google.
Object com.xone.android.script.runtimeobjects.PushMessage


Methods Description
Method 1sendMessageGCM: Sending GCM messages.



PackageManager Object


It allows to access the information of the applications installed in the device.


Methods
getInstalledPackages: It gets a list of the applications installed at the device. It returns a list from PackageInfo [Methods].


Example:

 var installedPackages = packageManager.getInstalledPackages();
 var i,packageInfo,sMessage = "";
 var tot = installedPackages.length;
 for (i = 0;i < tot;i++) {	    
packageInfo = installedPackages[i];
var sMessage = "Package name: " + packageInfo.getPackageName() + "\n";
sMessage = sMessage + "Label: " + packageInfo.getLabel() + "\n";
sMessage = sMessage + "Description: " + packageInfo.getDescription() + "\n";
sMessage = sMessage + "Version name: " + packageInfo.getVersionName() + "\n";
sMessage = sMessage + "Version code: " + packageInfo.getVersionCode() + "\n";
sMessage = sMessage + "Enabled: " + packageInfo.isEnabled();
self.MAP_TEXT = sMessage;
self.MAP_ICON = packageInfo.getIcon("framework_icon.png");
ui.refresh("MAP_TEXT", "MAP_ICON");
 }	



Methods
getPackageInfo: It gets the information about an application according its package name.
-Methods:
-getPackageName: It gets the package name.
-getLabel: It gets the application name.
-getDescription: It gets the application description.
-getVersionName: It gets the name of the version.
-getVersionCode: It gets the version code.
-isEnabled: It gets if the application is enabled.
-getIcon: It gets the icon of the application. Parameters: It defines the file name that they will have when it will be copies to the frameworks resources.


Example:

 var packageInfo = packageManager.getPackageInfo("com.xone.android.framework");
var sMessage = "Package name: " + packageInfo.getPackageName() + "\n";
sMessage = sMessage + "Label: " + packageInfo.getLabel() + "\n";
sMessage = sMessage + "Description: " + packageInfo.getDescription() + "\n";
sMessage = sMessage + "Version name: " + packageInfo.getVersionName() + "\n";
sMessage = sMessage + "Version code: " + packageInfo.getVersionCode() + "\n";
sMessage = sMessage + "Enabled: " + packageInfo.isEnabled();
self.MAP_TEXT = sMessage;
self.MAP_ICON = packageInfo.getIcon("framework_icon.png");
 ui.refresh("MAP_TEXT", "MAP_ICON");



Methods
getInstalledPackageNames: It gets a list of packages name of the applications installed in the device.


Example:

 var sInstalledPackageNames = packageManager.getInstalledPackageNames();
var i;
var sMessage = "";
for (i = 0;i < sInstalledPackageNames.length;i++) {
	sMessage = sMessage + "Package name: " + sInstalledPackageNames[i] + "\n";
}
self.MAP_TEXT = sMessage;
 ui.refreshValue("MAP_TEXT");

SqlManager


Object com.xone.android.script.runtimeobjects.SqlManager

Methods Description
Method 1ScriptCursorWrapper: It is the cursor object result of the queries that make some SqlManager methods.


Debug Tools


In Android, from the 3.16.49 Framework, can be got by script the same functionalities of the debugging widget of the XOneLive of the device. With this it is possible to generate to the user a more friendly screen within the own application to monitor or make management or maintenance tasks.

Object to send debugging information to a remote server.
Object com.xone.android.script.runtimeobjects.XOneDebugTools

Method Description
GetDeviceID It returns the device IMEI.
SendLog To send the operations log of the device.
SendDatabase To send the database of the device.
SendReplicaDebugDatabase To send the replica log of the device database. See note.
SendReplicaFilesDatabase To send the files replica database.


These methods retuns 0 if the sending was OK and -1 if any error was produced.


The SendReplicaDebugDatabase method requieres that the replica-debug=“true” attribute is previously defined in the app node of the mappings in order this database is generated. It is important to unable this attribute when the replica problem has been fixed , so it can become a real waste of space if it remains active.


Example

<action name="runscript">
	<script language="VBScript">
	Set obj01 = CreateObject(“DebugTools”)
 
	' Para obtener el IMEI del dispositivo
	ui.MsgBox "PIN dispositivo: " + obj01.GetDeviceID, "Mensaje", 0
 
	' Para obtener el log de operaciones del dispositivo (La dirección es opcional)
	a=obj01.SendLog "http://www.xoneisp.com/XoneLogRec/reclog.aspx"
	if a=-1 then ui.MsgBox "No se pudo enviar el log de operaciones", "Mensaje", 0
 
	' Para obtener la base de datos del dispositivo (La dirección es opcional)
	a=obj01.SendDatabase "http://www.xoneisp.com/XoneLogRec/reclog.aspx"
	if a=-1 then ui.MsgBox "No se pudo enviar la base de datos", "Mensaje", 0
 
	' Para obtener log de réplica de la base de datos del dispositivo, (La dirección es opcional)
	a=obj01.SendReplicaDebugDatabase "http://www.xoneisp.com/XoneLogRec/reclog.aspx"
	if a=-1 then ui.MsgBox "No se pudo enviar el log de replica de operaciones", "Mensaje", 0
 
	' Para obtener la base de datos de réplica de ficheros (La dirección es opcional)
	a=obj01.SendReplicaFilesDatabase
	if a=-1 then ui.MsgBox "No se pudo enviar la base de datos de replica de ficheros", "Mensaje", 0
 
	Set obj01 = nothing
	</script>
</action>

NOTE: In the 4 last ones as parameter can be put the address to which it has to send, as long as we have installed the web in the server to receive the data. In the case no address is specified, it will be sent to the usual server from CGSOFT.


WriteString


It writes the text string passed by parameter to the debugging screen. In the Windows Mobile case, this screen is the result window of Visual Studio.

Type Function
Parameters String (in)The message that will be diplayed on screen.
Sintax object.ChronoValue (string )
Type of value returned No value returned.
Platform Win32, Web, .NET, .NET CF, WM (2003, 2005, 6.0, 6.5) Blackberry (5.0), iPhone, Linux, MC+, Symbian (3ed, 5ed)


Example

  set xcrn = CreateObject("System.Debug")
  xcrn.WriteString "INICIO CALCULOS"
  xcrn.ChronoStart
  REALIZAR TRABAJO 1 ...
  xcrn.WriteString "El tiempo trabajo 1: " + CStr(xcrn.ChronoValue)
  'REALIZAR TRABAJO 2 ...
  xcrn.ChronoStop
  xcrn.WriteString "El tiempo trabajo 2: " + CStr(xcrn.ChronoValue)
  xcrn.WriteString "FIN"


File Manager


FileManager Object


This script object, available in Android and iOS, encapsulates some simple functions about management and downloading files.
These methods return 0 if OK, otherwise they return -1 .


If in the corresponding parameters ARE NOT specify an absolute route, these methods will search by default at the files folder, excepting for the DownloadDatabase and DeleteDatabase that will take by default the db folder of the application.

Method Description
Method 1AsynchronousDownload: Asynchronous download.
Method 2FileExists: It checks if it exists the file specified at the first parameter.
Method 3DirectoryExists: It checks if the directory specified at the first parameter exists.
Method 4Rename: It renames a file, by taken as origin the first parameter and as destination the second parameter.
Method 5Copy: It copies a file, by taking as origin the first parameter and as destination the second parameter.
Method 6CreateDirectory: It creates a directory.
Method 7Delete: It deletes the file specified at the first parameter.
Method 8DeleteDirectory: It deletes the directory.
Method 9GetcheckSum: Getting the sum checking.
Method 10GetSize: Getting size.
Method 11Move: It moves a file, by taking as origin the first parameter and as destination the second parameter.
Method 12OpenFile: It opens a file, the file specified at the first parameter. The operative system will take care of opening the file with the application that has associated.
Method 13Download: It downloads a file. It takes as first parameter the URL of download, as second parameter it takes the route where it must save the file.
Method 14DownloadDatabase: Same than the Method Download, but this one only takes the first parameter.
Method 15Download Updated: Downloading updates.
Method 16DeleteDatabase: Same than the Method Delete, but this one searchs in the DB folder of the application.
Method 17ToFile: 2 parameters, first one the string on base64 and the second one the resulting file.
Method 18ToBase64: It returns a base64 string. An only parameter, the file to convert.
Method 19ListDirectories: It returns an array with the names of the folders found. An only parameter, the folder to check.
Method 20ListFiles: It returns an array with names of the files. An only parameter, the folder where the files to list are in.
Method 21Rename: It renames a file, by taking as origin the first parameter and as destination the second parameter.
Method 22ReadFile: Reading file.
Method 23Unzip: It unzips.
Method 24UploadFile: It downloads the file.
Method 25SaveFile: It saves the file.
Method 26Zip: It zips

At the time to use the ListDirectories and ListFiles methods, the appData.appPath and appData.filesPath methods can be very useful to us, which return us the path where the application is installed in the internal memory of the phone and the path to the folder where the files are in (in external sd ), respectively.


FileManager Example


'En este ejemplo de uso en Android, comprobamos que el fichero .APK exista en la raíz de la tarjeta SD. 
'Si existe, mostramos un mensaje y procedemos a abrir el fichero .APK. 
'Android se encargará de preguntar al usuario si quiere instalar la aplicación.
 
Set obj01 = CreateObject("FileManager")
res = obj01.FileExists("/sdcard/x.apk")
if res = 0 then
	ui.MsgBox "Aviso", "El fichero existe, procedo a lanzarlo", 0
	obj01.OpenFile "/sdcard/x.apk"
else
	ui.MsgBox "Aviso", "El fichero no existe", 0
end if
Set obj01 = nothing
 
Function ListarDirectorios
      Set filemanager01 = CreateObject("FileManager")
      lst = filemanager01.ListDirectories(appData.appPath)
 
      If Not lst Is Nothing Then
            For i = 0 To UBound(lst)
            	ui.ShowToast "Estos son los directorios: " + lst(i)
            Next
      Else
            ui.ShowToast "No hay nada..."
      End If
End Function
 
Function ListarFicheros
      Set filemanager01 = CreateObject("FileManager")
      'Tambien se puede llamar a ListFiles a secas para que nos devuelva todo lo que haya.
      lst = filemanager01.ListFiles(appData.filesPath)
 
      If Not lst Is Nothing Then
            For i = 0 To UBound(lst)
            	ui.ShowToast "Estos son los ficheros: " + lst(i)
            Next
      Else
            ui.ShowToast "No hay nada..."
      End If
End Function


FileCtl.FileSystem and FileCtl.File Objects


This object is old. For the last functionalities using the object: “FileManager” previously described.


OBJECT FileCtl.FileSystem
Method Kill
Dir
FileLen
OBJECT FileCtl.File
Method Open
LinePrint
LineInputString
Close


FileCtl.FileSystem Object


function EliminaFicherosMDI
  'eliminamos toda la carpeta MDI
	on error resume next
	Set fso = CreateObject("FileCtl.FileSystem")
	fic = fso.dir("\My Documents\MDI\*.*")
	while len(fic)>0
		If Len(fic)>0 Then
			fso.kill "\My Documents\MDI\"+fic
		End If               
		fic=fso.dir
	Wend
	set fso=nothing
	set fic=nothing
	appdata.error.clear
End function
function EliminaFicheros
 
' eliminamos el fichero de documento escaneado de 
' los documentos anteriores a 2 dias 
' Hacemos uso de una colección que contiene el nombre y la fechas de los ficheros
	dim coll,fichero,salir
 
	On Error Resume Next    
	set fso=CreateObject("FileCtl.FileSystem")
	set coll=appdata.getcollection("BorraFicEscaneados")
	coll.filter="julianday('now') - julianday(t2.FECHA)>2"
	coll.startbrowse
	if not coll.currentitem is nothing then
		salir=0
		while salir=0
			set obj=coll.currentitem
			if len(cstr(obj("FOTO_ALBARAN")))>0 then
				fichero=appdata.AppPath+"files\"+cstr(obj("FOTO_ALBARAN"))  
				fic=fso.dir(fichero)
				if len(fic)>0 then
					fso.kill fichero
				end if
				set fic=nothing
			end if    
			set obj=nothing
			coll.movenext
			if coll.currentitem is nothing then
				salir=1
			end if    
		wend
	end if
	coll.endbrowse
	coll.clear
	set coll=nothing
	set fso=nothing
	appdata.error.clear
End function


UploadFile Method in FileManager Object


It allows updating files by HTTP POST with multipart.

Method 1uploadFile: It uploads files by HTTP POST with multipart.
Parameters It has 3 parameters:
-the URL to which it is going to be called to updload the file is indicated.
-Name of the file to upload.
-(Optional) is a series of parameters optionals that are sent in the Content-Disposition of the http heading, separated by two points (colon) (Key:Value).


Example:

 var fm= createObject("FileManager");
 var sRespuesta = fm.uploadFile("http://posttestserver.com/post.php", " png_demo.png", "OPERACION:1:MID:999:NOMBRE:barcode.png"; 


WifiManager


It allows to get data from the wifi, such as managing its status.

    var wifiManager = createObject("WifiManager");

Object to administer and scanning wifi networks.
Object com.xone.android.script.runtimeobjects.XOneWifiManager



Methods
getAdapterMacAddress: It gets the MAC address.
getActiveWifiInfo: It gets an object with the information of the wifi enabled, in case it is not connected to a wifi it returns Null.
-We can get the following information:
-getBssid: It gets the BSSID.
-getFrequency: It gets the frequency.
-getHiddenSsid: It gets if the SSID is hidden or is not.
-getIpAddress: It gets the IP address.
-getLinkSpeed: It gets the link speed.
-getRssi: It gets the RSSI.
-getSsid: It gets the SSID.
connect: It connects the device to a wifi.
-Parameters:
-SSID of the wifi which we want to connect to.
disconnect: It disconnects the device from the wifi.
enableNetwork: It enables the automatic connection to a wifi.
-Parameters:
-SSID of the wifi.
disableNetwork: It disables the automatic connection of a wifi connection.
-Parameters:
-SSID of the wifi.
removeNetwork: It removes the wifi from the network list of the device.
-Parameters:
-SSID of the wifi.
addNetwork: It adds a wifi to the netWork list of the device.
-Parameters:
-An object WifiConfiguration.
listSavedNetworks: It returns the wifi list saved in the Networks list of the device, (It returns an array of objects WifiConfiguration).
scanAvailableNetworks: It returns an available Networks list.
-Parameters:
-It is defined a function to which it will be called when it has that networks list.

Example of addNetwork(wifiConfiguration):

  var wifiManager = createObject("WifiManager");
  var wifiConfiguration = createObject("WifiConfiguration");
  wifiConfiguration.setSsid("XOneWireless5G");
  wifiConfiguration.setNetworkSecurity("WPA2");
  wifiConfiguration.setPassword("xone01CGSOFT02");
  wifiManager.addNetwork(wifiConfiguration);


Example of listSavedNetworks():

  var wifiManager = createObject("WifiManager");
  var lstSaved = wifiManager.listSavedNetworks();
  var sMessage = "";
  for (var i = 0; i < lstSaved.length;i++) {
      sMessage = sMessage + "SSID: " + lstSaved[i].getSsid() + "\n";
  }
  ui.msgBox(sMessage, "Redes", 0);


Example of scanAvailableNetworks:

  var wifiManager = createObject("WifiManager");
  var lstAvailable = wifiManager.scanAvailableNetworks(function(wifiNetworks) {
  var sMessage = "";
  for (var i = 0;i < wifiNetworks.length;i++) {
  sMessage = sMessage + wifiNetworks[i].getSsid() + " " + wifiNetworks[i].getNetworkSecurity() + "\n";
  }
  ui.msgBox(sMessage, "Redes", 0);
  });
  ui.showToast("Escaneando redes WiFi...");


XOneNFC


Object to manage the events of NFC reading and writing.

An NFC object is created like this:


  var nfc = createObject("XOneNFC");

Object com.xone.android.nfc.XoneNFCRuntime


Methods DESCRIPTION
enableDnieReader : It enables the reading of the electronic DNI by NFC, it keeps waiting until it detects something to read.
-PARAMETERS:
-var options = {.
-To recover the profile information. With this variable to true, we have access the following values of the variable that returns the onDnieRead method in the variable passed as parameter:
-getDniNumber():DNI number.
-getDocumentType():Type of document.
-getName():Name.
-getSurname():Surnames.
-getDateOfBirth():Birth date.
-getDateOfExpiry():Expiration date.
-getNationality():Nacionality.
-getIssuer():DNI issuer.
-getOptionalData():Get optional data.
- getSex():Sex.
-getBirthPlace():Birth place.
-getAddress():Address.
-getCustodyInfo():Get information custody.
-getIcaoName():Icao name.
-getOtherInfo():Get another information.
-getProfession():Get profession.
-getPhone():Get phone.
-getTitle():Get title.
-getSummary():Get summary.
readProfileData : true. To recover the profile image. With this variable to true, we have access the following values of the variable that returns the onDnieRead method in the variable passed as parameter:
-getUserImage(appData.getFilesPath() + “Nombredelficjero.png”): It must be indicated the absolut path “appData.getFilesPath()”, followed by the name of the image and “png” extension.
readUserImage : true:To recover the signature. With this variable to true, we have access the following values of the variable that returns the onDnieRead method in the variable passed as parameter:
-getSignatureImage(appData.getFilesPath() + “ Nombredelficjero.png”):It must be indicated the absolut path “appData.getFilesPath()”, followed by the name of the image and “png” extension.
readSignatureImage : true.
-To recover the authentication certificate. (It requires the DNI pin. If an erroneous pin is entered it may lock the DNI if the process is repeated more than 3 times). readAuthenticationCertificate : false.
-To recover the signature of the certificate (It requires the DNI pin. If an erroneous pin is entered it may lock the DNI if the process is repeated more than 3 times). With this variable to true, we have access the following values of the variable that returns the onDnieRead method in the variable passed as parameter:
-getSignatureKey().
-getSignatureCertificateChain().
readSignatureCertificate : false.
CAN number of the DNIe. canNumber : self.MAP_CAN_NUMBER.
PIN number of the DNIe. pin : self.MAP_PIN.
onDnieRead : function ( dnieReadResult ){: It defines the function that will be called when the DNIe reading will be finished. Here, we put the code we want to make when we finish reading the DNI .
dnieReadREsult: It returns us an object with all the variable read.
onDnieReadError : function ( sReadError ){: It defines the function that will be called when the DNIe reading will fail. Here, we put the code we want to make when any type of error will occurr when reading the DNI.
sReadError: It indicates the error produced during the DNIe reading.
onProgressUpdated : function ( sMessage, nProgress ){. It defines the function that will be called when reading the DNIe. Here we will put the code we want to make while reading the DNIe, it returns us:
-sMessage: indicating us the message according the reading process in which we are in that moment.
-nProgress: It indicates us the reading percentage that the DNIe has.
disableDnieReader: It disables the reading of the electronic DNI by NFC, so that it does not keep waiting.
writeMifareClassicAsync: It writes a tag MIFARE CLASSIC.
-PARAMETERS:
-1.Array of the number of blocks where it is going to write.
-2.Array of texts to write.
-3.Node to be called when the writing is complete.
writeNdefMessageAsync: It writes a NDEF tag.
-PARAMETERS:
-1.Text to write.
-2.Node called when the writing is completed.
readMifareClassicAsync: It reads a MIFARE CLASSIC tag.
-PARAMETERS:
-1.Array of the number of blocks to be read.
-2.Node to be called when the reading is completed.
readNdefMessageAsync: It reads a NDEF tag.
-PARAMETERS:
-1. Node called when the reading will be completed.


Example of writeMifareClassicAsync:

  var blocks = new Array("1(1)");
  var data = new Array("Hola");
  var nfc = createObject("XoneNFC");
  nfc.writeMifareClassicAsync(blocks, data, "write_mifare_callback");
  self.MAP_TEXT = "Pase un tag Mifare por el lector para escribir";
  ui.refreshValue("MAP_TEXT");
  Nodo que llamará cuando se complete la escritura.
  <write_mifare_callback refresh="false">
  <action name="runscript">
  <param name="writeerror" />
  <script language="javascript">
  Aquí ponemos el código que quedamos que se ejecute cuando se complete la escritura
  si writeerror viene vacío significa que el tag se escribió correctamente, en caso contrario vendrá la descripción del error. 
  </script>
  </action>
  </write_mifare_callback>


Example of writeNdefMessageAsync:

 var nfc = createObject("XoneNFC");
 nfc.writeNdefMessageAsync("Hola que tal", "write_ndef_message_callback");
 self.MAP_TEXT = "Pase un tag NDEF por el lector para escribir";
 ui.refreshValue("MAP_TEXT");
 Nodo que llamará cuando se complete la escritura.
 <write_ndef_message_callback refresh="false">
 <action name="runscript">
 <param name="writeerror" />
 <script language="javascript">
 Aquí ponemos el código que quedamos que se ejecute cuando se complete la escritura.
 Si writeerror viene vacío significa que el tag se escribió correctamente, en caso contrario vendrá la descripción del error.
 </script>
 </action>
 </write_ndef_message_callback>


Example of readMifareClassicAsync:

 var blocks = new Array("1(1)");
 var nfc = createObject("XoneNFC");
 nfc.readMifareClassicAsync(blocks, "read_mifare_callback");
 elf.MAP_TEXT = "Pase un tag Mifare por el lector para leerlo";
 ui.refreshValue("MAP_TEXT");
 Nodo que se llamará cuando se complete la Lectura.
 <read_mifare_callback refresh="false">
 <action name="runscript">
 <param name="readerror" />
 <param name="id" />
 <param name="data" />
 <script language="vbscript">
 Aquí ponemos el código que quedamos que se ejecute cuando se complete la lactura.
 readerror: Viene la descripción del error
 data: Viene un array de textos guardado en el Tag nfc
 </script>
 </action>
  </read_mifare_callback>


Example of readNdefMessageAsync:

  var nfc = createObject("XOneNFC");
 nfc.readNdefMessageAsync(“read_ndef_callback”);
 self.MAP_TEXT = "Pase un tag NDEF por el lector";
  ui.refreshValue("MAP_TEXT");
 Nodo que se llamará cuando se complete la Lectura.
  <read_ndef_callback refresh="false">
  <action name="runscript">
  <param name="readerror" />
  <param name="id" />
  <param name="data" />
  <script>
  Aquí ponemos el código que quedamos que se ejecute cuando se complete la lactura.
  readerror:Viene la descripción del error.
  data:Viene el texto guardado en el Tag nfc.
  </script>
  </action>
  </read_ndef_callback> 



PinPadPayment


Object to communicate with card payment gateway hardware. Several pinpad from Itos and Ingenico are supported.

Object com.xone.android.pinpad.PinpadPayment

Methods Description
disconnect
printLine
printImage
returnLastTransaction
partialRefund
setFontSize
setFontStyle
sendCommand
cancelTransaction
flushPrinter
setModel
setDebugMode
payment
returnTransaction
connect
refund

XOneOCR


Object for license plate and generic text recognition.

Object com.xone.android.ocr.XOneOCR

MethodsDescription
Method 1scanText: scanning text.
Method 2scanLicensePlate: scanning license plates.


WifiConfiguration


It establishes a wifi object to be able to use it in the wifiManager object.

   var wifiConfiguration = createObject("WifiConfiguration");

Builder objectto passe it the parameters of a wifi network to WifiManager.

Object com.xone.android.script.runtimeobjects.XOneWifiConfiguration

Methods
setSsid: It establishes the SSID.
setNetworkSecurity: It establishes the type of security (OPEN,WPA2,WPA, WEB,EAP …)
setPassword: It establishes the wifi password, in case the security is not OPEN.
getBssid: It gets the BSSID.
getHiddenSsid: It gets if the SSID is hidden.
getSsid: it gets the SSID.
getNetworkSecurity: It gets the type of security of the wifi.
setBssid: It establishes the BSSID.
setHiddenSsid: It establishes if the SSID is hidden or it is not.


Examples:

We create an Open wifi

  var wifiConfiguration = createObject("WifiConfiguration");
  wifiConfiguration.setSsid("SSID DE LA WIFI ABIERTA");
  wifiConfiguration.setNetworkSecurity("OPEN");

We create a wifi with WPA2

  var wifiConfiguration = createObject("WifiConfiguration");
  wifiConfiguration.setSsid("SSID DE LA WIFI");
  wifiConfiguration.setNetworkSecurity("WPA2");
  wifiConfiguration.setPassword("CONTRASEÑA DE LA WIFI");


XOnePrinter


Object to control printing hardware.

Object com.xone.android.printer.XOnePrinter

MethodsDescription
setCustomPaperHeight
disconnect
enableWiFi
printLineCentered
endHeader
checkPrinterStatus
setMaxCharacterWidth
disableWiFi
selectNetworkedPrinter
getMode
setFont
setDelay
setMaxLinesPerPage
printLine
getStoredPrinterInfo
printImage
setBluetoothAuthentication
disableBluetooth
endFooter
printLineRight
setIPAddress
enableBluetooth
setFontSize
setFontStyle
setDiscoverable
setModel
reset
setDebugMode
cutPaper
beginFooter
setDriver
setEncoding
setCustomPaperWidth
setPort
useStoredPrinter
setPIN
selectBluetoothPrinter
getDiscoverableBluetoothDevices
getAddress
connect
ineFeed
printBarcode
beginHeader
setMACAddress
setPaperSize
print
sendCommands
setFontColor
setFeedMode
printPDF


Errors Management


The errors management is made through the appData.Error object that we describe next in an independent way, because of its importance. The values it may take this error object may be managed during the execution of the application. The available functions are the following ones:


getNumber


Type Property
Access Reading
Type of data returned Integer
Platform Win32, Web, .NET, .NET CF, WM (2003, 2005, 6.0, 6.5) Blackberry (5.0), iPhone, Linux, MC+, Symbian (3ed, 5ed)


It has the code of the last error occurred at the machinery. Zero indicates that there is no error.


Negative values usually indicates errors, positive codes usually indicates “abnormal” situations but that do not represent fatal errors.


var coll=appData.getCollection("ArticulosBuscar");
var filtro=coll.getFilter();
coll.setFilter("CODARTICULO="+vb.cstr(articulo));
coll.startBrowse();
if (appData.error().getNumber()!=0 )
{
	appData.getUserInterface().msgBox("Error " + appData.error().getDescription(),"ERROR",0);
	appData.error().clear();
}
else
{
.....
}	
 
coll.setFilter(filtro);
coll.endBrowse();


getDescription


Type Property
Access Reading
Type of data returned Text
Platform Win32, Web, .NET, .NET CF, WM (2003, 2005, 6.0, 6.5) Blackberry (5.0), iPhone, Linux, MC+, Symbian (3ed, 5ed)


Description of the last error occurred at the machinery.


var coll=appData.getCollection("ArticulosBuscar");
var filtro=coll.getFilter();
coll.setFilter("CODARTICULO="+vb.cstr(articulo));
coll.startBrowse();
if (appData.error().getNumber()!=0 )
{
	appData.getUserInterface().msgBox("Error " + appData.error().getDescription(),"ERROR",0);
	appData.error().clear();
}
else
{
.....
}	
 
coll.setFilter(filtro);
coll.endBrowse();


getFailedSql


Type Property
Access Reading
Type of data returned Text
Platform Win32, Web, .NET, .NET CF, WM (2003, 2005, 6.0, 6.5) Blackberry (5.0), iPhone, Linux, MC+, Symbian (3ed, 5ed)


If the error of the last operation is due to a failed SQL, the sentence in question is in this property of the error object.


Some methods can also opt by leaving information in this property, but the normal is that there is no SQL involved in the error, this property is empty.

var coll=appData.getCollection("ArticulosBuscar");
var filtro=coll.getFilter();
coll.setFilter("CODARTICULO="+vb.cstr(articulo));
coll.startBrowse();
if (appData.error().getNumber()!=0 )
{
	appData.getUserInterface().msgBox("Error " + appData.error().getDescription(),"ERROR",0);
	appData.getUserInterface().msgBox("SQL fallida " + appData.error().getFailedSql(),"SQL",0);
	appData.error().clear();
}
else
{
.....
}	
 
coll.setFilter(filtro);
coll.endBrowse();


clear


Type Method
Type of data returned None
Platform Win32, Web, .NET, .NET CF, WM (2003, 2005, 6.0, 6.5) Blackberry (5.0), iPhone, Linux, MC+, Symbian (3ed, 5ed)


It clears the variable of the error object, by leaving it ready to the following operation.


var coll=appData.getCollection("ArticulosBuscar");
var filtro=coll.getFilter();
coll.setFilter("CODARTICULO="+vb.cstr(articulo));
coll.startBrowse();
if (appData.error().getNumber()!=0 )
{
	appData.getUserInterface().msgBox("Error " + appData.error().getDescription(),"ERROR",0);
	appData.getUserInterface().msgBox("SQL fallida " + appData.error().getFailedSql(),"SQL",0);
	appData.error().clear();
}
else
{
.....
}	
 
coll.setFilter(filtro);
coll.endBrowse();


BarCode Generator


It is useful to generate bar code of several types.


Method 1setType: It indicates the type of bar code that it will generate:
-codabar,code128,code39,code93,datamatrix,qrcode,upca,upce,ean13,ean8,pdf417.
Method 2setResolution: It indicates the resolution to which the image is going to be generated with the barcode.
-Parameter 1: Image width.
-Parameter 2: Image height.


setDestinationFile It defines the destination route.
-Parameters:
-Destination route (If the physical route is not put,the framework will search for it at the files).


setRotation It indicates the image rotation degree.
-Parameters:
-Rotation degree.


Generate It generates the code.
-Parameters:
-Text from which the bar code will be generated.


Example:

var tipoCodigo,attachFile,rotation,text;
tipoCodigo = “code128”;
attachFile = “barcode.png;
rotation = 0;
text = “Xone Prueba”;
if(!tipoCodigo) {
 	throw "Seleccione un tipo de código";
} else {
 	ui.showToast("Generando código de tipo " + tipoCodigo + "...");
}
var generator = createObject("BarcodeGenerator");
generator.setType(tipoCodigo);
generator.setResolution(640, 480);
generator.setDestinationFile(attachFile);
if (rotation != 0) {
 	generator.setRotation(rotation);
}
generator.generate(text);
ui.openFile(attachFile);


Code Scanner


Bar code reader. Object reserved from the framework.


Method 1 scanFromFile: It reads the bar code from a file.
-Parameters:
-Path of the file to read in destination (If the physical path is not put, the framework will search for it at files).
-Type of code that is going to be interpreted.


Example:

   var sResult = codeScanner.scanFromFile(“barcode.png, “code128”);


startCamera It launches the camera for reading the bar code.
-Parameter 1: It is defined a function to which it will be called when we click into OK button at the camera.
-Parameter 2:Type of code to be interpreted.

Example:

   codeScanner.startCamera(function callbackScanner(codigo, fichero) {
 	/*Aquí ponemos el código que se ejecute
 el parámetro código, es el código detectado en  la imagen.
 El parámetro ficheros, es la ruta del ficheros que se guarda.*/   
 }, “code128”);


Start Scanner


U.I. method that launches the scanner on devices that have it.


Method 1startScanner: It launches the scanner available in the device.
-Parameters: An object is passed.
Method 2mode: It defines the mode of scanner launching. It has the following values:
-manual, continuous, stop.
Method 3onCodeScanned: función callback function to which it will be called when the code will be detected with the scanner.


Example:

    var params = {
           mode: "manual",
           onCodeScanned: function(sCode) {
            	ui.showToast("Código: " + sCode);
 	}
    };
    ui.startScanner(params);


XOnePDF


This is how the object XOnePDF is created.

   var pdf = createObject("XOnePDF");


Methods
signPdfWithKey(): For signing the PDF with DNIe.
Parameters for the signature with DNIe:
-Path of the pdf file to be signed.
-Path of the final file when it is signed.
-DNIe Signature password.
-DNIe Certificate.


Examples:

       firma de un PDF con el DNIe.
       var options = {
	 readSignatureCertificate : true,
	 canNumber : self.MAP_CAN_NUMBER,
	 pin : self.MAP_PIN,
	 onDnieRead : function(dnieReadResult) {
	    
	    //readSignatureCertificate
	    dnieReadResult.getSignatureKey()
	    dnieReadResult.getSignatureCertificateChain()
	    
		var pdf = createObject("XOnePDF");
		var sSourcePdf = appData.getFilesPath() + "sample.pdf";
		var sSignedPdf = appData.getFilesPath() + "signed.pdf";
		
		pdf.signPdfWithKey(
		sSourcePdf, 
		sSignedPdf, 
		dnieReadResult.getSignatureKey(),
		dnieReadResult.getSignatureCertificateChain());
		pdf.launchPDF(sSignedPdf);
	 },
	 onDnieReadError : function(sReadError) {
		self.MAP_TEXT = "Error: " + sReadError;
		ui.refreshValue("MAP_TEXT");
	},
	onProgressUpdated : function(sMessage, nProgress) {
		self.MAP_TEXT = "Reading DNIe.\nProgress: " + nProgress + "\n" + sMessage;
		ui.refreshValue("MAP_TEXT");
	}
  };
   var nfc = createObject("XOneNFC");
     nfc.enableDnieReader(options);


PARAMETERS FOR THE SIGNATURE WITH KEYSTORE
Path of the PDF file that is going to be signed.
Path of the final file when it is signed.
Path of the KeyStore file. (keyStore).
Password of the KeyStore. (keyStorePassword).
Alias of the key (KeyAlias).
Password of the alias (KeyPassword).

Singletons of script without createObject


Http POST


“$http”
It is for making http post and get calls to web services and returning result.
Object com.xone.android.script.runtimeobjects.HttpRuntimeObject

Methods Description
Method 1post
Method 2get


Example:

  $http.post("URL", function(sJson) {
  /*función que se llama cuando la respuesta es correcta.*/
                  var objRespuesta = JSON.parse(sJson);
                  ui.showToast("OK! " + sJson);
              }, function() {
  /*función que se llama cuando la respuesta no es correcta.*/
                  ui.showToast("No OK!");
              });


 $http.post("https://maps.googleapis.com/maps/api/geocode/json?address=Cardenal%20Cisneros", function(sJson) {
          var objRespuesta = JSON.parse(sJson);
  ui.showToast("OK! " + sJson);
  }, function() {
  ui.showToast("No OK!");
  });

systemSettings


It returns different types of information of the system.

Object com.xone.android.script.runtimeobjects.SystemSettings

Methods
setBrightness: It establishes the value of the brightness of the screen of the device.
getBrightness: It gets the value of the brightness of the screen of the device.


Example:

To take the value:

  self.MAP_BRILLO = systemSettings.getBrightness();

To assign the value:

  systemSettings.setBrightness(self.MAP_BRILLO);


Variables
GMT_OFFSET: It returns the time zone.
And those ones that are defined in the following page: https://developer.android.com/reference/android/provider/Settings.Global.html


Examples:

  var tZ = systemSettings.GMY_OFFSET;
  var adb = systemSettings.AIRPLANE_MODE_ON;

Payment


For payments with the Play Store.
Object com.xone.android.script.runtimeobjects.XonePayment

Methods Description
Method 1requestPayment: Requesting payment.


FingerPrintManager


Finger Print Manager.
Object com.xone.android.script.runtimeobjects.XOneFingerprintManager


This object allows you to control the events that the fingerprint reader causes, it works in 6.x.x or superior versions.


Methods:

Method 1 setCallback: To assign the events configuration. Example: fingerprintManager.setCallback(params);
Method 2listen: We put the object to listen a possible event that the Fingerprint reader launches. Example: fingerprintManager.listen();
Method 3launchFingerprintSettings: It launches the security window where the option to register fingerprints is.
Method 4 stoplistening: We stop the listening.
Method 5ishardwareavailable:
Method 6 hasenrolledfingerprint:


Example:

    1.	En primer lugar definimos lo que queremos hacer dependiendo de los eventos que se disparen.
//Difinimos los diferentes eventos que pueden ocurrir en el objeto fingerprintManager.
var params = {
   // Este evento se llamara cuando la huella exista en el telefono.
	onSuccess: function(result) {
		// Esto significa que la huella existe en el dispositivo
  // result.getPublicKey(); esto nos devuelve la clave de la huella 
  // dactilar, para que nosotros la podamos usar donde sea , por 
  // ejemplo asociarla a un usuario para hacer el Login con huella 
  // dactilar.
		var sPublicKey = result.getPublicKey();
  /* Aquí ponemos lo que queramos hacer … */
		},
  // Este evento se llamara cuando la huella no exista en el telefono o cuando ocurra algun tipo de error.
	onFailure: function(nError, sErrorMessage) {
		// nError: Numero de error
		// sErrorMessage: Descripción del error.
  // Si no existe nError o no está definido quiere decir que no ha 
  // ocurrido un error, simplemente no ha encontrado que este 
  // registrada la huella dactilar en el dispositivo.
  /* Aquí ponemos lo que queramos hacer … */
		}
	};
   2.	Después registramos la configuración de los eventos en el objeto:
  fingerprintManager.setCallback(params);
 
   3.	Por último ponemos al objeto en escucha de un posible evento con el lector de huellas dactilares.
   fingerprintManager.listen();


ui


Generic object to make all kind of things.

Object com.xone.android.framework.XoneGlobalUI

Methods:

Method 1 stopWifi: To stop the wifi
Method 2 getLastKnownLocationSpeed: To get the speed of the last known location.
Method 3 openFile: To open a file.
Method 4dismissNotification: To refuse a notification.
Method 5askUserForGpsPermission: To ask the user for permission for the GPS.
Method 6showConsoleReplica: To show replica console.
Method 7addCalendarItem: To add item to the calendar.
Method 8sendMail: To send an email.
Method 9startPrint: To start printing.
Method 10getMaxSoundVolumen: To get maximum sound volume.
Method 11msgBox: Messages box.
Method 12startAudioRecord: Starting audio recording.
Method 13showTimePicker: Showing time picker.
Method 14quitApp: To exit from the application.
Method 15isTaskKillerInstalled: Installation of killer tasks.
Method 16startKioskMode: Starting the kiosk mode.
Method 17drawMapRoute: Drawing route map.
Method 18getLastKnownLocationAccuracy: Getting the accurate last known location.
Method 19signDataObject: Signing data object.
Method 20makePhoneCall: Making a phone call from the device.
Method 21openMenu: Open menu.
Method 22printCommand: Printing command.
Method 23getLastKnownLocationAltitude: Getting the altitude of the last known location.
Method 24deleteShortcut: Deleting shortcut.
Method 25msgBoxWithSound: Message with sound box.
Method 26lockGroup: Locking group.
Method 27playSoundVolumen: Playing sound volume.
Method 28getLastKnownLocationLatitude: Getting the latitude of the last known location.
Method 29hidenavigationDrawer: Hidding navigation drawer.
Method 30sharedData: Shared data.
Method 31stopGpsV2: Stopping Gpsv2
Method 32setSelection: Setting selection.
Method 33stopGpsV1: Stooping Gpsv1.
Method 34showWaitDialog: Showing waiting dialog.
Method 35getSoundVolumen Getting sound volume.
Method 36isSuperuserAvailable: super user available.
Method 37refreshContentSelectedRow: Refreshing the content in the selected row.
Method 38showDatePicker: Showing date picker.
Method 39isWifiConnected: wifi is connected.
Method 40setMaxWaitDialog Setting maximum waiting dialog.
Method 41uninstallApplication: Uninstalling the application.
Method 42startCamera :Start the camera.
Method 43sleep: Sleep.
Method 44playSoundAndVibrate: Playing sound and vibration.
Method 45showSnackbar : Showing snackbar.
Method 46speak: speak.
Method 47lineFeed: Line break.
Method 48isOnCall: is available.
Method 49startGpsV2: starting Gpsv2.
Method 50startGpsV1: starting Gpsv1.
Method 51printBarcode: printing bar code.
Method 52refresh: Refreshing.
Method 53takePhoto: Taking picture.
Method 54stopKioskMode: Stopping kiosk mode.
Method 55openUrl: Opening URL.
Method 56showNavigationDrawer: Showing navigation box.
Method 57checkGPSStatus: Checking GPS status.
Method 58printPDF: Printing PDF.
Method 59startWifi: Starting wifi.
Method 60refreshContentRow: Refreshing the content row.
Method 61shareData: Sharing data.
Method 62showNotification: Showing notification.
Method 63clearDrawing: Deleting drawer.
Method 64hideSoftwareKeyboard: Hidding software keyboard.
Method 65startGps: Starting GPS.
Method 66endPrint: Finishing printing.
Method 67returnToForeground: Returning to the foreground.
Method 68canMakePhoneCall: It can make the phone call.
Method 69getView: Getting view.
Method 70printLine: Printing line.
Method 71restartApp: Restarting the application.
Method 72printImage: Printing the image.
Method 73getLastKnownLocationDateTime: Getting the date and time of the last known location.
Method 74executeActionAfterDelay: Executing action after delay.
Method 75getLastKnownLocation: Getting the last known location.
Method 76startSignature: Starting the signature.
Method 77isWifiEnabled: wifi is enabled.
Method 78launchApp: Launching application.
Method 79sendSMS: Sending SMS.
Method 80stopAudioRecord: Stopping the audio recording.
Method 81getLastKnownLocationProvider: Getting provider of the last known location.
Method 82showGroup: Showing group.
Method 83toggleGroup: Changing the the group view status.
Method 84getLastKnownLocationBearing: Getting the bearing of the last known location.
Method 85recognizeSpeech: Recognize speech.
Method 86setLanguage: Setting language.
Method 87returnToMainMenu: Returning to the main menu.
Method 88stopPlaySoundAndVibrate: Stopping sound and vibration playing
Method 89unlockGroup: Unlocking group.
Method 90captureImage: Capturing image.
Method 91startReplica: Starting the replica.
Method 92getLastKnownLocationLongitude: Getting the longitud of the last known location.
Method 93saveDrawing: Saving drawing.
Method 94hideGroup: Hidden group.
Method 95injectJavascript: Injecting Javascript.
Method 96askUserForGPSPermission : Requesting the user for permission for the GPS.
Method 97isApplicationInstalled: The application is installed.
Method 98showSoftwareKeyboard: Showing software keyboard.
Method 99useLastPrinter: Using the last printer.
Method 100showToast: Showing toast.
Method 101pickFile: Selecting file.
Only the two first parameters are mandatories.

1º Prop where it stores.
2º Allowed extensions
3º Pictures only
4º Initial route
5º It does not allow routes superiors to the initial one.
Example:
ui.pickFile(“MAP_ADJUNTORESPUESTA”,“*.jpg;*.png”,false,“##FILESPATH##”,1);
ui.pickFile(“MAP_ADJUNTORESPUESTA”,“*.jpg;*.png”,false,“/sdcard/DCIM/Camera”,1);
ui.pickFile('MAP_IMG','', true);

Method 102startScanner: Starting scanner.
Method 103mergeImagesLeftToRight: Merging images from left to right.
Method 104refreshValue: Refreshing value.
Method 105printBIDI: Printing BIDI.
Method 106setNotificationLed: Setting notification Led.
Method 107stopGps: Stopping GPS.
Method 108relayout: Relayout page.
Method 109createShortcut: Creating shortcut.
Method 110print: Printing.
Method 111openEditView: Opening edition view.
Method 112hideWaitDialog: Hidding waiting dialog.
Method 113launchApplication: Launching application.
Method 114ensureVisible: Ensuring visible.
Method 115setFeedMode: Setting feed mode.
Method 116updateWaitDialog: Updating waiting dialog.
Method 117stopReplica: Stopping Replica.



Replica


Object to get information about the replica. From here it is possible to apply replica restrictions and starting or stopping the replica service.

Object com.xone.android.script.runtimeobjects.XoneReplicaConsole.

Methods:

Method 1clearAllRestrictions: Removing all the restrictions.
Method 2setRestriction: Setting restriction.
Method 3getLog: Getting log.
Method 4getDatabaseId: Getting the database ID.
Method 5start: Starting Replica.
Method 6getTotalRecordsTX: Getting the total of TX records.
Method 7getTotalRecordsRX: Getting the total of RX records.
Method 8getRecordsPend: Getting the pending records.
Method 9processReplicatorQueue: Processing the replicator queue.
Method 10getHostname: Getting host name.
Method 11clearRestrictions: Removing restrictions.
Method 12getRecordsRX: Getting RX records.
Method 13stop: Stop.
Method 14getLicense: Getting license.
Method 15getRecordsTX: Getting TX records.
Method 16getMid: Getting MID.


Others


object com.xone.android.script.runtimeobjects.BluetoothDeviceScript


It is the result of BluetoothSerialPort.getDiscoverableDevices()

Methods:

Method 1getMacAddress: Getting the MAC address.
Method 2getBondState: Getting the bond status.
Method 3getDeviceName: Getting the device name.
Method 4getDeviceClass: Getting the device class.


Object com.xone.android.script.runtimeobjects.FingerprintAuthenticationResult


It is the object returned in the fingerprint callback.


Methods:

Method 1getPublicKeyFormat: Getting public key format.
Method 2getPublicKeyAlgorithm: Getting public key algorithm.
Method 3verify: Verifying.
Method 4getPublicKey: Getting the public key.
Method 5signWithPrivateKey: Signing with public key.


Object com.xone.android.script.runtimeobjects.ImageInfo


It is the object result of ImageDrawing.getImageInfo()

Methods:

Method 1getHeight: Getting height.
Method 2getMimeType: Getting the MIME type.
Method 3getWidth: Getting width.


Object com.xone.android.script.runtimeobjects.LiveSecureProvisioningResponse


It is the object returned in the secure provisioning callback.

Object com.xone.android.script.runtimeobjects.ScriptCursorWrapper


It is the cursor object result of the queries that some methods of the SqlManager make.


Object com.xone.android.script.runtimeobjects.XOneWifiInfo


Object result of searching the wifi networks with WifiManager.

Methods:

Method 1getHiddenSsid: Getting the hidden Ssid.
Method 2getSsid: Getting the Ssid.
Method 3getIpAddress: Getting the IP address IP.
Method 4getFrequency: Getting frequency.
Method 5getLinkSpeed: Getting link speed.
Method 6getRssi: Getting Rssi.
Method 7getBssid: Getting Bssid.


Object xone.runtime.core.XoneDataObject


Methods:

Method 1getVariables: Getting variables.
Method 2getFieldPropertyValue: Getting the value ofthe field property.
Method 3save: Saving.
Method 4executeNode: Executing node.
Method 5getContentsCount: Getting contents counting.
Method 6getDirty: It indicates if there were any change.
Method 7bind: Binding.
Method 8deleteObject: Deleting object.
Method 9get: Getting.
Method 10getContents Getting contents.
Method 11setOwnerCollection: Setting owner collection.
Method 12getOwnerApp: Getting owner application.
Method 13getObjectIndex: Getting object index.
Method 14fieldPropertyValue: Value field property.
Method 15setVariables: Setting variables.
Method 16getOwnerCollection: Getting the collection owner.
Method 17loadFromJson: Loading from Json.
Method 18isNew: It is new.
Method 19setFieldPropertyValue: Setting value of the field property.
Method 20getPropertyTitle: Getting property title.
Method 21getValue: Getting value.
Method 22contents: contents.
Method 23setValue: Setting value.
Method 24clone: clone.
Method 25getObjectItem: Getting object item.
Method 26toString: String.
Method 27getPropertyGroup: Getting group property.


Object xone.runtime.core.XoneDataCollection


Methods:

Method 1getName
Method 2getDevelopedAccessString
Method 3getItem
Method 4propertyCount
Method 5isBrowsing
Method 6endBrowse
Method 7getSort
Method 8getPropType
Method 9getDevelopedFilter
Method 10moveFirst
Method 11isLocked
Method 12lock
Method 13generateRowId
Method 14getCount
Method 15getOwnerApp
Method 16group
Method 17doSort
Method 18getObject
Method 19unlock
Method 20getMultipleKey
Method 21ownerObject
Method 22moveNext
Method 23count
Method 24startBrowse
Method 25propVisibility
Method 26reateSearchIndex
Method 27setFilter
Method 28getPropertyTitle
Method 29findObject
Method 30getDataConnector
Method 31getGroup
Method 32getIdFieldName
Method 33name
Method 34stringKey
Method 35doSearch
Method 36getPropertyGroup
Method 37getLinkFilter
Method 38getCollPropertyValue
Method 39removeItem
Method 40getVariables
Method 41saveAll
Method 42getMacroCount
Method 43moveLast
Method 44createClone
Method 45executeSqlString
Method 46setLinkFilter
Method 47loadAll
Method 48getDevelopedLinkFilter
Method 49addItem
Method 50getCurrentItem
Method 51getOwnerObject
Method 52getXmlNode
Method 53reload
Method 54setMacro
Method 55get
Method 56getMacro
Method 57getPropVisibility
Method 58browseDeleteAll
Method 59browseLength
Method 60getObjectIndex
Method 61getGroupCount
Method 62setVariables
Method 63clear
Method 64deleteAll
Method 65loadFromJson
Method 66getAccessString
Method 67createObject
Method 68setSort
Method 69getFilter
Method 70propertyName
Method 71deleteItem
Method 72collPropertyValue
Method 73createPersistData
Method 74browseDeleteWithNoRules
Method 75isFull
Method 76propType
Method 77movePrevious



Object xone.runtime.core.XoneXmlObjectWrapper


Result of XoneDataCollection.getXmlNode()

Methods:

Method 1selectNodes: Selecting nodes.
Method 2appendChild: Annexing child.
Method 3setAttribute: Setting attribute.
Method 4getAttribute: Getting attribute.
Method 5selectSingleNode: Selecting single node.
Method 6insertAfterChild : Inserting after child.
Method 7clone: clone.
Method 8removeChild: Removing child.
Method 9insertBeforeChild: Inserting before child.


Object xone.runtime.core.XoneXmlNodeListWrapper


Result of XoneXmlObjectWrapper.selectNodes()

Methods:

Method 1get
Method 2count
Method 3getCount


Object com.xone.android.nfc.dnie.DnieReadResult


Result of the callback of reading a DNIe with XOneNFC.


Methods:


Object com.xone.android.ptvplugin.PtvView


It is get from ui.getView(self)[“MAP_MAPAPTV”]

Methods:

Method 1drawRoute: Drawing route.
Method 2setProfile: Setting profile.


Object com.xone.android.printer.PrinterInfo


Result of XOnePrinter.getStoredPrinterInfo()

Methods:

Method 1getName: Getting name.
Method 2getType: Getting type.
Method 3getAddress: Getting address.
en/wiki/2.-desarrollo-app/2.4.-scripting-modelo-objetos/b.-objetos-complementarios/start.txt · Last modified: 2018/04/11 11:42 (external edit)