Ilkar Posted August 20, 2010 Share Posted August 20, 2010 Bonjour je cherche à détecter quand le téléphone raccroche. Voici le code utilisé : public void onCallStateChanged(int state, String number){ super.onCallStateChanged(state, number); switch (state){ case TelephonyManager.CALL_STATE_RINGING: Toast toast = Toast.makeText(getApplicationContext(),"Sonnerie", Toast.LENGTH_LONG); toast.show(); break; case TelephonyManager.CALL_STATE_OFFHOOK: Toast toast2 = Toast.makeText(getApplicationContext(),"Raccrocher", Toast.LENGTH_LONG); toast2.show(); break; } } Quel est la constante pour savoir quand le téléphone raccroche car TelephonyManager.CALL_STATE_OFFHOOK ne fonctionne pas. Merci d'avance Link to comment Share on other sites More sharing options...
akex Posted August 20, 2010 Share Posted August 20, 2010 Pourquoi ne pas, tout simplement, dans un premier temps, ne pas faire de switch et juste faire un toast du state ? Avec l'entier retourné, tu sauras tout de suite quel état correspond à ce que tu recherches ;). y a aussi cette constante : CALL_STATE_IDLE Link to comment Share on other sites More sharing options...
Ilkar Posted August 22, 2010 Author Share Posted August 22, 2010 Le problème est qu'il affiche d'abord IDLE puis HOOK_OFF avant même d'avoir commencer à téléphoner. Link to comment Share on other sites More sharing options...
akex Posted August 23, 2010 Share Posted August 23, 2010 normal pour offHook puisque ça veut dire décrocher. Si tu veux détecter quand il raccroche, c'est IDLE. Pas vraiment compris ce que tu souhaitais faire. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.