IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Android Discussion :

[ Envoie SMS ] Savoir si un SMS à bien été envoyé


Sujet :

Android

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Inscrit en
    Décembre 2008
    Messages
    280
    Détails du profil
    Informations forums :
    Inscription : Décembre 2008
    Messages : 280
    Par défaut [ Envoie SMS ] Savoir si un SMS à bien été envoyé
    Bonjour,

    une fois un sms envoyé, est-il possible de savoir s' il a bien été envoyé ? afin de pouvoir, par exemple, en envoyer un autre ?!


    Merci !

  2. #2
    Expert confirmé

    Avatar de Feanorin
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    4 589
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 4 589
    Par défaut
    Bonjour,

    Oui c'est possible ,

    http://developer.android.com/referen...ndingIntent%29

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    ArrayList<PendingIntent> deliveryIntent
    Ce PendingIntent te retournera un status que tu auras passer en paramètre lors de la réception du SMS .

  3. #3
    Membre éclairé
    Inscrit en
    Décembre 2008
    Messages
    280
    Détails du profil
    Informations forums :
    Inscription : Décembre 2008
    Messages : 280
    Par défaut
    Ok merci !

    Mais si c'est un service qui envoie un sms, ou dois-je avoir la méthode onActivityResult ??? Dans mon TimerTask ?!

    et pourquoi utiliser un tableau d'Intent ?!

  4. #4
    Expert confirmé

    Avatar de Feanorin
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    4 589
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 4 589
    Par défaut
    [quotesi c'est un service qui envoie un sms, ou dois-je avoir la méthode onActivityResult ??? Dans mon TimerTask ?![/QUOTE]

    C'est un BroadcastReceiver.



    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    BroadcastReceiver tonbroadcast = new BroadcastReceiver() {
    		@Override
    		public void onReceive(Context arg0, Intent arg1) {
                       switch (getResultCode()) {
    			case Activity.RESULT_OK:

    et pourquoi utiliser un tableau d'Intent ?!
    public void sendMultipartTextMessage (String destinationAddress, String scAddress, ArrayList<String> parts, ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents)
    Since: API Level 4

    Send a multi-part text based SMS. The callee should have already divided the message into correctly sized parts by calling divideMessage.
    Parameters
    destinationAddress the address to send the message to
    scAddress is the service center address or null to use the current default SMSC
    parts an ArrayList of strings that, in order, comprise the original message
    sentIntents if not null, an ArrayList of PendingIntents (one for each message part) that is broadcast when the corresponding message part has been sent. The result code will be Activity.RESULT_OK for success, or one of these errors:
    RESULT_ERROR_GENERIC_FAILURE
    RESULT_ERROR_RADIO_OFF
    RESULT_ERROR_NULL_PDU
    For RESULT_ERROR_GENERIC_FAILURE each sentIntent may include the extra "errorCode" containing a radio technology specific value, generally only useful for troubleshooting.
    The per-application based SMS control checks sentIntent. If sentIntent is NULL the caller will be checked against all unknown applications, which cause smaller number of SMS to be sent in checking period.
    deliveryIntents if not null, an ArrayList of PendingIntents (one for each message part) that is broadcast when the corresponding message part has been delivered to the recipient. The raw pdu of the status report is in the extended data ("pdu").
    Throws
    IllegalArgumentException if destinationAddress or data are empty
    public void sendTextMessage (String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent)
    Since: API Level 4

    Send a text based SMS.
    Parameters
    destinationAddress the address to send the message to
    scAddress is the service center address or null to use the current default SMSC
    text the body of the message to send
    sentIntent if not NULL this PendingIntent is broadcast when the message is successfully sent, or failed. The result code will be Activity.RESULT_OK for success, or one of these errors:
    RESULT_ERROR_GENERIC_FAILURE
    RESULT_ERROR_RADIO_OFF
    RESULT_ERROR_NULL_PDU
    For RESULT_ERROR_GENERIC_FAILURE the sentIntent may include the extra "errorCode" containing a radio technology specific value, generally only useful for troubleshooting.
    The per-application based SMS control checks sentIntent. If sentIntent is NULL the caller will be checked against all unknown applications, which cause smaller number of SMS to be sent in checking period.
    deliveryIntent if not NULL this PendingIntent is broadcast when the message is delivered to the recipient. The raw pdu of the status report is in the extended data ("pdu").
    Throws
    IllegalArgumentException if destinationAddress or text are empty
    l'Array n'est que si tu envoie les messages avec sendMultipartTextMessage , tu peux avoir un broadcast recever par message

    Sinon utilise sendmessage qui lui n'a qu'un seul PendingIntent

  5. #5
    Membre éclairé
    Inscrit en
    Décembre 2008
    Messages
    280
    Détails du profil
    Informations forums :
    Inscription : Décembre 2008
    Messages : 280
    Par défaut
    Bonjour,

    Dans quel cas utiliser un multi???

    Pense tu que c'est possible d'en envoyer plusieurs à la suite ou tu crois qu'il y a une restriction à ce niveau ?? du genre pas plus d'un message toutes les 5 mn ?!

  6. #6
    Expert confirmé

    Avatar de Feanorin
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    4 589
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 4 589
    Par défaut
    Bonjour,

    After you define your own SmsManager, you can divide your SMS message by 160 bytes. (Optional, if your SMS always less than 160 bytes, you can pass this part)
    Donc le multi est utile si ton message contient plus de 160 bytes .

    http://mobdev.olin.edu/mobdevwiki/Fr...MS%20Messaging
    tu crois qu'il y a une restriction à ce niveau ?? du genre pas plus d'un message toutes les 5 mn ?!
    Personnellement je ne pense pas ...

Discussions similaires

  1. Réponses: 9
    Dernier message: 05/03/2010, 17h38
  2. Envoie d'email et de SMS
    Par Rock01 dans le forum ASP.NET
    Réponses: 1
    Dernier message: 17/02/2009, 22h03
  3. [SMS] Envoi et reception d'un SMS
    Par ghoga dans le forum Multimédia
    Réponses: 3
    Dernier message: 14/08/2008, 17h23
  4. Envoi HTTP pour plate forme SMS : comment ?
    Par Invité dans le forum Langage
    Réponses: 6
    Dernier message: 20/07/2006, 09h04

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo