B4A Library AppUpdating - automate apps updating from a webserver

Status
Not open for further replies.

udg

Expert
Licensed User
I see.
What if the whole updating stuff is run only on device boot followed by entering the kiosk mode and app launching?
 

udg

Expert
Licensed User
As Manfred told you a few posts above, we're working on a new project.
The lib part of it will be something closer to the service active in Google's PlayStore: something that from device boot looks for eventual upgrades of listed apps and then sends notifications letting the user to decide what and when to upgrade/install.

Maybe to solve your problem you don't need the whole stuff, but just a few pieces to re-assemble at your will.

I see a scheme like:
1. Device boot
2. "Special" app launches itself and discovers apps to be updated (in your case, no notification is needed)
3. for each app which has a newer version the "special" app downloads the apk and sends the appropriate OS Intent
4. the user (medical staff or anyone working at that office) accepts or denies updates
5. on "special" app termination you set the Kiosk Mode and launch the app with which the patients operate

Could this work for you?

Umberto
 

Theera

Well-Known Member
Licensed User
Hi DonManfred,or all
I've interested this thread for a long time,I've just found how to set my own web server as localhost.
I have 2 problems to ask you.

1.) I use phpThai as webserver alike xampp,I've done,but I can't set the tablet link to the web server(I use win8 32 bits as web server) How to set my windows8 for this connection?
2.) In your post11 ,I get your example,inside of txt file (it means as the attached picture ) ,Should I write something in it?
 

Attachments

Last edited:

DonManfred

Expert
Licensed User
You dont need to change your network-card-settings! At the time you can see something like on your MyWebServerPic.jpg you are ready

The process of the webserver (phpthai?) should have access to internet through your firewall... But if it has access then you should be able to call your phprhai from your app

You want to use YOUR PC as server, yes?
look what Internet-IP you have... For example if your internet-ip is 123.12.34.45
then the adress to apk in your app should look like http://123.12.34.45/b4a/apk/TestAnchor.apk

BUT. The most people dont have an static (not changing) IP-Address.. So, this ip could have an other value when you restart your computer...
In that case you app can not reach your computer cause of ip-address changes... Maybe your computer now have
123.12.34.92 as ip and your app dont know this adress. So it runs into a not found error...
The new apk-url is http://123.12.34.92/b4a/apk/TestAnchor.apk now

Best way is to have an small webhosting at some webspace-provider beside a domain... an IP from an domain useually dont change.

You then just upload your txt and apk file to your webspace and then, in your app, you set the path to
http://myowndomain.tld/b4a/apk/TestAnchor.apk
when your registered domainname is "myowndomain.tld"
 

Theera

Well-Known Member
Licensed User
Hi Manfred,
My Ip Adress is 192.168.1.3 as web server,I try to input at the tablet " 192.168.1.3/b4a/apk" ,but It's not work. How do I do?(I'm not expert all of computer,I've many tried to search from google)
My tablet can't connect to my server.
 

Attachments

Last edited:

DonManfred

Expert
Licensed User
Your ip 192.168.1.3 is your LAN(1)-IP-Address.
Your APK should be able to reach this address if your device is in your WIFI.

If the device is using internetconnection NOT YOUR WIFI... e.g. a internetprovider,,, THEN you must use your WAN(2)-IP-Address you got from your internetprovider..

Call the url http://www.wieistmeineip.de/ from your pc... The big IP in the top is your WAN-IP

Use this ip in your app in url...

(1): LAN LocalAreaNetwork (your router, your pc, any device who connects to your router)
(2): WAN WideAreaNetwork (anything else (not in LAN)... THE INTERNET)

In you router (the one under 192.168.1.1) for example you should somewhere see your WAN address... THAT´s the ip you should use in your app
 
Last edited:

Theera

Well-Known Member
Licensed User
Hi Manfred,
I'm sorry ,you quickly answer. If I understand your words,I must use ip address instead of domain name,but I can't do it be connection
 
