I have an Android and iOS app that can be whitelabeled to several different clients,
This could grow, so I don't want to manage 4 different projects and keep it as singular a codebase as much as possible.
One issue i have, is each client has a different third party provider for Feature X (say, working with a smart-light system).
I am looking into feature toggles, so that I can have a config file that specifies which services should be passed around and what features are activated for each client - but the problem is some of these third party binaries cause things to "happen" even if I don't instantiate a class using them specifically, like registering certain things in the background or requiring permissions from the user etc just because I have the binary included.
Is there a way to programatically ignore binaries for certain deployments of my app?
I am trying to copy the Android 'flavors' system, and I haven't found a solution there either but for now iOS is the priority.
Interested if there's a solution for either system or how others have approached this situation.
Using flavors
Gradle allows you to include dependencies only for certain flavors. You can just write the flavor name in front of your import statement (usually it's implementation and api).
For example, if you have the flavor demo, you can include a certain dependency by importing it with demoImplementation:
android {
...
flavorDimensions "version"
productFlavors {
demo {
dimension "version"
}
full {
dimension "version"
}
}
}
dependencies {
// This will only be included when you build the "demo" flavor
demoImplementation 'com.squareup.retrofit2:retrofit:2.9.0'
}
Using dynamic feature module
Dynamic feature modules are modules which can be downloaded dynamically after an application has been installed or at install time.
For example, if some feature requires NFC, you can extract this code to a dynamic feature module and let android install it only on devices, which have NFC. Devices without NFC won't even download it.
Or you download and install a feature which is not used by most users only after a user presses a button in the app.
An example for this can be found in the On Demand Modules codelab.
Related
I know a single app bundle is enough to support different kinds of configurations, but one of our module is in react native and recently we've upgraded the Gradle version to 7.0.0. due to which our build machine won't let us use the minimum SDK below 21. This is why I wanted to create separate .aab files(one created on the build machine the other one from android studio) with different API levels(one will support android 19+ and the other one will support android 21+) and I wanted to upload these bundles without changing package name or application id. Any suggestions around this? or is there any better way to do this?
Note:- Two separate .aab are a must. I already have looked into this solution but it is not helpful to me.
Actually, my app features are split into android library and I choose the feature I want include at the compile time. Is it possible to have a default app with very basic features, and an on-demand installable feature shipped as APK ?
I thought I could use module feature which was made for instant app because they are like android library but can generated APK but when I tried it out, the package name was different so it was impossible to use it.
I know it's the proper way to use android feature but can I use my own tricky way ? Otherwise, is there other possibilities to achieve this ?
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.
Google Play Developer Program Policies says:
An app downloaded from Google Play may not modify, replace or update
its own APK binary code using any method other than Google Play's
update mechanism.
I want to publish my application to Google Play. And I been planing to load my core SWF file dynamically, so game updates could be done without the need of going to Google Play market. An alternative Java implementation can achieve the same thing by downloading remote jar file.
In both cases I will have the next limitations:
I cannot modify my Manifest file.
I cannot extend the application permissions that I asked
My external code is bounded to application sand box(Just as the rest of my application)
Notice that my external code is not part of the APK files. It will be stored in application folder or in external storage(SD-Card). Its same place where external assets is stored.
Does this violatating Google policy? I am not sure what they meant by "APK binary code".
I am not a lawyer, and I don't play one on TV...
Your best course of action is to look at the reason they included that phrase in the first place. That text now exists in the Google Play policy because Facebook did the very same thing that you are describing in their application (providing an auto-update mechanism outside the Play Store) earlier this year, and Google threatened banning the application until this "feature" was removed (which it was, shortly thereafter).
The spirit of the law in this case is that Google does not want applications updating themselves without the user's consent outside of the Play Store...period. If your application does this, you can bet Google won't care how you are doing it and will likely remove the application when and if the feature is discovered. They won't care how closely executable code in an external SWF file resembles the internal classes of the APK.
Legal language like this is is intentionally vague so companies can apply it in any situation they see fit. Don't think you're being safe by splitting hairs with the terminology.
I am not a lawyer. I see this restriction as limiting only the apk binaries. There are many apps that have dynamic behavior changes, for example Google search where the search results algorithm is determined by dynamic code on the server, or facebook which loads new images texts, layouts and more.
I think that as long as you do not do anything bad for users using the swf changes, you should be ok.
The purpose of this clause, as I understand it, is to prevent apps from loading and using code that was not tested by Google using the normal process that tests apps when published. Google want to ensure that all code is scanned/tested by their bots.
I'm working on a server backend component for an app, and one goal is to log all the messages transmitted through the app (using MQTT). To do this, I wanted to use the app as a library of sorts so that I could use the objects defined within to parse the messages coming through, since none of the messages will be transmitted as standard types. I'm using IntelliJ for the Java development, and Android Studio for the Android development. Is this possible? I was previously able to import the code as a module, which let me use the types defined within, but when I went to build the project it tried to build the Android code as well and failed because IntelliJ hadn't set up Android dependencies. Should I try and set the Android SDK as a dependency in the app module, and then build? Or am I approaching this the wrong way? (if it's even possible) I understand that there are also Library projects which looks like a possible solution, it would just require re-factoring all the applicable code out to a different project and I was hoping that wouldn't be necessary.
Trying to import the entire Android app as a library into a different codebase probably isn't going to work; you don't want a non-Android app to have all that Android code linked in, and with resources and the whole environment it will be tough to get it to compile at all.
A better approach would be to take all of the code that needs to work cross-platform and distill it into a plain Java library that you can include in multiple contexts. On the Android side you could include it as a plain Java library project, or compile it to a jar and include the jar.