Android Question [SOLVED] UDG AppUpdate issue ...

Yayou49

Active Member
Licensed User
Hi,

I'm using appupdate from UDG.

I'm facing a known problem if I read some threads about "exposed beyond app through Intent.getData()"

Does someone already apply change on appupdate source code to avoid this error ?
I must admit that I'm not really comfortable with explainations given by Erel ....

Problem occur on lines:

B4X:
Dim i As Intent
i.Initialize(i.ACTION_VIEW, "file://" & File.Combine(File.DirDefaultExternal, "tmp.apk"))
i.SetType("application/vnd.android.package-archive")
StartActivity(i)

So, if someone can help me, it will be very useful for me !
Thanks in advance.
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Yayou49

Active Member
Licensed User
Thanks for the link, but I already read it and as I said, I'm really not comfortable with this code ......
That's why I was asking if someone already implement this code in appupdating ....
 
Upvote 0

Yayou49

Active Member
Licensed User
I'm happy to give you (with UDG authorisation) my updated class cl_appupdate (attached).
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

You can also have a look on UDG original post: https://www.b4x.com/android/forum/threads/appupdating-automate-apps-updating-from-a-webserver.37783/

If someone can test it with version greater than mines, feel free to give us a feedback.
 

Attachments

  • cl_appupdate.bas
    16 KB · Views: 345
Last edited:
  • Like
Reactions: udg
Upvote 0
Top