I've got this going, and the file download 100%
Sharefile only open APP's to share, still no "install"
Try it on 2 different andoid devices
// Project: Auto Update Test
// Created: 20-01-10
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "Auto Update Test" )
SetWindowSize( 1280, 720, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1280, 720) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 )
global mouseX as integer
global mouseY as integer
Global spriteHit as integer
global CurrentVer as String = "1.0.0"
Global Webver as String
Global Webnumber as String
Global WebverID as integer
global curfile as string = "current.ver"
global webfile as String = "Flashcards.apk"
global verfile as String = "Flashcards.ver"
global website as string = "myserver.xyz"
#include "CheckUpdate.scene"
CheckUpdate_Setup()
if GetFileExists(curfile) // only delete for testing to prevent create new ver number everytime.. will delete when done
deletefile(curfile)
endif
if GetFileExists(curfile)
o = OpenToRead(curfile)
Currentver = readline(o)
//message("Open "+CurrentVer)
else
o = OpenToWrite(curfile)
WriteLine(o,Currentver)
//Message("write "+CurrentVer)
endif
CloseFile(o)
SetSpriteVisible(CheckUpdate_images[1],0)
SetSpriteVisible(CheckUpdate_images[2],0)
SetTextVisible(CheckUpdate_text[1],0)
// main loop
do
if GetVirtualButtonPressed(1)
http = CreateHTTPConnection()
SetHTTPHost( http, website, 0 )
GetHTTPFile( http, verfile, verfile )
while GetHTTPFileComplete(http) = 0
// Print( "Downloading: " + str(GetHTTPFileProgress(http)) )
Sync()
endwhile
CloseHTTPConnection(http)
DeleteHTTPConnection(http)
webverid = OpenToRead(verfile)
webver = ReadLine(webverid)
webnumber = ReadLine(webverid)
webfile = ReadLine(webverid)
CloseFile(webverid)
if webnumber = Currentver
MEssage("No NEW Update :" +chr(13) +"Current Version: " +CurrentVer+chr(13)+"Server Version: "+webnumber)
else
Message("New Version available "+chr(13) +"Current Version: " +currentver+chr(13)+"Server Version: "+webnumber)
SetVirtualButtonVisible( CheckUpdate_downloadbtn,1)
endif
elseif GetVirtualButtonPressed(2)
xp = getspritex(CheckUpdate_sprites[2])
xw = getspritewidth(CheckUpdate_sprites[2])
df = xw - xp
http = CreateHTTPConnection()
SetHTTPHost( http, "t.mroadedu.com", 0 )
GetHTTPFile( http, "Flashcards.apk", "Flashcards.apk" )
while GetHTTPFileComplete(http) = 0
// Print( "Downloading: " + str(GetHTTPFileProgress(http)) )
SetSpriteVisible(CheckUpdate_images[1],1)
SetSpriteVisible(CheckUpdate_images[2],1)
SetTextVisible(CheckUpdate_text[1],1)
SetTextColor(CheckUpdate_text[1],255,255,255,255)
SetTextString(CheckUpdate_text[1],"Downloading: "+str(GetHTTPFileProgress(http))+" %")
x = GetHTTPFileProgress(http)
SetSpritePosition(CheckUpdate_sprites[1],xp+2,getspritey(CheckUpdate_sprites[1]))
SetSpriteSize(CheckUpdate_sprites[1],((df * x) / 100),32)
Sync()
endwhile
CloseHTTPConnection(http)
DeleteHTTPConnection(http)
SetSpriteVisible(CheckUpdate_images[1],0)
SetSpriteVisible(CheckUpdate_images[2],0)
SetTextVisible(CheckUpdate_text[1],0)
message(getwritepath())
if GetFileExists("Flashcards.apk")
o = opentowrite(curfile)
writeline(o,webnumber)
CloseFile(o)
sharefile("Flashcards.apk")
else
Message("Error File not found")
endif
endif
//print("Current Version: "+Currentver)
//print("New Version: "+webnumber)
Sync()
loop
do
defaultVar()
Print( ScreenFPS() )
Sync()
loop
function DefaultVar()
mouseX=GetPointerx()
mouseY=GetpointerY()
Spritehit = getspritehit(MouseX,MouseY)
endfunction