sebastien247 Posted July 27, 2011 Share Posted July 27, 2011 Bonjour, je développe actuellement ma premiere application pour android. Celui-ci fonctionne parfaitement sur l'emulateur, mais lorsque j’exécute celui-ci sur mon Motorola milestone possédant la version d'android 2.3.4, le service BroadcastReceiver ne fonctionne pas. Ce service est sensé être appeler lors des appels sortant. Voici mon BroadcastReceiver: package com.geniteam.broadcast; import java.util.Calendar; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.widget.Toast; public class IncomingCallReciever extends BroadcastReceiver { //private Context mContext; //private Intent mIntent; int mYear; int mMonth; int mDay; int cDay; @Override public void onReceive(Context context, Intent intent) { //mContext = context; //mIntent = intent; // Si il y a un appel sortant if(intent.getAction().equalsIgnoreCase(Intent.ACTION_NEW_OUTGOING_CALL)){ String outgoingno = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); //System.out.println(">>>>>>>>>>>>> Appel Sortant"); Toast.makeText(context, "Appel Sortant : " + outgoingno,Toast.LENGTH_LONG).show(); // Obtient la date actuelle final Calendar c = Calendar.getInstance(); mYear = c.get(Calendar.YEAR); mMonth = c.get(Calendar.MONTH); mDay = c.get(Calendar.DAY_OF_MONTH); String DATE = mYear + "-" + mMonth + "-" + mDay; //System.out.println(mYear + "-" + mMonth + "-" + mDay); //Création d'une instance de ma classe Le19BDD Le19BDD numeroBdd = new Le19BDD(context); //Création du numero Le19 contactNum = new Le19(outgoingno, DATE); //On ouvre la BDD pour écrire dedans numeroBdd.open(); //On insère le numero que l'on vient de créer dans la BDD numeroBdd.insertNumero(contactNum); //System.out.println(numeroBdd.get19Numeros()); // On affiche les 19 numero inserer dans la BDD // On ferme la BDD numeroBdd.close(); } } } Voici mon manifest : <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.geniteam.broadcast" android:versionCode="1" android:versionName="1.0"> <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/> <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission> <uses-permission android:name="android.permission.GET_ACCOUNTS"></uses-permission> <uses-permission android:name="android.permission.READ_CONTACTS"></uses-permission> <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true"> <receiver android:name=".IncomingCallReciever" android:enabled="true"> <intent-filter> <action android:name="android.intent.action.PHONE_STATE"></action> <action android:name="android.intent.action.NEW_OUTGOING_CALL"/> </intent-filter> </receiver> <activity android:name=".view" 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> <uses-sdk android:minSdkVersion="8" /> </manifest> Après plus d'une semaine sur cette application j’espère que vous pourrais m'aider Merci d'avance. Sébastien Link to comment Share on other sites More sharing options...
sebastien247 Posted September 5, 2011 Author Share Posted September 5, 2011 Up :| Link to comment Share on other sites More sharing options...
Bismuth76 Posted September 6, 2011 Share Posted September 6, 2011 Salut ^^ Question peut-être stupide mais tu l'exécutes comment sur ton téléphone ? Tu transferts l'apk que tu install ensuite depuis ton téléphone ou tu est en mode debug ? EDIT : Reflexion faite, cette question est stupide... xD Link to comment Share on other sites More sharing options...
nbbu Posted September 6, 2011 Share Posted September 6, 2011 Celui-ci fonctionne parfaitement sur l'emulateur, mais lorsque j’exécute celui-ci sur mon Motorola milestone possédant la version d'android 2.3.4, le service BroadcastReceiver ne fonctionne pas. Il faudrait plus d'info sur le ne fonctionne pas ... as tu des warnings/erreurs quand tu lances ton appli sur ton tel tout en étant connecté à eclipse ? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.