My manifest file is as follows and in which i want to start my
service.

 <application android:icon="@drawable/icon" android:label="@string/
app_name" android:enabled="true">
        <service
                android:enabled="true"
                android:name=".MyService">
            <intent-filter>
                   <action android:name="test.com.MyService" />
            </intent-filter>
        </service>
        <activity android:name=".ServiceTest"
                  android:label="@string/app_name">
            <intent-filter>

                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />

            </intent-filter>
        </activity>

    </application>




    Is   there any wrong with above manifest file.





On Oct 19, 10:16 am, pink 444 <[email protected]> wrote:
>     I am starting my service in an Activity with StartService()
> method.But i don't know how to start service from application.Thus
> whenever my activity is destroyed and rebuilt  new service is created.
>
>    How can i create/start my service from other than Activity?
>
> On Oct 18, 5:43 am, Farproc <[email protected]> wrote:
>
> > You can try to code, and then post the problem you encounter.
>
> > On 10月17日, 下午1时10分, pink 444 <[email protected]> wrote:
>
> > > Thanks for your replay.
>
> > > Can you give me a example .
>
> > > On Oct 16, 2:55 pm, Farproc <[email protected]> wrote:
>
> > > >   First, you do not have tostart/stop aservicefrom a Activity. You
> > > > can
> > > > do that in anywhere via a Context object(which is very easy to
> > > > retrieve).
>
> > > >   If you want tostartaservice, just call Context.startService(),
> > > > form
> > > > then on theservicewill keep running in background until you
> > > > explicitly
> > > > call Context.stopService(). Then call Context.bindService() if you
> > > > want
> > > > to control theserviceand Context.unbindService() when you do not
> > > > want to communicate with theserviceanymore.
>
> > > >   Finally, Call Context.stopService() to terminate theservicewhen it
> > > > is
> > > > not needed.
>
> > > >   ps: Though aserviceruns in "background", it runs in the main(UI)
> > > > thread.
>
> > > > On 10月16日, 下午12时38分, pink 444 <[email protected]> wrote:
>
> > > > > Hai,
>
> > > > >      My application has a background process which continuously waits
> > > > > on a  socket for receiving messages and it should be started only once
> > > > > and at the time of application starting.Thus i want to do that
> > > > > background job in aservice.
>
> > > > >     Theserviceshould not be started from the  activity ,it should be
> > > > > started at the application starting.
>
> > > > >     How can i define theservice,which will be started at the time of
> > > > > application starting?
>
> > > > >    If at all theserviceis started from activity.The activity can be
> > > > > destroyed
> > > > > and restarted.when this happens theservicealso be restarted .
>
> > > > > Any help will be appreciated highly.
>
> > > > > Thanks,
> > > > > -SIva.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to