Maintain pro and free version in Android - java

I have noticed there is a lot of apps in the market with 2 versions. One free and one paid with extended options and adfree typically.
Im considering make something similar with a project but, whats the best technique for maintain both versions? I suppouse using 2 android projects in eclipse and manually change them is expensive and error-prone
Thanks in advance

Make one version of the app, and use properties that you read from some bundled resource file to determine whether it's the free version or the paid version. For instance, when building the paid version, you just set something like:
com.myapp.version=paid
...and for the free app maybe something like:
com.myapp.version=free
And then as part of your initialization code you could fetch this property from the file/resource, and set it as a system property. And then the rest of you code can just do:
if ("paid".equals(System.getProperty("com.myapp.version"))) {
//allow access to paid functionality
}
else {
//nag the user to get the paid version
}
So instead of two separate projects, you have a single project and a single codebase that you use to build two different artifacts.

You can have a constant value hardcoded in your app, such as boolean isPro. if (this.isPro), you can allow other features or not show adds. Then, when you are ready to upload your apps to the android Market, just create two - one with isPro assigned to false, the other to true.

Related

Android App in-place update

I have an application which is deployed to some pretty remote, data connection starved regions of the world, specifically to health workers.
These people have minimal data connections and the app requires regular updates to provide increased functionality and critical bugfixes.
The problem we have is that the APK for the app is 5.7mb and only going to get larger. Which means that every time the users need to update the app, they have to download the 5.7 meg apk to update. If we roll out more than one release in a week, it can eat through a significant portion of their data plan as well as time as they have to sit and wait for it to download and install.
Is there a better way to do this? Some way to patch the versus completely replacing the application on the host device so that we deploy smaller patches?
I've tried looking for examples of "host" applications, where the actual application is just a shell for a downloadable set of libraries, sort of like a plugin system, but couldn't find any examples.
Are there any resources or a standardised way to accomplish this?
Also worth noting this is a react-native app and we're already running proguard and splitting apks based on architecture to reduce the apk size.
Did you have chance to examine CodePush? It basically allows you to push updates only for javascript part (the bundle) of your app, on-the-fly, without making your users download a new version of the apk.
If you add new native code to your project, you will still need to build and release a new apk though.
How it works is that, when you update the javascript code in your app, you push a new release. When users run the application, CodePush checks if there is a new version available and if there is, update it immediately and restart the app if you mark the mentioned release as mandatory or use the newly downloaded bundle version on next run.
Edit: react-native library of CodePush is here on github.

Getting user behavior on the Android Phone (App History, Browse History etc)

Is it possible to get the user behavior on the phone (for example Alpesh has an Android phone and he uses multiple apps, browser YouTube etc). Whatever he is doing on the phone I want to get all those things from behind (which apps he has installed, which app he opens and what he search on the phone, All these data I want to get programmatically so what all can be get in android).
For now I am aware that installed apps list can be get easily but I want to get usage history and what he do all on mobile.
This is not a code solution, but an answer to your question, so you can get start some where.
In my opinion your question title are asking about two things.
(part 1) Getting User Behavior on the Android Phone (part 2)(App History, Browse
History etc)
1- First part Getting User Behavior on the Android Phone:
There is a concept called context awareness. Short described; it is about gathering different information from the phone, like light sensor, motion sensor, sound, location or even user behavior etc. and depending on your app requirement and the gathered information:
You could send these information over cloud data store for statically usage
You could make your phone doing (behavior) different things depending on location, motion or what ever.
etc.
For context awareness it is an open area for pervasive computing research. And it is not just few lines of code to write, it is typically a complete solution depending on requirement. Example I have built a context awareness application to gather noise collected by phones from different locations for research purpose inspired from this framework, but I am pretty sure you can find other frameworks or even build your own, as I did in my case.
The mentioned framework has some examples.
2- The second part is about App History, Browse History etc.:
This is possible, but you still need to build a peace of software (App) to collect all these information (logs) from the phone. Hereafter you can make phone act on different conditions and/or again send it over a RESTful API over cloud service data store, there is no limit for it.
The problem is, there is no thing out of the box for your requirement. Even if you find frameworks you still need to research it and further work on it.
You can find different examples for your requirement, like to collect browser history, you can find SO question here:
Get browser history and search result in android
Or get list of installed application:
How to get a list of installed android applications and pick one to run
My point here is you need to solve small goals at a time and put your knowledge together at the end.
Both 1 and 2 can also be related to each other, depending on your achievement.
Conclusion
Make a goal to your project.
Define the main requirements and tasks of your project.
Research your options (Technology, Cost, Target Audience, What data I can or I should not collect, what is possible to collect, what is the limits, Privacy issues etc.).
Split your project in small assets and try to solve small problems/goals.
Finally you would be able to put the puzzles together and build your final application
but i want to get usage history and what he do all on mobile
This is not possible and shouldn't ever be possible. Each app is sandboxed by Android so apps cannot inspect what other apps are doing. Think about it, you wouldn't want apps to be able to intercept private information such as banking details.
Every app is isolated from the other ones. Unless you develop a system signed app, you will not be able to gather all that data.
What you could do is to develop your own Android Rom where you then develop your data collection the exact way you want. Then you need to distribute your rom, which is another story...

Programmatically creating cordova/ionic apps

I have a development environment where web apps can be hosted. We generally use angular for our web apps so ionic should already be a pretty close match.
What I'm looking for is a way to be able to take a web application in angular and basically "generate" the ionic app out of it. We can assume that the app has been "modified" to correctly import the ionic module(s) and the necessary code.
Other than that, the site must remain functional on a desktop client (but I assume this is not an issue) and we want to "generate" the apk (or whatever target environment is required) based on the original web app.
Ideally the generation should be triggered by basically right clicking in a menu and selecting "Generate APK". This means I'm looking for programmatic access to whatever API cordova/ionic has.
My google-fu is letting me down though because all I can find though is command line references, I would prefer to stay away from commandline-level integration unless absolutely required. Other than that any search for API just brings up the javascript API they expose, not any API they might expose to programmatically generate artifacts like an APK.
UPDATE: I don't mind a downvote (the question is rather hard to phrase correctly) but at least state why so I can improve upon it.
Building a native APK in command line should be possible using the Android Gradle toolchain. You can go thru the process in the IDE and then just replace the files for your created app with the newly generated files and invoke gradle. For other OS's this becomes harder e.g. for iOS using xcodebuild is pretty hairy and if you add into it complexities like hosting Macs in the cloud (required for xcode) and the changes Apple makes all the time...
We implemented pretty much that (and a lot more) for Java at Codename One, we also support including Cordova plugins which might work for you. We also provide white label services for 3rd parties.

Upgrade multiple apps to one app

I currently have a few apps in the Play Store about different ships. Is there a way to upgrade all these apps to one consolidated app?
It is not quite possible to do what you want since all your apps use a different package name. As Henry suggested, you can update all your apps and tell the user to install the new app.
The other (not so recommended) option would be to create your consolidated app and generate a different apk for each app you already have on the Store, modifying only the package name. All the users will be able to have the consolidated app without the need to install a new app. However, it is a bad approach since you will have many copies of the same app in the store, which may lead you into troubles (not so easy to maintain and probably problems with Google).

Android - Setting usage flag

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.

Categories

Resources