B4A Library AppUpdating - automate apps updating from a webserver

Status
Not open for further replies.
Important note: since all the changes made to the Android OS the original code is to be considered outdated. Thanks to @Yayou49 you may find at post#290 a version of the class usable on Android 6+ versions.

Note: version 1.25 breaks existing code so, please, read changelog in post #60 below.


Hi all,

this is my first contributing lib to this great NG.
How do I dare to publish such a low-grade stuff in an area where generally you may find real masterpieces of programming? Well, to be honest, I hope in your help to upgrade my work to a status of "ready-made solution" for those who prefer to run their own webservers where to publish apps.
Secondly, I was asked (both privately and publicly) to overcome my legitimate embarassment and go on with the publication. So, here we are: AppUpdating 1.18!

Note: any valid code fragment comes from some other thread, while all the bad stuff is entirely mine ;-)

Please find attached both the library as is (yes, it works out of the box) and its source code.

On a following post I'm gonna describe the lib in greater detail and show how to use it.

Umberto

AppUpdating version history

* version 1.30 (read notes on post #228)
  • compiled with okHttp 1.01 and okHttpUtils 2.20
  • removed files for version 1.25

* version 1.26 (read notes on post #84)
  • added property WebChangeLog to read optional app's version changelog data
  • better management of versioning in the info file
  • removed files for version 1.18 to avoid confusion (still available on request)
* version 1.25
* version 1.18
  • initial release
 

Attachments

  • AppUpdating_126_ex.zip
    28.3 KB · Views: 1,183
  • AppUpdating_126.zip
    11.3 KB · Views: 1,242
  • AppUpdating_126_src.zip
    10.8 KB · Views: 1,002
  • AppUpdating_130.zip
    11.4 KB · Views: 1,216
  • AppUpdating_130_src.zip
    15.7 KB · Views: 1,131
  • AppUpdating_130_ex.zip
    33.4 KB · Views: 1,339
Last edited:

udg

Expert
Licensed User
Longtime User
Thank you. I did include a few suggestions from the thread for the final release of AppUpdating 1. It's ready since a few weeks but I'd like to briefly test it before submitting to post#1.
Hopefully I'll have some spare time before Xmas.
 

victormedranop

Well-Known Member
Licensed User
Longtime User
trying everything in android 7. but no luck
this is the error

java.lang.NoSuchMethodError: No static method onStartCommand(Lanywheresoftware/b4a/BA;)Z in class Lanywheresoftware/b4a/objects/ServiceHelper$StarterHelper; or its super classes (declaration of 'anywheresoftware.b4a.objects.ServiceHelper$StarterHelper' appears in /data/app/b4a.example.appupdate-2/base.apk)

but work in amazon fire.
 

udg

Expert
Licensed User
Longtime User
Last edited:

techknight

Well-Known Member
Licensed User
Longtime User
Just a heads up my Pixel is running 8.1, and AppUpdating is still working fine, although I have recompiled it recently.
 
  • Like
Reactions: udg

Walter Scafati

Active Member
Licensed User
Longtime User
Hi,
I realized a App and I would to use this library for to implement the AutoApdate of the my App from the server.
Just I add the library AppUpdating v.1.30 I have the conflict with the OKHttpUtils2 v.2.61, and have the error. If I trie to remove the check from OKHttpUtils2 library I have'nt the error but the App crash when my this trying to connect to mySql DB on my server.
How I can solve this problem? Thanks.


Conversione byte code - ottimizzazione dex. Error
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokio/AsyncTimeout;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokio/AsyncTimeout$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokio/AsyncTimeout$2;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokio/AsyncTimeout$Watchdog;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokio/Base64;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokio/Buffer;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokio/Buffer$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokio/Buffer$2;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokio/BufferedSink;
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Translation has been interrupted
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:689)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:313)
at com.android.dx.command.dexer.Main.run(Main.java:279)
at com.android.dx.command.dexer.Main.main(Main.java:247)
at com.android.dx.command.Main.main(Main.java:106)
Caused by: java.lang.InterruptedException: Too many errors
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:681)
... 4 more
 

udg

Expert
Licensed User
Longtime User
Hi Walter,

did you read post #242 and those soon following it? You should recompile AutoUpdating from its source with your copy of B4A to overcome the differences on internal libraries' versions.

udg
 

Yayou49

Active Member
Licensed User
I'm happy to give you (with UDG authorisation) my updated class cl_appupdate (attached).
This version manage the new version of sdk (26)

It has been done with a part of Erel's code about Fileprovider.
I've tested it with my phone (Android 7.0 SdkVersion 24) and it works fine !

