How to update apk through code - android

My application is already installed in the devise and i will get notification that you want to update, at one click i want my application get updated programmatically. Is there anyway to do...

Third party developers are not able to install .apk files directly without user intervention.
But you can send request to PackageManager to handle installation of new .apk file. This will show "install the app" dialog to user, and if she accepts the installation, your update will go through.
An example of the described scenario: Android: install .apk programmatically

The only way i'm seeing of doing that, and its NOT a good policy it to have the initial code swapping a specific directory for classes, and if it founds one, load it by reflection on the fly and "replacing" the classe contained in the APK
I don't think this will have a good performance... and should not i repeat NOT be a policy for update.

Related

Update app without Play Store

I have one service where I can put new apk file.For example, (https://myweb.com/newversion.apk).My project is not in play store and I would to update my app remote,without play store.
I search about this in google,found some examples and articles,but I don't know witch is a best practice to solve my problem
In your option,how I can solve my problem most optimal way?
Thanks
To implement auto update you can manage with your server with version details but for that you have to checked with application as well.
But there are another option from where you can manage auto-update.
You can use custom class provide by below URL.
http://www.auto-update-apk.com/
One of the most optimal ways is to store APP version somewhere in web (for example in JSON file) with your APK file. And when running your app check if app version is not lower than stored in web JSON. If current app version is lower than stored in web - download new APK in background and and prompt user with notification and dialog about successful download and offer him to launch installation. For more details check this and this threads.

Reconfigure android application without overwritten

I 'm starting to build an Android app that can self-restructuring. It means this app can change its behavior after an "update". But it's not similar to common update because I don't want to publish to market and some reasons below. The idea is the app check version through server, if it's old, then download a file to proceed update.
This is not an overwritten installation, only some parts of the app is changed, not all.
The app have to keep working during updating.
The download and update process must be silent, there must be no notification, pop-up or asking permission (option)
Please tell me if it 's possible and give me advice, approach, keywords, ideas or somethings helpful. Do I have to intervene system, OS or anything?. I tend to make the phone as a sensor device
There is no direct way of achieving this.
You need to download whole new apk. You can't just download few part of it.
but what you can do is download app in background without user interaction.
Now to install this user has to allow installation as per security standards.
PS: If you just want to perform different action. You can download stuff n place in external/internal storage and through api call changes perform desire actions.
There are apps that doesn't use play store for updation eg. Dream11, famous cricket app.
fantasycricket.dream11.com/android-desktop.html?utm_Source

Hosting APK + Updates?

I have an app written in Adobe Air (actionscript3) then packaged as an APK for the moto xoom (android os, using flashdevlop).
We are looking to host both the install and update. There are no issues with selecting unknown sources. And installing from web works but i cant seem to find anyway to set it up to find updates thru my server or the correct way to push those updates. Thoughts or links, google has failed me?
UPDATE
I forgot to make clear i need it to work thru the built in update checking so it will auto update if the device is set to do this. By default either the app or device is checking for updates somewhere. I want to change where it checks for that update and what format/syntax its expecting.
The built-in update check is the Android Market app, pinging the Android Market server to check for updates. Since you're not distributing your app through Market, there's no way for you to take advantage of its update mechanism- You'll have to write your own (Amazon's market app, by way of example, does this).
Essentially you'll have to set up some sort of alert mechanism (check for updates on app startup, maybe), download the APK, and fire an intent to have the user explicitly state they want to install the app. Auto updating (downloading and installing the APK without the user doing anything at all) isn't possible outside of Android Market, for security reasons.
For more information on how to fire the "install" activity, check out this thread.
It sounds like a good case for cloud to device messaging....to notify the user of the update
is available...
http://code.google.com/android/c2dm/
I think they will still have to download/install it.....You can help them by making the download/install feature of the app it self.....
okey... i think you have a few web services right... create a update webservice that takes in the user version and sends it to you.. you can cross reference it and if the user needs to download a new version they get directed to a browser ... where you can poit to where you host the files... you can put in a menu item in the app to say allow the user to check for any upgrades... version number of the app can be got easily... check google or get back to me if you still are nunable to find any...

Install apk file via code forcibly

I have a scenario where I have to install an apk file through code and I dont want the user to have option either install or cancel it. For ex, I want to create an app similar to the android market. In that app, I will display list of my applications and display an install button for each app. When the user clicks the install button, the app should be installed directly without asking the user to install or not. I found a link which have a method installPackage in PackageManager. I am getting compilation error when I use it. It seems that it is remove from the android framework.
Is there nay possibility to do this ?
thanks,
Senthil

Is is possible to pass a custom argument to android market so my app receives it on first launch?

Is there a way to pass a custom argument to android market (or any other way) so my app receives the argument after it gets installed (and run for the first time).
Let me explain.
Start an intent with argument1="Hello world1" (custom argument
every
time)
Install the app from android market.
Open the app for the first time.
App shows the msg "Hello world1"
Any case will do, not just intent to android market.
Most of the time the app will be installed via Barcode scanner with a binded http schema. So a browser workaround is possible too, HTML5 Client Side Storage, (store argument to browser and get it from there the first time my app runs)
Update
A solution would be to create a cookie,or something to the browser and then access it from the application i installed. Is that possible? If so can you provide some information about that? Can browsers share data with applications?
You can publish a link like that
http://market.android.com/details?id=your.package.name&referrer=your_referrer_parameter
After user clicks this link and installs the application your broadcast receiver will receive a broadcast com.android.vending.INSTALL_REFERRER with "your_referrer_parameter" value.
More info:
http://code.google.com/mobile/analytics/docs/android/#android-market-tracking
Get referrer after installing app from Android Market
Get Android Google Analytics referrer tag
AFAIK what you're asking is not possible. The market only delivers the APK files to devices. However depending on what exactly you want to do there are probably many different work arounds.
Here are a couple thoughts:
If you want the market to deliver a custom argument that is unique for every user, then why not have your app connect to a server on the initial run and download that argument? Even if the market could provide the argument it would have to get it from you and you would presumably have to setup a server to provide the market with the argument.
If you simply want the app to know wether or not it is running for the first time you can do that using a SharedPreference. Query if a preference like hasAppRunBefore exists and if it doesn't then you know the app is running for the first time since install. Then set the hasAppRunBefore variable to some value indicating that it has run before. This implementation will allow users to uninstall the app and reinstall it and after each reinstall the app will run for the first time again.
Another option is a combination of the first two. You can have the app connect to your server and provide the server with the device's UUID then the server can check if its seen that UUID before. If it hasn't it provides the argument otherwise it doesn't.
If you truly need each APK to be different for each device you can setup a server that when a download request is received it compiles a new APK and provides a link to download that APK. That will allow you to generate a new and unique APK for each download. This will however require you to distribute the APK yourself as the Android Market doesn't currently provide this functionality.
I would go ahead and have the website that redirects to the market also push a file to the client. the file can be named something like "yourapp.info" and contain the data you need. Once your app starts, it can search the SD card (it should reside in a couple of well known directories, aka /sdcard/Downloads ) and read that file. There are no access restrictions on the sdcard.
Regarding a Cookie in the browser: I'm not sure that you could access the cookie from just any other app - (check this: blog.watchfire.com/files/advisory-android-browser.pdf - it's not possible to access the cookies) so I think that route will be closed.

Categories

Resources