Library to SDK in Android - java

I've been searching for info about it on the internet but I haven't found anything.
The point is that I want to transform my library for android, which I'm using for advertising, into an sdk to make it available for other developers.
My library is mainly an extension of the Application class and I don't know if this should be the way an sdk is made, mainly because it seems weird to me that a .jar extends the Application class.
So, I'm asking for some advices/tips/guidelines or whatever you could tell me in order to build an sdk.

Related

Why can't I use "this" in my Android Studio plug-in for Unity?

I'm doing a plug-in on android studio for unity, I want to do text recognition to an image and send a string of the text detected to unity
I have the plugin in the unity project and can send and receive information normally, I want to use the google vision library, but the problem is the class TextRecognizer that I'm using, when it's built it asks for a "context", the guide says you have to use "this" but it seems that the whole plug-in structure doesn't go with it, I don't know what to do anymore
The problem description is: 'Builder(android.content.Context)' in 'com.google.android.gms.vision.text.TextRecognizer.Builder' cannot be applied to '(com.cwgtech.unity.MyPlugin)'
The name of the project comes from the youtube tutorial I was following to create the plug-in
I've followed the Android-Studio recommended action of making my plug-in class extend android.content.context, but it creates a lot of other functions on the top of my code that I don't understand, and all of them have this error: Must be one of: PackageManager.PERMISSION_GRANTED, PackageManager.PERMISSION_DENIED
The problem is that the Google Vision library requires an Android Context object in order to be used. Unfortunately, your Unity Android plugin doesn't provide an Android Context object. You can try creating an Android Context object within your plugin and passing it to the Google Vision library, but this may not work. Alternatively, you could look into using the Google Mobile Vision library which doesn't require an Android Context object.

How to package a closed-source AAR library with stub java files

I'm using Android Studio 2.3 to create a hardware interface library that we can distribute to partners. I would like the inner workings of the library to be closed-source, but provide documented 'stub' classes and methods that can be viewed in Android Studio.
I tried compiling my library and importing the AAR to another project, and Android Studio lets me use the classes correctly, but it doesn't show any java files or documentation in the new project.
Is there a standard practice for how to achieve this? I'm just moving into Android development from C, so I'm used to being able to provide header files with my libraries. It seems like there should be a way to achieve something similar without too much hacking.

Securing a class file in Android Project

Kindly help me out with a method by which I can hide the code of a class file in Android Studio from other developers. The other developers can access the functions but they won't be able to see the code inside of that class.
This idea comes from iOS, using a compiled static library. iOS uses a pre-compiled static library with which the developers can only access the functions and get the return values.
Reference Link for NDK static library: Use of prebuild static Library compiled with Android Toolchain
I don't want to use Android NDK for doing this, I am sure Android SDK is capable of doing this on its own.
Using jar file can be a option, but jar can't hide the code. The class files can easily be decompiled and the code will be exposed to everyone.
There is a long list of obfuscation tools for android, beginning with ProGuard which is part of the SDK.
Still, none of these achieves the level of protection you get by using a native library with NDK. But even the latter can not be completely protected from disassembling and reverse engineering. It can not be a substitute to legal protection, like patents and copyrights.
The only way to really completely hide it is to host the code in a web service. And that would probably be easier than learning NDK coding, though it obviously has other drawbacks.

Using part of an Android app in a non-Android Java project

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.

How do I integrate a java client with an android application

Ok just to give a background I have a WCF service and I've made a client for it in java using MyEclipse 10.0. Now basically the client needs to reside on an android device and it just struck me that I might not be able to port it. I have absolutely no experience (of course I've got the HelloWorld app running though) with working on android. Also what I had in mind was that I'd create an applet in java for the client but I'm presuming awt wont work in android. I've seen that the android toolkit for designing an app is quite good so I dont mind working with it. But all that is bothering me is how do I integrate the java client which includes a lot of imported class especially from the javax.xml package. Any suggestions on how I can move forward will be welcome. Thank you!
No worries. Android SDK is an extension of Java core SDK. So you can use any class from Java by importing the Libraries (Jar files) in Android Project. Unless the library is any hardware specific it will work well with Android too. (Not all, Most of them).
For example if you use an API to call a web service in Java, you can use the same in Android by adding that Library to your Application.

Categories

Resources