Home Forum
Welcome, Guest
Username Password: Remember me

Android code libraries
(1 viewing) (1) Guest
Discussion related to creating Android software
  • Page:
  • 1

TOPIC: Android code libraries

Android code libraries 2 years, 9 months ago #160

I've been trying to work out how to create code libraries for use in Android projects, in particular creating a library that contains a service (A JSON Connection service). As there is no option to create an Android library project the option option was to put it in its own application project with the service declared in the applications manifest.

I'm guessing that its not a good idea to have the users download multiple apk files just to get the services installed so I want to build all the libraries into the same package as the application.

So I added the JSONConnection project to the build path of the applications using it by adding it to the project list of the build path.

This seems to compile fine but when the activity that references the service is started it gave late link error, the client implements a interface defined in the service project and the interface is not available.

The solution so far is to include any aidl files in client as well, this generates the stub functions required for the local calls.

Seems simple now

The manifest of the Service project needs a service element adding, the following worked for the JSON connection service.

<service android:label="JSON Connection" android:enabled="true" android:name="Connection" android:exported="true">
<intent-filter>
<action android:name="com.example.android.json.ConnectionService" />
</intent-filter>
</service>

Anybody doing anything similar?
  • mmoore
  • OFFLINE
  • Examiner
  • Posts: 22
  • Karma: 1
  • Page:
  • 1
Time to create page: 0.16 seconds
Copyright © 2012 Android Academy. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.
 
Glossary
We have 31 guests online