Due to this annoying Android limitation I need users to reinstall my application so the manifest permissions are detected by other applications.
This is already going to be frustrating for the user, but in addition, I cannot see a way to reinstall my application from the apk stored in /data/app and I would therefore have to download the same version to the storage card before firing the usual install intent.
I eagerly await someone telling me that I'm missing something obvious! I've drawn a blank...
Thanks in advance.
Please do star the issue if you'd like to see it resolved! Cheers.
EDIT: With the comments of #hackbod in mind, you can use the following code to initiate the install dialog.
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(this.getApplicationInfo().sourceDir)),
"application/vnd.android.package-archive");
startActivity(intent);
On my Jelly Bean device, this presents two options: Package installer and Verify and install. I don't know if the latter will deal with the issue of:
Installing your app this way will probably remove ownership of it from the Play Store
My application is free, so I cannot test the paid issue of:
Note however if your app is forward locked (which is unavoidable for all paid applications starting with JB, due to the app encryption), then this won't work because your app executable is not readable by others
Although hackbod finishes with 'readable by others' which suggests that if you are executing this through your own code, for your own application, it is readable? Please do correct me if you can test this and I'm wrong.
Conceivably you could just get the path to your .apk through Context.getApplicationInfo().sourceDir, and launch the app installer with that path. Not however if your app is forward locked (which is unavoidable for all paid applications starting with JB, due to the app encryption), then this won't work because your app executable is not readable by others. In that case you would need to copy the .apk to somewhere world readable (such as in external storage) and install it from there.
No matter what you do here, though, this has some unavoidable very negative consequences:
The only way to do any kind of install from your app is to go through the side-loading UI, which is (a) going to be a very scary experience for the user, and (b) will require that the user turn on side-loading to be able to proceed.
Installing your app this way will probably remove ownership of it from the Play Store (since it is no longer the one that has installed it). This may mean for example that the user can no longer report crashes or ANRs to you through the play store, or other negative consequences. I am not sure exactly what problems will actually happen here, but I really wouldn't assume that this is going to be okay.
Ultimately, I just would very much not suggest doing this. What permission are you needing that is forcing you to do this? For many reasons, I wouldn't recommend that third party applications declare their own permissions in most cases, because there are a lot of bad user experiences around permissions that are only known after they may have been needed.
Related
I'm having a problem with my users (Android). They delete the app, and their data is gone. They expect it not to be.
Browsing my phone, I see a lot of apps put a folder right off of /internal shared storage. I.E. I click on internal shared storage and there's a bunch of folders for various apps with data in them that doesn't go away if I uninstall the app.
This is what my customers want. This is what will stop them from writing me and accusing me of destroying their data.
How do I get a path to that folder, and what permission do I need to write there?
First off, deleting when the app is gone is how Android works. Anything else is a bug that you should expect to see fixed.
Secondly, you can't put anything right in / anymore. There was a time you could, but that's long since gone.
Third, have you looked into Android Data Backup? https://developer.android.com/guide/topics/data/backup This will work even on a new device, so its a better path forward anyway
I am installing security software/hardware into a couple different school districts. The application is at it's final stage, however I will need to send updates to users periodically. For example, a general password will be changed for the application every 6 months.
Installing an .apk is considered an "update" after the initial application is installed, correct?
I just have a feeling that there should be some easy way of doing this. I don't really want to give people an .apk. Someone could get smart and tear it apart to find the contents. That, and some others might not understand how to install files on their phone.
What are your ideas? Maybe a web link a user can go to that starts the install for them?
You have multiple misconceptions how updating, APKs and keeping keys secure work.
You have to host your APKs somewhere. Github releases is a pretty common way (but slow), but you could also use google drive, dropbox or your own server.
Your app has to fetch the server regularly and check if a new APK is available (pull-based). Second option is to use push notification in some kind e.g. FCM (push-based). Then you download the APK and let the user install it. Your app cannot start a installation by itself, it has to be done by the user.
But you can redirect the user to the installation menu with that APK, so he just has to click "Install". "Install from unknown sources" has to be enabled for that, if not the user will get an information about that from the OS with a way to enable.
There are apps like "APK extractor" which get you the APKs from google play without root, so there's nothing wrong about giving out the APK. Your APK should never contain secure keys which the user isn't allowed to see. It's easy to reverse engineer those keys, it's just a matter of time.
Does anyone know if PushLink can do silent updates? That is, download the app and install it without any interaction from the user?
The PushLink website is quite sparse on documentation regarding features available so I can't be sure.
Or does anyone know if it's possible to have a silent installer for android? I basically have android devices that will not do any user interaction and I need to be able to update my apps running on them.
Yes, it is possible since version 3.1.0 released at 2012.04.23.
Take a look at NINJA strategy
NINJA (Only for rooted devices) The application is just re-launched in
a new version. There isn't notification. BETA!
There's no official way to install anything on Android device without user interaction. Which is a good thing, because it prevents a lot of possible malware and exploits from working.
I've gotten an android service written as a stand-alone APK and I'm trying to include this in the SDK so it automatically installs the service through some publicly exposed function from the SDK.
Is there a way to achieve this?
For instance, the SDK is monitor.jar which has helper functions.
The service is GetCurrentMonitor.apk which runs a background service that returns the value of some stock currently monitoring.
Now, I want to release the SDK so that when it's included in some 3rd party app, it automagically installs the background service for GetCurrentMonitor project...
Any help is greatly appreciated.
Thank you,
Your question is very confusing. Here is my interpretation of what you are asking:
I have an Android application that has a service. I have a separate SDK (JAR or Android library project). I want users of the SDK to be able to call a function and have the APK containing the service be downloaded and installed.
This is possible, sorta.
You can have code in your JAR that either:
call startActivity() on an ACTION_VIEW Intent for the market: Uri pointing to your app on Google Play, or
downloads an APK from some server of yours to external storage, then calls startActivity() on an ACTION_VIEW Intent pointing to that downloaded APK, to kick off an install
In either case, the user will need to get involved in the installation process -- you cannot install apps silently. And, in the latter case, you will be responsible for handling your own updates over time.
This also will tend to confuse the user, as they may not realize why your app is floating around their device, so you will need to be able to handle the case where they uninstall it.
Also, it is possible that on Android 3.1+, the user will need to launch an activity of yours before your service will be usable. With luck, that is not required, though I cannot rule it out at this time.
And, of course, if I did not correctly understand your question, please consider editing the question to clarify what it is you are trying to accomplish.
I am currently creating an app and would like to create a demo version (free) and a full version.
However, I am wondering how I can set some sort of flag so that when the demo version has been used 5 times, you have to buy the full version to continue using. This usage will be detected on a submit button.
I was considering setting a flag in the app, however releasied that the user could uninstall the app and then re-install it overcoming my set flag (as this would set it back to 0).
Has anyone got any clever solutions for my little dilema?
Thanks
You might want to try one of the techniques in this answer: https://stackoverflow.com/a/996288/1205715
I think that is not possible with an local application.
File saving to sdcard with strange filename can be a way but It is not perfect.
In my opinion, Right way is using an application server that manages user run times with unique UUID.
It might also be worth thinking about an alternative approach.
In app purchases are now available, so you could have a free and a restricted section in your app, and use the in app purchase to unlock the restricted section. You see more developers going with this approach these days, rather than managing two versions of the app.
Also worth considering the fact that if you have a paid version of the app it can be pirated pretty quickly, one person just needs to get their hands on the full apk. However, if you go with the in app purchase model you will be letting google handle a lot of these issues for you.... just a thought, and the road I will be taking with my next app.