How-to start service automatically on system startup and on installation

by kijiten orma » Mon, 13 Apr 2009 12:03:54 GMT


Sponsored Links
 Translate English version :

hello,

someone can be how to define a service that launch automatically at
startup and / or when installation without having to go through
"activity". I look beautiful everywhere, I do found that the functions
and BindService but StartService
which requires action outside.

thank you.

French version :

bonjour,

quelqu'un saurait-il comment dfinir un service qui se lancerai
automatiquement au dmarrage et/ou lors de l'installation sans pour
autant passer par une "activity". J'ai beau regarder un peu partout,
je ne trouve que les fonctions startService et BindService mais qui
ncessite une action extrieur.

merci.


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



How-to start service automatically on system startup and on installation

by Mike Collins » Tue, 14 Apr 2009 02:49:27 GMT


 I have been down this road with my app, you probably don't want
to do this.

It is much better to have the app that uses the service start the
service when it needs it and simply leaves it running.

  mike




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


Sponsored Links


Other Threads

1. SSL handshake failure when client certificate is requested

Hello,

Trying to set up a secure connection via SSL I get a SSL handshake
failure when the server requests the client certificate. The code
excerpt shown below (basically Apache's ClientCustomSSL.java example
extended to use custom keystore for client cert and to support BKS
keystores) works on my desktop PC but throws a handshake failure in
Android simulator. Is this a bug, do I miss to add something Android
specific or is it just a permission problem?

Setup on PC: OS: openSuse 11.1, Java: SUN 1.6.0_17, openssl: 0.9.8h
Android SDK platform: 1.5_r3 revision 3
________________________________
DefaultHttpClient httpclient = new DefaultHttpClient();

// [ ... ] lines for key- and truststore initialization omitted

SSLSocketFactory socketFactory = new SSLSocketFactory(keyStore,
keyStorePassword ,trustStore);

Scheme sch = new Scheme("https", socketFactory, 4433);
httpclient.getConnectionManager().getSchemeRegistry().register(sch);

HttpGet httpget = new HttpGet("https://192.168.0.63:4433");

System.out.println("executing request" + httpget.getRequestLine());

// SSL handshake failure when executing next line
HttpResponse response = httpclient.execute(httpget);

// [...] Remaining code omitted
_________________________________
Logcat:
W/System.err( 1313): java.io.IOException: SSL handshake failure:
Failure in SSL library, usually a protocol error
W/System.err( 1313): error:14094410:SSL routines:SSL3_READ_BYTES:sslv3
alert handshake failure (external/openssl/ssl/s3_pkt.c:1053
0x2911c0:0x00000003)
_________________________________
Server (openssl s_server [...] -Verify 1
21435:error:140890C7:SSL routines:SSL3_GET_CLIENT_CERTIFICATE:peer did
not return a certificate:s3_srvr.c:2514:
_________________________________

Thanks for you help

Alex



-- 

2. Please help me find documentation on actions for the manifest file

Hi,

      This has been killing me.  I finally found examples around the
net for things I wanted to experiment with.  I had to go searching cuz
I could find this information anywhere in the API Docs.

      Two things specifically that I'm interested in are:

      1) For listening for broadcast SMS messages through a broadcast
receiver, I see that you have to defined the action, for the intent in
the broadcast receiver element as:

        <receiver android:name=".<myClassName>">
            <intent-filter>
                <action android:name=
                    "android.provider.Telephony.SMS_RECEIVED" />
            </intent-filter>

        First, where is that name
android.provider.Telephony.SMS_RECEIVED defined?  How am I supposed to
track that down in the API Doc?  There is no
android.provider.Telephony class or package.

        Second, in the code for receiving the actual broadcast, I see
you need to do something like this to get the message(s).

        Object[] pdus = (Object[]) bundle.get("pdus");

        Where is it defined that the extra name in the bundle is
"pdus" for SMS messages.

     2) OK, similar thing for receiving GMail and Exchange email
delivery notifications.

         First, is there a way to get them via a broadcast receiver?

         I see code floating around that you need to do something like
this instead:

contentResolver.registerContentObserver(Uri.parse("content://gmail-
ls"), true, gmailObserver);

Cursor conversations = _contetResolver.query(
                                        Uri.parse("content://gmail-ls/
conversations/"
                                                        +
YourEmailAddress, null, null, null, null);


And the actual conversation messages will be:
Cursor messages = _contetResolver.query(Uri
                                                                .parse
("content://gmail-ls/conversations/"
 
+ YourEmailAddress + "/"
 
+ String.valueOf(conversationId)
 
+ "/messages"), null, null, null, null);

          If this is how you have to do it, then that's fine.  But
where is this documented so that I could have figured this out myself?

    Thanks,
    Joe


-- 

3. General Android Bug

4. Seek advice about the problem with the help of android application connects HttpServer

5. minSdkVersion and file editing

6. Android 2.0

7. any good tutorial for database stuff