Last edited:

Theera

Well-Known Member
Licensed User
Thailand is 3.00 pm ,I have stay at computer 08.00a.m.-03.00p.m. ,I always wake up at 04.00a.m. ,I sleep at 09.00-10.00p.m. But I still be stupid.
 

Theera

Well-Known Member
Licensed User
i will try tomorrow,thank you
 

Theera

Well-Known Member
Licensed User
Hi Manfred,
I'm sorry to reponse you so late, I 've tried myself,but it's not worked. Please help me again. :(
 

Attachments

Theera

Well-Known Member
Licensed User
Yes,I have done. I think I should search it in the book 's store before and return back again. Thank you Manfred.
 

DonManfred

Expert
Licensed User
If you have an router then the problem could be there.
Look in your routers manual how to configure a portforwarding.

pubic port: 80
local port: 80
ip: 192.168.1.3
type: TCP

Test it with your pcs webbrowser. It must show the same as your localhost/b7a/apk/ call...
 

tuhatinhvn

Active Member
Licensed User
java.lang.StringIndexOutOfBoundsException: String index out of range: 4

error

If FirstTime Then
apkupdt.Initialize(Me,"tab1") 'tab1 has no meaning; use any name you like
'this is yor app's package name (see "Project/Package name")
apkupdt.PackageName = "com.xxx.xx"
'this is the complete path to the text file holding the newer version number
apkupdt.NewVerTxt = "http://xxxx.net/xx/v.txt"
'this is the complete path to your newer apk
apkupdt.NewVerApk = "http://xxxx.net/xx/frmstart.apk"
' apkupdt.UserName = "test" 'needed since folder p_apk has access restrictions
' apkupdt.UserPassword = "test" 'as above
'not needed- just to show use of function GetCurVN
Log("I am version: " & apkupdt.GetCurVN)
'use only if you like to show a splash screen while update checking goes on
' apkupdt.SetAndStartSplashScreen(Activity,LoadBitmap(File.DirAssets, "pioneer-music-wallpapers.jpg"))
'this function starts checking for any newer version of the current app
apkupdt.LookForNewVersion
End If
 

DonManfred

Expert
Licensed User
what´s the content of "http://xxxx.net/xx/v.txt"? For a version of 1.50 it must be

BTW: In the code you posted i cannot see anything what could give an StringIndexOutOfBoundsException...

Maybe there are more infos in the log about this error? Maybe a line of code where the exception happens
 
Last edited:

udg

Expert
Licensed User
AppUpdating version 1.25 is finally released!

Attached to post #1 you may find three new zip files:
- AppUdating_125.zip: updated lirary fles; just copy to your extralib dir and you're ready
- AppUpdating_125_src.zip: source code to library files
- AppUpdating_125_ex: example app showing lib usage

Unfortunately version 1.25 breaks existing code. Sorry guys.
A few variables are gone and even the main sub changed its name, but now everything appears more coherent to me and easier to maintain.

ChangeLog
To set credentials to access a protected folder on webserver you now have a new function: setCredentials(Username, Password).
Properties sUserName and sUPassword are no longer directly reachable.
NewVerAvailable var is no longer available
IsDone function is no longer available
LookForNewerVersion function changed its name to UpdateApk
Added costants for Error codes and Status codes
Added property sVerbose; setting it to TRUE makes logs mode veeery verbose
Previous sub GetCurVN is now ReadCurVN
Added newer and different function getCurVN to be coherent with getWebVN
Now you're expected to call the Readxxx functions first and on their completion call the getXXX counterparts.
Added step-by-step function: ReadCurVN, ReadWebVN, DownloadApk, InstallApk
So now you could call UpdateApk which does all the work in a single rush or call each of the above functions to retain more control over the process.

You are encouraged to have a look at the example code where any feature is used.

Once again, sorry for any inconvenience this update may cause to you.

Umberto
 
Last edited:
Status
Not open for further replies.
Top