I'm preparing my app for the play store and plan to deliver one component as separate install package (since my customer can't recover the source code, but the app is signed with his key). I thought about two ways of doing that. My needs are just these: Users with "unknown sources" deactivated should be able to install the 2nd app. And: The user should never be redirected to Google Play store.
Both apps are free.
I've looked up for solutions that would let me download an additional APK from Google Play and simply present the user an installation screen to acceppt the installation. I would like a solution, where I sent an intent to the PlayStore app and it displayed the app name, permissions and the install button. I've found nothing. Anyone any experience here?
I thought I could package this additional app into the assets of my enclosing app. I'd need to write it to the file system and send the system an intent to install the package. Problem: The App was not loaded from Google play and with that it's source is unknown. If I used the PackageManager and let it install the APK, does the permission INSTALL_PACKAGES allow my app installing this 2nd app on a user's device (since the user already accepted that my app may install packages)?
I hope someone may help. And thank you in advance.
My needs are just these: Users with "unknown sources" deactivated should be able to install the 2nd app. And: The user should never be redirected to Google Play store.
This combination is impossible, barring a major security flaw in Android and/or the Play Store. The only way to install apps through the Play Store is via the Play Store app.
I would like a solution, where I sent an intent to the PlayStore app and it displayed the app name, permissions and the install button.
That activity is not exported. You are welcome to use a market:// Uri to lead the user to the Play Store, where they can review this second app and decide, for themselves, whether or not to download and install it.
since the user already accepted that my app may install packages
Your app cannot install packages directly, unless it is signed with the firmware signing key or is installed on the system partition (e.g., by a rooted device user), as that is the only way that you can hold the INSTALL_PACKAGES permission. Ordinary SDK apps are welcome to create an ACTION_VIEW or ACTION_INSTALL_PACKAGE Intent to request that the app be installed, but the user will need "unknown sources" enabled.
Related
I've and application that requires a secondary application to be installed to work . Reason for this vary, mostly memory (both flash and ram) footprint if this is used from multiple applications.
Anyway, it's not very convinient that a user has to go to the playstore again after having downloaded and started the first app.
Now I've discovered google drive does the same with google docs/sheets/presentation. You first install google drive, and when you need another application you still need to install it.
However google drive manages to show an "do you want to install this application" popup immediately instead of just redirecting the user to the playstore: See https://drive.google.com/file/d/0BxHD8LQaDPnrbXpEcm1HdV9KVkpNOUlRWldyVjhBbnFkSFJN and https://drive.google.com/file/d/0BxHD8LQaDPnrRS1PSHdyNDRXT3Nzb3BBVjNfSDVRbDZhaGpN
Question is: does anybody have an idea how to do this? Or is this an api that only google apps are allowed to use? I've not found any documentation about it. Decompiling the google drive app also did not help me much, it's heavily proguarded.
Intent promptInstall = new Intent(Intent.ACTION_VIEW)
.setDataAndType(Uri.parse(yourApkFilePath),
"application/vnd.android.package-archive");
startActivity(promptInstall);
Download apk file to sdcard(from your server) and use above code with filepath. It opens a prompt to the user whether to install new application.
Note: this works only if the user checks "Install app from external sources" in the Settings
Today the Google Drive app asked if I wanted to install the new apps Sheets & Docs.
I've accepted, expecting it to open Google Play Store so I could press install.
It didn't. It just showed me the popup with the permissions of each of the apps to confirm the installation, the same that appears when you press "Install" on any app on the Play Store.
I was not aware this could be done.
How can we reproduce this behavior in an app: have a button "Install App XPTO" which doesn't need to open Google Play Store? Just shows the permissions dialog and proceeds to install it via Play Store?
UPDATE:
For those downvoting because they think this is the same as other questions... It's not!
In this case, the APK is not downloaded by Google Drive app and then installed. Google Drive "tells" Play Store to download & install.
That's the API that I'm interested.
To support my case: after pressing INSIDE Google Drive to install the apps without opening Play Store, the download starts. During the download I've opened the Play Store to check and:
The screenshot proves that it isn't Google Drive downloading the APK and the installing it. It's the Play Store.
The logs for Google Drive shows that activity responsible for "telling" the Google Play Store to install apps is
com.google.android.apps.docs/com.google.android.apps.docs.app.PhoneskyApplicationInstallerActivity
which, apparently, "tells"
com.android.vending/com.google.android.finsky.billing.lightpurchase.LightPurchaseFlowActivity
to install required packages.
So, theoretically, one could create an intent
Intent intent = new Intent("com.android.vending.billing.PURCHASE");
intent.setClassName("com.android.vending",
"com.google.android.finsky.billing.lightpurchase.LightPurchaseFlowActivity");
intent.putExtra(EXTRA_NAME, EXTRA_VALUE);
startActivityForResult(intent, 0);
with correct extra values and voilĂ !
However, calling LightPurchaseFlowActivity from non-Google signed app is failing, because they are, again apparently (according to the logs), checking the calling package's signature:
W/Finsky(13209): [1] LightPurchaseFlowActivity.setupFromExternalPurchaseIntent: Called from untrusted package.
So, there, this can not be achieved at this moment.
Google+ now implements buttons where you can directly download an app (see this link) without clicking the button on the play store site.
The link looks like this:
https://play.google.com/store/apps/details?id=com.example.app&rdid=com.example.app&rdot=1&feature=md
If you add the rdid, rdot and feature parameter it works on my phone (if I type it in the browser, not tested with an intent and not tested to update an app, only installing it).
Edit:
I found out that you only need to add the rdid-parameter to the url. Source: http://www.androidb.com/2014/04/increase-app-installs-with-a-single-trick/
Edit2:
Does not work with an intent. :(
I'd say that the Google Drive has system permissions, just like the Play Store. Probably because it is signed with Google's signature.
If you manage to have the "android.permission.INSTALL_PACKAGES" permission you can call the API (which is not included in the android.jar deployed by SDK Manager, you have to get the hidden APIs from the android.jar in the emulator for instance) to install the applications.
So, basically, unless you have system permissions (by putting your APK into /system/app, signed with OEM certificate or with root) you won't be able to do it.
Source: Already programmed some system apps
--- UPDATE
Of course the play store may have some door that you can use to install any application but that probably requires a permissions that you can't get on your own
If you know where you have the apk file, you can easily.
File file = new File(dir, "YourApp.apk");
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
startActivity(intent);
I have finished my android app work and the apk is signed.I have to give the app to someone for whom I have made the app .If I am sending it as email attached will it be installed or not.I searched in the net but it gave me confusing answers.Is there any other better way to send the app.Please help me
No it won't. The user has to activate installing apps from unknown sources in the settings and that he/she can install the attached app.
Better sign up on the Google Play Console publish you app in the alpha or beta stage and add the user as a tester. Than the user just has to become a tester and he/she can download the app from the play store
If you plan to release multiple versions to your client regurlarly, you can try releasing it via GooglePlay alpha or beta release.
Advantage: You can track your app version and crash reports, etc.
Yes
First of all goto mobile Settings / Application / Settings and check the box next to Unknown sources option. then click on apk downloaded from email and install.
I guess any mail service firstly will not let you attach .apk file to any mail.
Better store it on cloud service and access it from any where. also do not forget to set allow files from unknown sources in your android phone to true.
I have a question on the apk distribution. We all know that we can distribute apks through bluetooth, emails etc.
Now, when I download any apk from the google play, the app gets installed and that we cannot share it by using the licensing policies.
I have my apk on a website. I want the same thing. I want fresh installs from the website also. The app should not shared with any1.
Is there any way to this? Any suggestions on how to do this?
As I said in comment, You can not stop users to forward your apk if they have them in storage, what you can do is to delete it after your app installed, but it can be shared before installing.
and there are tools/apps exist in market which claim to convert installed app into apk, and then it can be forwarded to other device.
Similar question on Forward locking of apk
Edit :- though you can not stop user to forwarding of your apk, But can stop other user to use it, if they receive this app from other sources then your web, as I myself did it earlier, by client server communication where a key is getting generated on Server based on mobile IMEI, so this app is going to be activated for particular mobile based on IMEI number. hence if other users try to use it you can check if this IMEI is register or not, and take action accordingly.
When you install an app from Google Market, you have an install button, which downloads and automatically starts the installation program for the apk you just downloaded. It doesn't install it automatically, only it automatically launches the installer for the apk you just downloaded.
Is it possible to have a similar button if you have a apk file on your local server? How will the link look like?
I've read a lot of almost similar questions here (like this one
How to install APK automatically when the file download is complete (hosted on private) or how to automatically install an apk), but none of the answers explained if Google uses something special for its market or is it possible to use a special kind of a link to force the installation program from the phone to automatically launch after download? Automatically LAUNCH, not automatically INSTALL the apk.
That is, when users scans my QR code with a QR code reader or types directly the URL in the browser, how can my application trigger the installer program right after download?
Let's say I do the following:
1. I generate a private key on my computer
2. I sign my app with my private key
3. I submit my app to Google market
4. I upload my app to my site.
When someone will download my app from Google Market, the following will happen:
a) That person will access the Google Market URL of my app
b) He will download it to his phone
c) The application installer from the phone will start automatically, and ask him if he agrees with the permission required by the app.
When someone will download my app from my site, the following will happen:
a) That person will access the Google Market URL of my app
b) He will download it to his phone
c) The application installer from the phone will NOT start automatically.
I don't want the app to install without any intervention from the user, just for the install process to start automatically after download.
My question is how to make c) to happen even if he downloads the same app, signed with the same signature, but from my site?
The simple answer is: You can't (at least if I'm remembering correctly).
AOSP contains a set of Google's public keys that they sign their applications with. And in order to be able to install an application without any intervention from the user, the apk must be signed with the matching private key. So, in order to do this, you will have to do one of two things:
Get google's private key and sign your apk with it.
Get everyone to upgrade their phone to have your public keys along side google's.
Neither of these are really possible. So basically, you can't. Unless your targeting the root/rom community. Then you might be able to convince them to do #2 (add you to the list of keys that can install apps without intervention).