declaring a service

by Mina Shokry » Sat, 26 Sep 2009 03:50:48 GMT


Sponsored Links
 hello,

I am trying to run service example. I declare a service in a project
and want to call the service from an activity that exists in another
project.

in first project, my AndroidManifest.xml looks like this
<manifest xmlns:android=" http://schemas.android.com/apk/res/android" ;
     package="com.mypackage.service_server">
        <application>
                <service android:exported="true" 
android:name=".CalculatorService" /
        </application>
</manifest>

the CalculatorService class extends the Service class and its onBind
method looks like this
public IBinder onBind(Intent intent) {
        if(calculator == null) {
                calculator = new CalculatorImpl();
        }
        return calculator;
}

The CalculatorImpl class extends Calculator.Stub class and
Calculator.java is generated from Calculator.aidl.

in the other project, in the activity onCreate there is a code like
this

Intent intent = new Intent(Calculator.class.getName());
boolean connected = bindService(intent, connection, BIND_AUTO_CREATE);

the method bindService returns false. what is missing in my both
projects?

note: the Calculator.java file is shared between both projects by a
symlink.

thanks in advance.
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Flip-book animation of map overlays to show time dependent images

Hi Roland,
can you post your solution? I've followed that link but without
success.

Thanks.



--~--~---------~--~----~------------~-------~--~----~

2. General Question.....

Hi All,

You known How many application participate yet for ADC....

Regards,
Baskar
--~--~---------~--~----~------------~-------~--~----~

3. Developing distributed applications using Android

4. Eclipse Europa 3.3 on Win. XP

5. setWallpaper

6. GmmGeocoder - Latitude Longitude Span not working

7. ListView selection problem (with highlighting/selecting first element)