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. Generating .java file from .aidl file

hi,

i am developing an android application with Eclipse/ADT.
i want to generate .java files from the existing .aidl file for my
application.


i got some below hints from internet, but i could not see the below option
in* Android Tools*->

   1. In the Package Explorer view, right-click on the project.
   2. Choose *Android Tools* > *Create Aidl preprocess file for Parcelable
   classes*.


can anybody tell me the procedure to generate java files.

/rocky

--

2. Show/Display more than one app at at time

Are there methods or api's that will allow me to have two separate
apps running in multi-task (a split screen) and displayed at the same
time?

For example, I would like to display a date/time/temp app... but at
the same time, allow the user to view their email. Is it possible????

Thanks in advance!!!
Davey

-- 

3. No visual feedback for preference defaults - bug or feature?

4. Programmatic UI Issues

5. avd hangs

6. nexus one kernel not running on sdk emulator ?

7. N1 BM