Bonjour,
J'ai besoin d'aide, après des heures de recherches...
J'ai une application sous WDM qui doit récupérer le numéro d'appel entrant.
Mon application fonctionné très bien jusqu'au passage sous android 10.
Dans le code du projet, je créer un thread persistant pour conserver l'application en arrière plan. je peux partager si des personnes sont intéressé.
Puis, je lance la procédure suivante en java dans les procédures globales.
Code Java : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 //Procédure java JRegisterPhoneStateListener //Automatisme de la procédure : Thread principale import android.content.Context; import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; import android.widget.Toast; public static void JRegisterPhoneStateListener() { // uses-permission android.permission.READ_PHONE_STATE // pour ACTIVER le LISTENER Context tmpContext = getContexteApplication(); TelephonyManager TelephonyMgr = (TelephonyManager)tmpContext.getSystemService(tmpContext.TELEPHONY_SERVICE); PhoneStateListener myPhoneStateListener = new PhoneStateListener() { public void onCallStateChanged(int state, String incomingNumber) { super.onCallStateChanged(state, incomingNumber); switch(state) { case TelephonyManager.CALL_STATE_IDLE: // pas d'appel break; case TelephonyManager.CALL_STATE_RINGING: // appel entrant sonnant //appelProcedureWL("AppelEntrantDetecte",incomingNumber); Toast.makeText(getApplicationContext(),"Appel entrant : "+incomingNumber,Toast.LENGTH_LONG).show(); break; case TelephonyManager.CALL_STATE_OFFHOOK: // ligne occupée break; } } }; TelephonyMgr.listen(myPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); }
Sur réception d'un appel, j'ai bien le toast mais il affiche :
Appel entrant :
Sans le numéro.
Merci d'avance car je comprend pas pourquoi cela ne fonctionne plus.
Partager