|
|
|
|
|
- Example for the InAndroidMode function
Example for the InAndroidMode function This example allows you to use an SQLite database on Android with access to the database from a PC when the device connects via USB. The database will be stored on the SD Card of the device.
sDataDirectory is string = "data_wm_androidsqlitedatabasesharepc"
sNameSQLiteDatabase is string = "wm_sqlitedatabase.db"
sUnitSDCardFromPC is string = "e:"
CntSQLiteDatabase.Provider = hNativeAccessSQLite
IF InAndroidMode() = True THEN
IF InSimulatorMode() = True THEN
CntSQLiteDatabase.Source = fExeDir() + ["\"] + sNameSQLiteDatabase
ELSE
IF SysStatusStorageCard() = sysCardAvailable THEN
CntSQLiteDatabase.Source = SysDirStorageCard() + ["/"] + ...
sDataDirectory + ["/"] + sNameSQLiteDatabase
ELSE
Error("No storage card is available in write mode on this device")
EndProgram()
END
END
ELSE
IF InPocketMode() = True _OR_ InWindowsPhoneEmulatorMode() = True THEN
Error("Access to the database not intended on this runtime platform")
EndProgram()
ELSE
CntSQLiteDatabase.Source = sUnitSDCardFromPC + ["\"] + ...
sDataDirectory + ["\"] + sNameSQLiteDatabase
END
END
IF HOpenConnection(CntSQLiteDatabase) = False THEN
Error("Failure connecting to the SQLite Android database", HErrorInfo())
EndProgram()
END
HCreationIfNotFound("*")
Info("Connection to the database established")
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|