Android Marketplace: Changing application's package - android

Any android developers had any success changing the package name of your application (in the manifest) of an application already being distributed in the Market?
During my upgrade progress, I decided to change the package name slightly, which means that android identifies it as a new application. So, I suppose saved preferences will be lost, but I'm really hoping there are no other "surprises" for upgrading users.
Cheers!

It's not that the saved preferences will be lost, it's just that Android will set it as a completely new and seperate program which cannot access the old application's preferences.
However, if you sign your applications with the same signature and and give them the same userId then they can share information and you could migrate the original application's information to the new one.

Related

Package name changing and keeping existing reviews and downloads

Hi i have a company app with few thousand downloads done by a developer who is not working with me anymore. I didn't knew much about these android package name stuff and he has used his name in my app package name with app name.
eg.. com.micheal.myapp
Now he is not giving me source code too.
So is there anyway to upload a new package like com.myapp.appname and keep all those downloads and reviews?
Unfortunately there is no way until you don't get previous application source code and application key store.
if you upload a new package then it'll be considered as a new application.

Clear Application's Data Programatically from another Android Application

I have an android application HELLOWORLD
I am trying to create another android application HELLOWORLDCLEANER which can clear my HELLOWORLD application's data in one click
Application's data is like databases, shared preference files, and other files created within the application
I can clear data in the mobile through Settings->Applications-> ManageApplications-> My_application->Clear Data
But I don't want go every time to Settings page and clear the HELLOWWORLD app data. Does android provide such facility to do if I know the package name of HELLOWORLD application?
I have gone through solutions provided in Stackoverflow but it tells how to clear app data of itself not about other apps..
Each Android application lives in its own security sandbox.
By default, the system assigns each application a unique Linux user ID
(the ID is used only by the system and is unknown to the application).
The system sets permissions for all the files in an application so
that only the user ID assigned to that application can access them.
Which means you can't access another app's resources.
The only way you could achieve that would be by executing su commands, but that would require root access.
you don't need to be root to do that as long as you sign the 2 apps with the same key.
Then you can just tell one app to clear its own data from another app.

Completely uninstall and reinstall Android app on update?

I want to publish a new version of my app. But I want it to reinstall again.
Like first uninstall and then install(like first time installation). Is there anyway that I can do it? Or force users to first uninstall the app?
If you sign the new apk with a different key, users will hit an error when they try to upgrade an existing installation. That’s probably the easiest way to do it without changing the package name.
As Jens said you can't do this really unless you reinstall with a different package name (not a good idea either.) You have to detect your version and manually reset your preferences etc. if you need to. This is a pretty annoying feature of android. I've been developing a mapping application that has the exact same problem with storing some of the background data.
You can usually check where your preferences get created for the first time. A lot of people do a if(preference !=null) to set them up, since in a pre-installed app you already have that preference in the bundle it will not update or generate a new one.
Try setting the preference checker to be if(preference != newValueOfPreference)
If that's not how your bundle data is generated on install you'll have to find out how it is generated and get at that hook.

How do I change my Application name

I would like to make a slight change to my application's name. I read that it can work if both applications are signed with the same signature and is given the same userId then they can share information and I can migrate the original application's information to the new one. It is very important that the user gets the notification to upgrade. Will the user receive the update to upgrade if its done this way?
Your users will still get the upgrade, as long as you don't change the top level java package name.
Do you mean the actual name (human readable) or the application package? You can change the name, description, etc. at any time (though it might be confusing for existing users). On the other hand, you cannot change the package name, you need to publish a new app. Unless the current app already has the sharedUserId, set you cannot really use that option: setting it will change the UID and the application won't be able to see its own files. Two solutions to this:
export the data in some shared format (XML, CSV, JSON, etc.)
write a content provider and use a signature permission to make sure only your apps can read from it.

Are shared preferences in Android apps deleted when a user updates the app?

If I store some user settings and information in shared preferences in my android apps, and then I update the app in the Market, will those settings be erased when the app updates?
No, the Shared Preferences will remain.
To make the answer simple: NO in normal circumstances.
The update process only replaces the apk file(and so what is in it for
example drawables,...) and does not alter databases,sharedpreferences
and any other files that generated in run time(probably in this
case,new App is installed with the UID that is equal to UID of
previous App).
But following this thread it seems that there are cases when data could be lost. Like changing Copy PROTECTION FROM ON to OFF OR OFF to ON.
Quoting the answer:
It turns out when we posted the update copy protection was turned off,
but for our initial release it was turned on. Which caused all our
shared preferences to get lost, we could no longer create private data
files, and the game started randomly crashing.

Categories

Resources