I want to have two versions of my program, but how would I have the basic activities be either disabled or not respond to intents, so the more advanced one can do it?
Basically, I want the user to download the basic one, then, if they get the advanced version then it will use the new activities.
UPDATE:
After writing a long comment to one answer I thought I would put it here, perhaps more clearly.
Ideally it would be nice to have more Activities that other programs could use, so, for example, if there was a program that usees the Twitter API that was being used to allow games to be played, then, there could be a version of the application that allows some advanced functionality, so, by upgrading the application all the games using it would also get the new options, so work better.
It may be as simple as having three versions of the program.
Basic version.
Plus version to upgrade from basic
version.
Initial install of the plus version.
I would still have a problem with (2), and I can't just have it upgrade the jar file since most of the code between version (1) and (3) would be the same, but the Activity that may change could look to see if there is a better version, and either do nothing, or pass the Intent on to the new Activity. If it did nothing, then it would assume the plus version would also pick up on the Intent and handle it.
This may be a stretch but... could your basic app, upon receiving an intent, check to see if there is an instance of the advanced app installed via getInstalledApplications() from the PackageManager and if it is installed, send a custom intent to launch the advanced app?
Related
I'm trying to install Kik Messenger twice. I have two accounts and don't like to log out because I lose all of my conversation history. I'm currently using Titanium backup's profile feature, which is a very nice fix, but it's still a pain having to switch back and forth between profiles. I might be looking for "perfect" when perfect doesn't exist. I am completely new to modding apks and Android in general, all of my work on this so far has been "trial and error". Anyways, here's what I have:
I have the Google Play version of Kik installed on my phone. I have extracted that app and modified the package name successfully using apktool. However, when I try to install, I get an error saying something about duplicate provider authority. So I did some research and learned that I'm supposed to edit this part of the AndroidManifest. So I have played around with that a little bit and after I change the authorities, I am able to install the modded app. However, it crashes immediately.
Does anyone know how to fix this problem with the provider/authorities?
The issue you're hitting is that the app has registered certain classes to handle particular events. These need to be unique across all installed apps and point to existing classes in the app that will perform some activity with the supplied information.
You bypassed the safety check when installing by changing the defined handlers in the Manifest but that didn't really fix it as they still need to actually point to a valid, working class that can handle the requests/events.
You would need to decompile, rename the classes involved and all references made to them and recompile the whole app to really fix the problem. However, I'd assume that it would likely be against the license. If the code is open source then it wouldn't be too big a task to rename some classes & packages then build the app. If it's closed source then it is a harder task.
What you can do is either set up your device to use multiple accounts (the OS not the app) as each user has a separate data storage and preference location that should allow you to have two configurations. Or you can request that the developers include some sort of multiple account handling or easy account swap feature.
This question already has answers here:
Best way to have paid and free version of an Android app [closed]
(9 answers)
Closed 9 years ago.
I am building an android application and I want to split it into two versions, Pro and Free.
The pro app will be the complete ad-free, and the free will be limited and with ads.
The base of the business logic of the two apps will be the same... So I don't think that is correct to "write the code" twice.
Handling same code in two projects can be very annoying for bug fixing and code improvements.
Is there any way to do it with one project?
Shared-preference for example is not good solution for this because many people have root access so they can change it very easily.
Firstly Hello,
As far as I've heard or seen, two versions of the same app (Free and Pro) should be two distinct projects. You could, but should NOT, use the same app and just check for a flag saved in the Prefs, but root users can override that (as you already stated).
You could also use Google's in App purchase to verify this as the other answer states. In my opinion you should not use the same project and check for a flag because it's bound to create some overhead, especially if you check using the Internet. If the user has a slow or unreliable network connection his experience will suffer.
The "clean" way to do it is to make two distinct apps like everyone else does: users can install the free app, or the pro app. This is ideal because you have two distinct options for users and if they want the pro version they don't need to get the free one and then see the option unlock in the menu. It's just way more straightforward for users.
I recommend you build the pro app first and after it is completed derive the free version by restricting functionality and including adds because it's easier to strip it down than to add-in. After you finish the pro version, just click on:
File -> New -> Project (pop up menu appears) -> select Android folder -> select "Android Project from Existing Code" -> select your App and click Finish
The drawback is that if you spot a bug you must fix it in both projects. If you want to optimize finding bugs, you could build the free version, put it on the market and fix the bugs reported by the end-users as well as the ones you spot. After you consider everything to be fine, you can create the pro version from the existing code and carry on with that.
ps: I realize I filled this whole page, but this is my first answer here and it seems I'm overenthusiastic :-)
How about using Google's in App purchase? This way the Google server manages the PRO/Trial detail. The only con is that your app needs to have internet access for validation purpose :)
I'm sorry if this solution seems a bit raw, but...
Why not have a hard-coded flag in your code... some static variable in some class saying something like:
public static final boolean isFreeVersion = true/false;
Then, in any place where you want to decide whether or not to show adds, simply reference this boolean.
You'll still need to build your app twice and publish it to the store twice (under different app signatures), once with the boolean as true, and once as false. But at least the code base will be the same. This way, if you find a bug, you can fix it, and just publish the same app twice with only switching the boolean value.
I'm pretty sure you could even find an ant script to change the value of the boolean for you during a build.
Hello I am trying to build an app which will hold "other app's"
For example MY app will hold different apps of different ClIENTS.
Now i want to make it so that 1 client has the option to only download his part, BUT he still has to use MY main app. (in other words i don't want to reference to another APK, cause then he can start his app without using mine(i think))
And the download option should be at runtime, cause else he has to download everything in one go.
I have thought about using jar files as library files, but what i found so far is that you have to add them in Eclipse (else they are not found)
I also thought about building the app with the jar files in it, and then leave them out when i compile the app. Then my client can download those files afterwards. But i am guessing that will cause reference errors?
So the questions are;
Is it possible?
How to go about?
The main idea is that i don't want to make one HUGE app where as my client will only use his part of it.
Thanks in advance
It can be achieved in android, and some big platform apps could let the 3rd party developers to develop plugins for them. The main idea is try to create your own DexClassLoader to replace the default one, the custom DexClassLoader could load classes from apkfile.
Try to look through this article for details.
Same with this question.
It seems this is a difficult topic. I can only give you some point.
Since you don't want to make a huge app, then you have to build CLIENTs as separate APKs. But if you don't define CLIENT's activity as MAIN and DEFAULT in manifest, after install CLIENT app, user could not find CLIENT app from system menu (launcher). You can define a private intent name for CLIENT app's activity, this way, only your main app could start CLIENT app's activity.
So, I have found a bug in a specific sdk that causes it to fail on some Android phones after re-installing a new version of an app which uses the sdk (via adb install -r, and presumably when a user gets an update that has been pushed to the Android market). Is there any way to force an application's data to automatically be cleared upon update of the app? I realize there are different ways that data could be stored, but I just need to essentially simulate an invocation of the "Clear Data" button that'd you find when browsing to the application in the "Manage Applications" section of the Settings (i.e. I just want all data gone).
I am an Android noob and am doing minimal Java coding on this project, so I am basically looking for the simplest solution here. I suppose I could settle on storing a "currentVersion" to disk and then checking it upon launch every time to see if the real current version matches the version that was written to disk on the last launch. Is that the only real way to do this? If so, what's the simplest way to do so?
Thanks!
Is there any way to force an application's data to automatically be cleared upon update of the app?
No, at least for my definition of "automatic".
I suppose I could settle on storing a "currentVersion" to disk and then checking it upon launch every time to see if the real current version matches the version that was written to disk on the last launch. Is that the only real way to do this?
I'd name it lastKnownVersion, but otherwise this approach seems sound and probably is your only viable option.
If so, what's the simplest way to do so?
Ummm...do exactly what you said. Use Java I/O (storing the file somewhere inside of getFilesDir()), or SharedPreferences.
Bear in mind, though, that your users may get rather frustrated if you blow away their data on an app update. Personally, I'd rather we find a better solution to your original problem ("I have found a bug in a specific sdk that causes it to fail on some Android phones after re-installing a new version of an app which uses the sdk").
My goal is to modify the Launcher application and dynamically modify and change the theme.
I saw several 'home' apps at http://www.cyrket.com/p/android/com.stain46.taghome/. It looks like they took the default Home(Launcher) and modified it. How did they do that? What do I need to modify to achieve the same thing?
I have done this with the ICS launcher. You also need to do quite a number of code changes to get it to compile as a normal app because it uses a lot of private internal APIs (despite what Google may have implied). You also need to change the package name. There are two limitations I've found:
There's a filter called TableMaskFilter that isn't available to normal apps. I think this allows the app drawer to be semi-transparent, but I removed uses of it and it looks fine I think.
More critically, it appears there is no way to replicate the widget-adding experience because it requires a permission that only system apps can have. See this question.
Anyway, I put my source here. It compiles and works on the official Galaxy S2 4.0.3, but if you try to add widgets it will crash.
Note, when you're changing the package name, there are places that Eclipse's refactor doesn't notice (e.g. XML layouts). I recommend you do a global text search/replace instead.
The standard Launcher is open source so you can definitely grab it and modify it the way you want. For your app to be used as the Home Screen you will need to specify the correct Intent filter in your AndroidManifest.xml and the user will have to choose your app when they press the Home button. Why don't you grab that code, play with it and come back when you have more questions and more of an idea of what you want to change.
Here i found one stable version Launcher2
I have sharing that GitHub repo. HERE
WIKI of this project :
This project contains the code for the Launcher app that ships with Android Jelly Bean (API 16).
Some minor changes were required from this source code to remove the use of private APIs. These changes have been marked by "// AOSP Change"