Clean architecture when developing SDKs - android

I'm developing an SDK with Kotlin (I intend to use the multiplatform function). This product will be integrated into the application through a dependency (like any current library).
The point is that I can't find information that explains how to structure this kind of projects. I would like to know if there are architectures similar to clean architecture for applications, but focused on these other needs.
The SDK contains a view (that the user can instantiate externally), internal logic and calls to a server. Does anyone who has faced this problem have any information?

Related

Kotlin multiplatform for developing Mobile SDK?

I am building a mobile and web SDK to consume our platform API (s). We are a very small team and do not want to depend on multiple mobile and web platforms.
I was reading about kotlin multiplatform and using the official guidance, we can achieve interoperability (IMO) in terms of writing a single code base and a plug-in as a library to multiple platforms such as JS, Native Android, IOS, and non-native platforms such as react-native and Flutter.
What would be the good approach and links to develop such a library incase it's possible? Any thoughts on it?
Thanks
We do this with multiple clients. Doing this is becoming easier with better tooling, and on native, the new non-strict memory model. Of course, the tech is relatively new, so the more difficult part will be packaging and distribution, but that's the kind of config work you'd likely need to do anyway regardless of implementation.
I don't have a great single link for you. Just several from people on the Touchlab team, with one notable exception.
https://twitter.com/shaktiman_droid/status/1546592640879165440
https://twitter.com/KevinSchildhorn/status/1519024016203333633
https://dev.to/touchlab/add-kotlinjs-support-to-your-kmm-library-48d9
https://dev.to/touchlab/dividing-kotlin-multiplatform-work-in-teams-2cad
mParticle actually generates a shared SDK with KMP, from an analytics data file. https://docs.mparticle.com/developers/smartype/. I haven't played with it in over a year, but they do seem to be updating it: https://github.com/mParticle/smartype.
Also, we had a few Kotlin/JS talks at Droidcon NYC this year. Those videos aren't public yet, but check them out when they are.
We (Touchlab) are about to release something that enables this much more easily for native mobile targets. JS, while we use it, is much less common of a request and hasn't yet been prioritized.
Finally, join the official Kotlin slack. There's plenty of support, and the Kotlin team often replies directly to help.
Good luck!

Update application with libraries based only on x86 architecture

Recently when trying to update my application I came across the message that I cannot do it unless native code libraries have x64 architecture. The app has a library that hasn't been updated in years, and despite it's working perfectly on all devices, I can't update it on Google Play unless I change the library, which would result in practically another development from the beginning because it is the core of the app.
This is a complete disregard for the developer who spent hours and hours developing his Android application.
Is there any way to get around this situation and update my app? Thanks in advance.
Does the library have 64 bit binaries, or is it open source? If so, you just need to grab the new binaries or compile from source. If not, then you just learned an important lesson- never rely on a 3rd party library that you can't control as a core component of your app. This is a lesson every developer learns eventually, managing dependencies is an important part of software engineering.

APK based vs. service based plugins

I am looking now into re-architecting a library based Android App, so that instead of providing each library's functionality at build time (limiting its expansion to me only), I would just provide a base App and an SDK that would allow any developer to independently write a plugin.
I couldn't find many ways of accomplishing this on Android (unlike .NET's Unity dependency injection framework which supports independent DLLs). What I found was:
APK based approach:
http://blog.raffaeu.com/archive/2015/05/31/android-plugin-application.aspx
Service based approach:
http://androidsrc.net/creating-android-app-plugin-architecture-tutorial/
My question is: Are there additional ways of accomplishing this? (note: ways that are legal from Google Play's ToS)
Also, in your opinion, which of the two approaches that I listed above is superior?
Generally, if an app will accept some sort of plugins from other developers, those plugins are distributed in the form of APK files, whether through the Play Store or through some other channel. Those plugins may need different permissions than yours, for example, and that can only be accomplished if they are first-class citizens on the Android device.
Hence, a plugin is merely some other app that interacts with yours through some documented and supported IPC mechanism. The big four Android components — activities, services, receivers, and providers — are all possibly relevant for a plugin. It really depends on what you want the plugin to do and what the plugin needs from your app to be able to do it. In the abstract, we cannot tell you which of those to use.
Personally, if I were going to do this sort of thing, I would write the base app plus at least three plugins. The act of "eating your own dog food" when writing those plugins will help guide you towards what IPC mechanisms are needed. Even if, in the end, you ship the plugins' functionality directly baked into the main app, having "real" plugins will help shape your SDK, your security model, etc.

Combining React-Native for Android with existing android codebase?

I have a huge android codebase for an app : It's basically a SDK where all the business logic is implemented.
I have a basic native UI. I want a way to quickly iterate on the UI : that's why I thought about React-Native for Android.
Do you think the interop will be easy or is it difficult to integrate it with an existing codebase ? anybody has had an experience with that ?
The only way react-native UI can interact your SDK code is if you expose your SDK's API by building a NativeModule (https://facebook.github.io/react-native/docs/native-modules-android.html#content). Building NativeModules can be from anything very simple to large depending on your SDK.

Tips to shift from App Inventor to Eclipse

I am very good with AppInventor to build Android apps. I have good knowledge of C++ and little knowledge of Java and GUI building in Java. Suggest me how should I shift from App Inventor to Eclipse to build Android apps? Which path should I follow? Is building in Eclipse similar to building in AppInventor like defining different components and then handling their events? Or is it much more than that? Please guide me.
There is also the AppInventor to Java Bridge project at java.appinventor.org, details see below
About:
The AppInventor to Java Bridge project is an addition to
AppInventor that creates a Java written version of the application
from an existing application created through AppInventor. After
creating an application through AppInventor,the user can download a
version of the application that is written in Java, which uses the
JavaBridge* library .
What Our Application Can Do:
Create an Android project in JavaBridge using AppInventor
Applications that use texting, internet and/or sound are supported
Limitations:
- Location aware applications not yet supported
- Nested lists are not yet supported, and will produce incorrect code
UPDATE: the newest version of that tool can be found here: java.appinventor.org
Definitely you should check out the "ALTERNATE Java Bridge". The regular one, built originally by the app inventor team has long since been abandoned. Another programmer picked up the torch and has steadily been using, and improving the bridge for some time. I have been using it myself for 2 years and it is fantastic.
The google project is at: https://code.google.com/p/alternate-java-bridge-library/
and the google discussion group is at : http://groups.google.com/group/alternate-java-bridge-library-discussion
I would just go to the google project site above and ready the tutorial. It is very easy to get started, and he is really good about answering questions for newbies (and i can assist with that as well).
You could take a look at the App Inventor Java Bridge. Check out the link for lots of information, also see here...
The Google App Inventor Java Bridge The App Inventor Java Bridge helps
make a transition from developing Android applications with App
Inventor for Android, to developing with Java and the Android SDK. It
lets you incorporate App Inventor components into apps that you create
in Java with the standard Android SDK tools. If you’ve been using App
Inventor and know some Java, then the Java Bridge is a good way to get
started with the SDK, because building with App Inventor components
hides many of the complexities of the Android framework. As you gain
experience, you can switch over to regular SDK development and create
apps that harness the full power of Android.
Here another link:
http://code.google.com/p/apptomarket/ and you also find videos about the Java Bridge on Youtube, for example this one

Categories

Resources