How to identify download URL of apk - android

I am writing an application where inside application wanted to identify from which URL-Source apk is download. Is there any way to get it.
Basically I wanted to know how many times apk is install from given URL.
Any suggestion here!!

I am writing an application where I need to find download URL of apk. Is there any way to get it.
No, because there is no download URL. APKs are installed from local files. How the APK got to be a local file (downloaded from a URL, received in an email attachment, copied over to external storage via USB cable, etc.) is not something that you can determine.
Basically I wanted to know how many times apk is install from given URL.
You are certainly welcome to use product flavors in Android Studio/Gradle for Android to create custom APKs based on distribution channel, where those APKs have a custom value baked into them (e.g., buildConfigField mapping to a BuildConfig field).

Related

How to insert unique data into an Android APK package with each download?

Goal: To embed info from HTTP headers into an APK package, on-the-fly, during download.
Situation: There is an APK package the company website, available for public downloads. A user comes to the download page, and the server grabs the referring URL, and landing page URL. What we need is, for the URLs to be included inside the package, so that when the app is installed and user creates an account using the app, the URL info is available to the app and appened to the newly created account details (for purposes of traffic analysis and marketing attribution).
An APK is fundamentally an archive.
I think that you should be able to unzip, edit and zip it again without changing its signature, as you can see from this detailed guide
In order to put a unique code inside your app, you could use the assets folder creating a txt or json file containing that code.
Then, you can retrieve the unique code inside your app by reading the assets folder programmatically.
To change the apk, you would need to change the code and recompile it. It’s not possible to modify the content of a compiled apk.

Android build to share to other devices and to upload on itch.io

I am currently working on an android game but when I try to build it, we can do it in two ways i.e.
If we check the Bundle Opting in the build menu then it will come in a single file of formate .adb (Android Debug Bride) it may or may not work with Google Play Store or the App Store but I am not targeting on that I wanted a file or files that I can share with my friends or on itch.io because you can only upload a file or files on it, it is not responsible for installing for anything and whoever downloads the from it, he will just get the file on his/her android device and will not get an installed app to start playing it.
we can also check the Splitting opting in the player menu of project setting and then the build will split into two files, 1. .apk , 2. .obb. well this is a good option but with the same problem if I upload it to a distributor or share it to my friends the two files will be downloaded or shared with no installation
Please tell me a way how I can make a file that can download itself or any solution to this.
I just want a way to build an android game that can easily be installed through a distributor or through sharing
Thank You in Advance
What you want is just an APK.
An app bundle is intended for the Google Play Store. If you upload your app as an app bundle to the Play Store, Google repackages it into multiple APKs which only contain the data and code that is required for specific device configurations of end users. E.g. it only contains specific languages, and code for specific architectures and so on.
If you enable the "Split Application Binary" option, Unity limits the size of your APK to 100MB since this is the limit of the Google Play Store. It then creates the expansion file (.obb) which you would also upload to the Play Store.
In your case, you don't need any of it. You need one APK.
Disable "Build AppBundle (Google Play)" and "Split Application Binary" and you should be able to create one big APK.

Make APK with unique ID without compiling

There is such problem:
1) I have to use my our distribution service to give new builds of app to testers (no way to use HockeyApp or etc.)
2) I want to give unique APK file to each tester. But it is not possible for me to compile ~3000 APK files for every new build of application.
So I want to add some kind of ID to APK file without recompiling it.
(I need it to identify, if some user will share this APK file somewhere in web without my permission)
Example:
User downloads .apk file from my site => uploads it to some forum/website => I see, that somebody has shared my app in web => I download apk from that forum/website => I identify, who shared it (via unique ID of apk)
That is not going to be easy because all files of your APK are covered by the signature, so anything you add will have to be somewhere else.
You could try modifying the zip comments of the APK (if you can find a library that allows you to do that -- maybe "apkzlib"), I'm not sure if this part is covered by the signature.
Alternatively, you could try adding a file to the APK that is not referenced in the zip central directory (a "ghost file" in a way, it wouldn't exist for most zip tools), maybe the signature doesn't cover those either, but I haven't verified. This solution also requires good knowledge of the zip format to implement it.
Note as well that if this can be done without touching the signature, it can also be removed without touching the signature... so if one of your tester finds out about this, they could remove it. But I guess it wouldn't be trivial to do, so that might be sufficient anyway.
There are two constraints:
Unsigned apks can not be installed.
an apk signature signes every bit of the apk, therefore the wole apk must be signed.
Luckily signing an apk takes only some seconds and should be feasible for 3k apks.
So you can write a script that writes the id to a file within the akp (which is basically a .zip file) and sign it afterwards. See Can I re-sign an .apk with a different certificate than what it came with?
See https://developer.android.com/studio/publish/app-signing#sign-manually on how to sign from command line.

Install APK from site without downloading

Until now, I only develop apps for myself or for close friends.
I don't sell apps so I'm not interested in Google Play.
So, I upload for a personal site I have, give the link to my friends,
and they download the APK.
Next they install the app and delete the APK for saving memory space.
How can I install directly my apps from my site without download the APK?
Thank you
APK shouldn't be taking that much space but what you can do is this:
1) In your MainActivity, have a method where you search for APK file in the phone external storage. (the example searches for ".pdf", change the extension to ".apk")
2) Then use a APK parser library to get the package name of the APKs found.
3) If the package name equals to your package name, delete that file.
Make sure to call that method on your onCreate() of your main activity.
Hope this helps.

Copying android .apk to another .apk file through java code and over-ride its assets files?

is it possible to create .apk file by copying an already existing .apk file and modifying its assets folder? I have some information in a file in assets folder containing server ip and port to which the user is to connect. Users are from different regions and have to connect through different servers. can anyone tell me how to implement this?
I've added a comment with my recommended solution to this problem. However, here's an answer to your question:
Of course you can unpack the APK, swap out the assets and then create a new APK from that. However, you will need to sign the APK again with the correct key.
If you are building the apps yourself, you can just build multiple APKs, each containing a different asset file. However, you would have to distribute these APKs by hand (ie: they can't be uploaded to Google Play) because they would each have the same package name and you cannot have multiple apps in the app store with the same package name.

Categories

Resources