If I needed to build an android SDK that other developers can integrate into their android apps, is jarring my SDK the only way to go about it? As far as I have learnt, jarring has the following considerations:
- If your app uses a layout, then you have to create it programmatically. Since jar files cant carry any resources.
- The jar will needs to be placed in the lib/assets folder and added to the build path (in Eclipse) — Learnt here: Android – Invoke activity from within jar
- The main app will have to create an Intent object and specify the package and class name in the jar to start the activity.
Any one have other ideas of going about any of the above steps?
Thanks
George
Creating a JAR is, in my opinion, a very bad decision. Android has specific features just for the kind of thing you’re looking for. If your JAR:
ContentProvider;Service;Activitythat gets some input from the user (or shows some information about something), eventually processes it and returns it to the callingActivity, just create thatActivityand any application will be able to start yourActivityas long as it’s installed on the phone.If you use one of the three solutions above, third party apps will be able to probe for whether your application is installed and, if not, prompt the user to install it. Only if your application does not fall into one of the three bullet points mentioned above should you use a JAR. Otherwise, using a
ContentProvider,ServiceorActivityprovides:Again, these components are specifically designed and provided by the Android OS for creating such SDKs. Please, only use a JAR if you really, really have to. Otherwise, provide a standardized
ContentProvider,ServiceorActivityand document the way it’s supposed to be used (i.e. how to use/query/integrate it).