So:

1: add to your manifest
B4X:
AddManifestText(<uses-permission
    android:name="android.permission.WRITE_EXTERNAL_STORAGE"
    android:maxSdkVersion="18" />
)

AddApplicationText(
  <provider
  android:name="android.support.v4.content.FileProvider"
  android:authorities="$PACKAGE$.provider"
  android:exported="false"
  android:grantUriPermissions="true">
  <meta-data
  android:name="android.support.FILE_PROVIDER_PATHS"
  android:resource="@xml/provider_paths"/>
  </provider>
)
CreateResource(xml, provider_paths,
   <external-files-path name="name" path="" />
)
AddPermission(android.permission.REQUEST_INSTALL_PACKAGES)

2: Add in your starter class:

B4X:
Sub Process_Globals
    Public rp As RuntimePermissions
    Public SharedFolder As String  
End Sub

Sub Service_Create
    SharedFolder = rp.GetSafeDirDefaultExternal("")
End Sub

3: update the cl_appudate


Thanks to UDG for his time.
 

Attachments

  • cl_appupdate.bas
    16 KB · Views: 475

Drago Bratko

Active Member
Licensed User
Longtime User
Is there a way to make app update in 'silent' mode ... so without asking user, and that app is updated and restarted ?
If not with 'normal' phone, is it possible wit rooted ones ?


Maybe this question was already asked and answered ... but I can't found it ...
 

DonManfred

Expert
Licensed User
Longtime User
  • Like
Reactions: udg

udg

Expert
Licensed User
Longtime User
Unfortunately Android doesn't allow it, at least for non-rooted devices. I don't know if it can be done on rooted ones. Sorry.
 

DonManfred

Expert
Licensed User
Longtime User

cledic

Member
Licensed User
Longtime User
Hello to all,
I receive this error:
B4X:
copy fichier
android.system.ErrnoExceptionpen failed EROFS (Read-only file system)

using code from post: #243, plus suggested modification as from post: #290
I receive the error on App installed on: Android 5.0.1, Android 6.0 and Android 8.0.
The "Manifest" of my App is:
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="26"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
AddPermission(android.permission.ACCESS_COARSE_LOCATION)
'********* TabStrip ***********************
CreateResource(drawable, background_tab.xml,
<selector xmlns:android="http://schemas.android.com/apk/res/android"
   android:exitFadeDuration="@android:integer/config_shortAnimTime">
  <item android:state_pressed="true" android:drawable="@color/background_tab_pressed" />
  <item android:state_focused="true" android:drawable="@color/background_tab_pressed"/>
  <item android:drawable="@color/background_tab"/>
</selector>)
CreateResource(values, colors.xml,
<resources>
  <color name="background_tab_pressed">#50D3F180</color>
  <color name="background_tab">#50E4E4E4</color>
</resources>)
'******************************************
AddManifestText(<uses-permission
    android:name="android.permission.WRITE_EXTERNAL_STORAGE"
    android:maxSdkVersion="18" />
)
AddApplicationText(
  <provider
  android:name="android.support.v4.content.FileProvider"
  android:authorities="$PACKAGE$.provider"
  android:exported="false"
  android:grantUriPermissions="true">
  <meta-data
  android:name="android.support.FILE_PROVIDER_PATHS"
  android:resource="@xml/provider_paths"/>
  </provider>
)
CreateResource(xml, provider_paths,
   <external-files-path name="name" path="" />
)
AddPermission(android.permission.REQUEST_INSTALL_PACKAGES)


Android JAR is: C:\Android\platforms\android-26\android.jar
B4A ver is: 7.8

Can someone help me where am'I wrong?

Thanks
Clemente
 

techknight

Well-Known Member
Licensed User
Longtime User
Ran into a new problem with this lib.

For some weird reason the lib is hanging and not firing the UpdateComplete when ---- AppUpdating.ReadCurVN is called.

Only on one particular app. I checked everything else. Odd...

Edit: I actually traced it down to this not working:

B4X:
CallSub(Callback,Event&"_UpdateComplete")

So I think its a bug in B4A.
 
Last edited:

techknight

Well-Known Member
Licensed User
Longtime User
Turning off log filtering in logcat, I get this:

---- AppUpdating.ReadCurVN
Current Version: 1.30
sendKeyguardVisibilityChanged(true)
ignoring event: update_updatecomplete

Yikes! thoughts?

Recompiling with CallSubDelayed did not work either.

Edit: Nevermind. I was doing my update check in the Activity_create thread which will never work.

I have to release that thread and then use a timer or something, and that worked.
 
Status
Not open for further replies.
Top