App object
app is the main object apart from the window object which provides the methods that interact with java and android classes.
It contains the following methods
| GetType() | |
| GetObjects() | Gets All Objects |
| Exit( kill ) | Exits the app |
| ToBack() | |
| Execute( js ) | Executes a piece of code |
| StartApp( file,options,intent ) | Starts app from javascript f file.Options include debug |
| StopApp( name ) | |
| SetScreenMode( mode ) | Sets screen mode to either full or not full |
| SetOptions( options ) | |
| SetTheme( theme ) | |
| SetPosition( left,top,width,height,options ) | |
| SetBackColor( clr ) | |
| StartService( packageName,className ) | Starts a service |
| StopService() | Stops a service |
| StartDebugServer() | |
| SendIntent( packageName,className,action,category,uri,type,extras,options,callback ) | Sends an intent |
| BroadcastIntent( action,category,data,type,extras ) | Broadcasts intent |
| SendMessage( msg ) | |
| LoadScript( url, callback ) | Loads an external script file to your code |
| LoadPlugin( url ) | Loads an external plugin to your code |
| Try( p1,p2,p3 ) | |
| SysExec( cmd,options ) | |
| Odroid( p1,p2,p3 ) | |
| GetName() | |
| GetPath() | Gets the storage path of droidscript app i.e "/sdcard/Droidscript" |
| GetAppName() | Gets the name of your app |
| GetAppPath() | Gets the path to your droidscript app i.e "/sdcard/DroidScript/Appname" |
| GetVersion() | |
| GetDSVersion() | |
| IsNewVersion() | |
| IsAPK() | |
| IsPremium() | |
| GetPackageName() | |
| CheckLicense( key ) | |
| GetAccounts() | |
| GetUser() | Gets user of the device i.e can be your email |
| GetDeviceId() | |
| GetCountryCode() | |
| GetLanguageCode() | |
| GetCountry() | |
| GetLanguage() | |
| GetOptions() | |
| GetSharedText( index ) | Get Shared text fron other apps |
| GetSharedFiles() | Gets shared files from other apps |
| GetActivities( options ) | |
| IsAppInstalled( packageName ) | |
| GetInstalledApps() | Returns Installed apps as an array of objects bearing the properties such as package name |
| GetRunningApps() | Returns running apps as an array of objects bearing the properties such as package name |
| GetRunningServices() | Returns Running services asan array of objects bearing the properties such as package name |
| GetIntent() | |
| GetNotifyId() | |
| SetSharedApp( name ) | |
| GetMediaFile( appName,ext ) | |
| KillApp( procId ) | |
| CreateShortcut( name,iconFile,file,options ) | Create a shortcut to homescreen |
| GetBuildNum() | |
| GetOSVersion() | |
| GetModel() | |
| IsTablet() | |
| IsChrome() | |
| SetOnError( callback ) | |
| SetOnDebug( callback ) | |
| SetOnKey( callback ) | |
| SetOnShowKeyboard( callback ) | |
| DisableKeys( keyList ) | |
| GetIPAddress() | |
| GetMacAddress() | |
| GetSSID() | |
| Broadcast( type,msg ) | |
| SetOnBroadcast( callback ) | |
| SetData( name,value ) | |
| GetData( name ) | |
| SetClipboardText( txt ) | |
| GetClipboardText() | |
| EnableBackKey( enable ) | Either true or false. Prevents app exit when back key is pressed |
| Wait( secs ) | Pauses the app for the number of seconds in the parameter |
| Alert( msg,title,options,hue ) | Shows a popup with a message |
| HideKeyboard( hide ) | Hides Keyboard |
| ShowKeyboard( obj ) | Shows Keyboard even withot a text edit |
| IsKeyboardShown() | |
| GetKeyboardHeight() | |
| TextToSpeech( text,pitch,rate,callback,stream,locale ) | |
| Debug( msg ) | |
| SetDebugEnabled( enable ) | true or false |
| CreateDebug() | |
| ShowDebug( show ) | |
| SendMail( address,subject,body,attach ) | |
| SendFile( file,subject,text ) | Send file to other apps |
| _Extract( p1 ) | |
| ExtractAssets( src,dest,overwrite ) | |
| GetResourceId( name,options ) | |
| Vibrate( pattern ) | app.Vibrate("23,45,67,89") |
| ShowPopup( msg,options ) | Shows a toast |
| ShowProgress( msg,options ) | Shows a progress that cuts user interaction untill its over |
| HideProgress() | Hides progress. Please ensure you hide progress otherwise you will need to kill droidscript app in order to stop it |
| ShowProgressBar( title,percent ) | |
| UpdateProgressBar( percent ) | |
| HideProgressBar() | |
| LoadText( name,dflt,file ) | Loads text from the private folder |
| LoadNumber( name,dflt,file ) | Loads number from the private folder |
| LoadBoolean( name,dflt,file ) | Loads boolean from the private folder |
| SaveText( name,value,file ) | Saves text to the private folder |
| SaveNumber( name,value,file ) | Saves number to the private folder |
| SaveBoolean( name,value,file ) | Saves boolean to the private folder |
| ClearData( file ) | Clear data in the private folder |
| GetTop() | |
| GetScreenWidth() | |
| GetScreenHeight() | |
| GetScreenDensity() | |
| GetDisplayWidth() | |
| GetDisplayHeight() | |
| GetDefaultOrientation() | |
| GetOrientation() | |
| SetOrientation( orient,callback ) | |
| GetRotation() | |
| GetBatteryLevel() | Gets battery level |
| PreventScreenLock( mode ) | |
| PreventWifiSleep() | |
| SetWifiEnabled( enable ) | |
| IsWifiEnabled() | |
| SetBluetoothEnabled( enable ) | |
| IsBluetoothEnabled() | |
| SetRingerMode( mode ) | |
| GetRingerMode() | |
| SetVolume( stream,level ) | |
| GetVolume( stream ) | |
| SetTitle( title ) | |
| SetMenu( list,iconPath ) | Sets menu options |
| ShowMenu() | Shows menu without touching menu button |
| AddLayout( layout ) | |
| RemoveLayout( layout ) | |
| DestroyLayout( layout ) | |
| MakeFolder( fldr ) | |
| GetPrivateFolder( name ) | |
| GetDatabaseFolder() | |
| DeleteDatabase( name ) | |
| FolderExists( fldr ) | |
| FileExists( file ) | |
| IsFolder( fldr ) | |
| ListFolder( path,filter,limit,options ) | |
| GetExternalFolder() | |
| GetInternalFolder() | |
| GetSpecialFolder( name ) | |
| GetEnv( name ) | |
| ReadFile( file,encoding ) | |
| WriteFile( file,text,mode,encoding ) | |
| OpenFile( file,type,choose ) | |
| OpenUrl( url,type,choose ) | |
| DeleteFile( file ) | |
| CopyFile( src,dest ) | |
| CopyFolder( src,dest,overwrite,filter ) | |
| DeleteFolder( fldr ) | |
| RenameFile( src,dest ) | |
| RenameFolder( src,dest ) | |
| UnzipFile( src,dest ) | |
| ZipFile( src,dest ) | |
| ZipFolder( src,dest ) | |
| GetFreeSpace( mode ) | |
| GetFileDate( file ) | |
| GetFileSize( file ) | |
| GetLastButton() | |
| GetLastToggle() | |
| GetLastCheckBox() | |
| GetLastImage() | |
| IsBluetoothOn() | |
| IsScreenOn() | |
| GoToSleep() | |
| SetScreenBrightness( level ) | |
| GetMetadata( file,keys ) | |
| SetAlarm( type,id,callback,time,interval ) | |
| Call( number ) | |
| SimulateTouch( obj,x,y,dir ) | |
| SimulateKey( obj,keyName,modifiers,pause ) | |
| GetJoystickState( id,key ) | |
| GetJoystickName( id ) | |
| SetJoystickOptions( options ) | |
| SetAutoBoot( auto ) | |
| SetAutoWifi( auto ) | |
| SetAutoStart( appName ) | |
| HttpRequest( type,baseUrl,path,params,callback,headers ) | |
| UploadFile( url,file,name,callback ) | |
| SaveCookies() | |
| ClearCookies( session ) | |
| SetUserAgent( agent ) | |
| SetUserCreds( name,password ) | |
| CreateLayout( type,options ) | |
| CreateImage( file,width,height,options,w,h ) | |
| CreateButton( text,width,height,options ) | |
| CreateToggle( text,width,height,options ) | |
| CreateCheckBox( text,width,height,options ) | |
| CreateSpinner( list,width,height,options ) | |
| CreateSeekBar( width,height,options ) | |
| CreateText( text,width,height,options ) | |
| CreateTextEdit( text,width,height,options ) | |
| CreateList( list,width,height,options ) | |
| CreateWebView( width,height,options,zoom ) | |
| CreateScroller( width,height,options ) | |
| CreateCameraView( width,height,options ) | |
| CreateVideoView( width,height,options ) | |
| CreateWebGLView( width,height,options ) | |
| CreateCodeEdit( text,width,height,options ) | |
| CreateTheme( baseTheme ) | |
| CreateYesNoDialog( msg,options ) | |
| CreateListDialog( title,list,options ) | |
| CreateListView( list,title,options ) | |
| CreateBluetoothList( filter ) | |
| CreateAudioRecorder() | |
| CreateSMS() | |
| CreateEmail( account,password ) | |
| CreateSmartWatch( type ) | |
| CreateCrypt( options ) | |
| CreateSpeechRec( options ) | |
| CreatePhoneState( types ) | |
| CreateDialog( title,options ) | |
| CreateMediaPlayer() | |
| CreateSensor( type,options ) | |
| CreateLocator( type,options ) | |
| CreateNetClient( type ) | |
| CreateNxtRemote() | |
| CreateWebServer( port,options ) | |
| CreateUSBSerial( baudRate,dataBits,stopBits,parity,device ) | |
| CreateSysProc( cmd ) | |
| CreateService( packageName,className,callback,options ) | |
| CreateObject( name ) | |
| CreateSynth( type ) | |
| CreateBluetoothSerial( mode ) | |
| CreateZipUtil( mode ) | |
| CreateDownloader( options ) | |
| CreateMediaStore() | |
| CreatePlayStore() | |
| CreateNotification( options ) | |
| CreateFile( file,mode ) | |
| Start() | |
| CreateNxt() | |
| CreateTabs( list,width,height,options ) | |
| CreateWebSocket( id,ip,port,options ) | |
| CreateGLView( width,height,options ) | |
| OpenDatabase( name ) |
