Android Question How can modify the app without having access to the source code.

invocker

Active Member
I have this apk source code

B4X:
Sub DownloadAndSave (Url As String, Dir As String, FileName As String) As ResumableSub
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download(Url)
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        Dim out As OutputStream = File.OpenOutput(Dir, FileName, False)
        File.Copy2(j.GetInputStream, out)
        out.Close
    End If
    j.Release
    Return j.Success
End Sub
Sub Button1_Click
dim Url as string = "https://b4x-4c17.kxcdn.com/android/forum/data/avatars/m/70/70838.jpg?1442421564"
dim Dir as string = File.DirRootExternal
dim FileName as string =  "pictures/1.jpg"
Wait For (DownloadAndSave(Url, Dir ,FileName )) Complete (Success As Boolean)
If Success Then
                ToastMessageShow( "Saved " & File.Combine(Dir ,FileName),True)
              End If
End Sub

I want to change a red text without access to source code

like this


Sans titre.png
 

Attachments

  • Sans titre.png
    Sans titre.png
    9.9 KB · Views: 522
Last edited:

Computersmith64

Well-Known Member
Licensed User
Longtime User
I'm not sure I really understand what you're trying to do - but if you want to be able to change the download address & filename after the app is released, they you could try using Firebase Cloud Messaging or Firebase Remote Config. Google them & see if either will do what you want & if so, search the forum for more info on how to implement them.

- Colin.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I have this apk source code
1. The Screenshots you posted is NOT from a APK.
2. Without source you are NOT ABLE to change anything.
3. You should describe it much more clearly what exactly you want to do. It is not really clear
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Modifications to an APK are possible using a popular tool which allows you unpack an APK, make changes, then repack and re-sign the APK so it will install on devices after the modification. (I was able to modified an APK from another company so that it would not appear in the "Share to" menu on my phone).

But I think everyone might be confused because you say you don't have the source code, but then you post source code.

Is the APK you want to modify from another company? If so, then I am hesitant to provide more details on how to modify an apk because it can be used for bad things, such as modifying a popular app to download malware from a bad site instead of a legitimate file from the original app producer's server (and then post the modified apk on non-play store download sites.)

If the program is as simple as the source code you provided, then why not simply create a new B4A app that has the changes you need?
 
Last edited:
Upvote 0

invocker

Active Member
1. The Screenshots you posted is NOT from a APK.
2. Without source you are NOT ABLE to change anything.
3. You should describe it much more clearly what exactly you want to do. It is not really clear
Thank's
1 - The Screenshots is for vbnet app for change a string in the apk file
2 - The source I put it Hier
code source apk
B4X:
Sub DownloadAndSave (Url As String, Dir As String, FileName As String) As ResumableSub
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download(Url)
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        Dim out As OutputStream = File.OpenOutput(Dir, FileName, False)
        File.Copy2(j.GetInputStream, out)
        out.Close
    End If
    j.Release
    Return j.Success
End Sub
Sub Button1_Click
dim Url as string = "https://b4x-4c17.kxcdn.com/android/forum/data/avatars/m/70/70838.jpg?1442421564"
dim Dir as string = File.DirRootExternal
dim FileName as string =  "pictures/1.jpg"
Wait For (DownloadAndSave(Url, Dir ,FileName )) Complete (Success As Boolean)
If Success Then
                ToastMessageShow( "Saved " & File.Combine(Dir ,FileName),True)
              End If
End Sub
 
Last edited:
Upvote 0

invocker

Active Member
Change code to:
B4X:
dim Url as string = File.ReadString(File.DirAssets, "url.txt")

Create a B4J program that unpacks the APK which is a regular zip file, replaces Files\url.txt, creates a new APK and sign it with jarsigner Java tool.
Thank's Yes, I use this method, but I wanted to know other methods to do this

sample example
B4X:
Dim str As TextReader
str.Initialize(File.OpenInput(File.DirAssets,"1.txt"))
ToastMessageShow(str.ReadAll,True)
 
Last edited:
Upvote 0

aeric

Expert
Licensed User
Longtime User
I also confused why one need to modify the "compiled" apk and then recompile every time a change of a string value take place. As Erel pointed above, we can use a "setting" file to control the "dynamic" values. We can use plain text file, xml or a simple sqlite database file. I prefer to use an sqlite db.
 
Upvote 0

kisoft

Well-Known Member
Licensed User
Longtime User
Change code to:
B4X:
dim Url as string = File.ReadString(File.DirAssets, "url.txt")

Create a B4J program that unpacks the APK which is a regular zip file, replaces Files\url.txt, creates a new APK and sign it with jarsigner Java tool.
There is an example of how to do this? I am interested in my APK files to obfuscate the code more efficiently.
 
Upvote 0

kisoft

Well-Known Member
Licensed User
Longtime User
I don't see how it is related to obfuscation. If you want to add encrypted data to your app then add the encrypted files directly. No need to unpack and resign the APK.
You're right, I should start a new thread with a new problem. I just wanted to play hacker and see what is visible after the blackout ... But for this I need a slightly different approach ...
 
Upvote 0
Top