Making separate service app and separate activity app

by swapnil kamble » Thu, 03 Sep 2009 01:45:20 GMT


Sponsored Links
 


Now I am using this code to call service as

Intent i = new Intent(ICounterService.class.getName());
ComponentName cn = startService( i );

but I am getting cn as null, ie, service not available.


How do I get list of running services ?

I have installed service with android.



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



Making separate service app and separate activity app

by swapnil kamble » Thu, 03 Sep 2009 01:46:57 GMT


 Hi All,
         I am new to android. I want to create a service, which will
installed independently. And there will be multiple activity apps
communicating with it, justlike doing IPC. I saw the DualSeviceClient sample
which itself writes a service and communicates with it. But I want to run
service only app separately and activity app separately.

I also tried a separate service wiht my own. I installed it also. Now to
start or stop from activity app I need to call startService (Intent) or
StopService (Intent).

And my problem is how do I know class name package name reqd for intent
before starting or stopping in following code,

Intent i = new Intent();

*i.setClassName( "com.DualServiceOnly",
                "com.DualServiceOnly.DualServiceOnly" );* // How to
associate service here

startService( i );

Is there any sample available for this ?

Thanks in advance.

-- 
...Swapnil

|| Hare Krishna Hare Krishna Krishna Krishna Hare Hare ||
|| Hare Rama    Hare Rama   Rama   Rama    Hare Hare ||

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


Sponsored Links


Other Threads

1. Doc to PDF

Hi,
 Apologies for a total unrelated topic. But I am writing my docs in .doc
(msword) and I dont have a PDF converter. If anyone has it and is kind
enough for converting my docs to pdf, please reply me personally.

Thanks a lot,
Harsh

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

2. Confusing Problem about MediaPlayer

In Sample given by google There is a button to invoke a file.
    private void playVideo(Integer Media) {
        try {
            // If the path has not changed, just start the media
player
            path = "/data/room.mp4";

            // Create a new media player and set the listeners
            mp = new MediaPlayer();
            mp.setDataSource(path);
            mp.setDisplay(holder.getSurface());
            mp.prepare();
            mp.setOnBufferingUpdateListener(this);
            mp.setOnCompletionListener(this);
            mp.setOnPreparedListener(this);
            mp.setAudioStreamType(AudioSystem.STREAM_MUSIC);
            Log.d("\n\nCREATE", "mediaplayer");
            mp.start();
        } catch (Exception e) {
            Log.e(TAG, "error: " + e.getMessage(), e);
        }
    }

    private OnClickListener mPlayListener = new OnClickListener() {
        public void onClick(View v) {
            playVideo(extras.getInt(MEDIA));

        }
    };


When I copy the code directly to onCreate like the following program
creshed...:

    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.mediaplayer);
        mPreview = (SurfaceView) findViewById(R.id.surface);

        // Set the transparency
        getWindow().setFormat(PixelFormat.TRANSPARENT);
        // Set a size for the video screen
        holder = mPreview.getHolder();
        holder.addCallback(this);
        try {
            // If the path has not changed, just start the media
player
            path = "/data/room.mp4";

            // Create a new media player and set the listeners
            mp = new MediaPlayer();
            mp.setDataSource(path);
            mp.setDisplay(holder.getSurface());
            mp.prepare();
            mp.setOnBufferingUpdateListener(this);

            mp.setOnCompletionListener(this);
            mp.setOnPreparedListener(this);
            mp.setAudioStreamType(AudioSystem.STREAM_MUSIC);
            Log.d("\n\nCREATE", "mediaplayer");
            mp.start();
        } catch (Exception e) {
            Log.e(TAG, "error: " + e.getMessage(), e);
        }
}

There is no error information for debug.
Anyone have the same problem?
Thanks in advance.




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

3. Cursor c = this.getContentResolver().query( gets nullpointer exception when code is moved

4. Webpage Interaction - File Uploads

5. Adding file to emulator

6. Spell checking support/dictionary plugin for EditText widget?

7. Next Release of Android SDK