java - android receiver not being called -


i have android application , have receiver wakefulbroadcastreceiver never called.

i put breakpoint on alaramreceiver.java , never stepped into. checked case , how spelled receiver class name.

i add manifest , java classes linked.

thank help.

manifest :

 <receiver android:name="fr.cls.mobility.myclsdroiddata.service.android.onalarmreceiver_"> 

alarmreceiver_.class :

public final class onalarmreceiver_     extends onalarmreceiver {   } 

alamarreceiver.java :

@ereceiver public class onalarmreceiver extends wakefulbroadcastreceiver {      private static final string log_message_on_receive = "startwakefulservice context , datadownloadintentservicefactory.getintentalarmreceived";      @override     public void onreceive(context context, intent intent) {         log.d(onalarmreceiver.class.getsimplename(), log_message_on_receive);         startwakefulservice(context, datadownloadintentservicefactory.getintentalarmreceived(context, null));     }  } 

datadownloadintentservicefactory.java :

package fr.cls.mobility.myclsdroiddata.service.android;  import com.effitic.delegates.action;  import android.content.context; import android.content.intent; import android.os.parcelable; import android.os.resultreceiver;  /**  * cette classe crée les différents services android de mise à jour des positions. <br>  * <br>  * copyright : copyright (c) 2013 <br>  * <br>  * société : cls (collecte localisation satellites)  *   * @author effitic  * @version revision: 1.1.0.02 - date: 2014-01-15  */ public final class datadownloadintentservicefactory {      /**      * constructeur.      */     private datadownloadintentservicefactory() {         super();     }      public static intent getintentnetworkstatechanged(context context, boolean networkavailable) {         intent datadownloadintentservice = createintent(context, null, datadownloadintentservice.network_state_changed);         datadownloadintentservice.putextra(datadownloadintentservice.network_state_changed, networkavailable);         return datadownloadintentservice;     }      private static intent createintent(context context, resultreceiver resultreceiver, string type) {         intent datadownloadintentservice = datadownloadintentservice_.intent(context).get();         datadownloadintentservice.putextra(datadownloadintentservice.type, type);         datadownloadintentservice.putextra(datadownloadintentservice.result_receiver, resultreceiver);         return datadownloadintentservice;     }      public static intent getintentalarmreceived(context context, final action<object> refreshfinishedhandler) {         resultreceiver resultreceiver = new resultreceiver(null) {             @override             protected void onreceiveresult(int resultcode, android.os.bundle resultdata) {                 if (refreshfinishedhandler != null) {                     refreshfinishedhandler.execute(null);                 }             };         };          intent datadownloadintentservice = createintent(context, resultreceiver, datadownloadintentservice.alarm_received);         return datadownloadintentservice;     }      public static intent getintentrefresh(context context, final action<object> refreshfinishedhandler) {         resultreceiver resultreceiver = new resultreceiver(null) {             @override             protected void onreceiveresult(int resultcode, android.os.bundle resultdata) {                 if (refreshfinishedhandler != null) {                     refreshfinishedhandler.execute(null);                 }             };         };         intent datadownloadintentservice = createintent(context, resultreceiver, datadownloadintentservice.refresh);         return datadownloadintentservice;     }      public static intent getintentbootcompletereceived(context context) {         intent datadownloadintentservice = createintent(context, null, datadownloadintentservice.boot_complete_received);         return datadownloadintentservice;     }      public static <t extends resultreceiver> t getresultreceiverfromintent(intent intent, class<t> clazz) {         parcelable o = intent.getparcelableextra(datadownloadintentservice.result_receiver);         if (clazz.isinstance(o)) {             return clazz.cast(o);         }         return null;     } } 

my manifest :

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installlocation="auto" android:versioncode="51" android:versionname="1.3.01-snapshot" package="fr.cls.mobility.myclsdroiddata">      <uses-sdk android:minsdkversion="11" android:targetsdkversion="14"/>     <!-- permissions -->     <uses-permission android:name="android.permission.internet"/>     <!-- pour le stockages des tuiles de carto -->     <uses-permission android:name="android.permission.write_external_storage"/>     <uses-permission android:name="android.permission.access_wifi_state"/>     <uses-permission android:name="android.permission.access_network_state"/>     <uses-permission android:name="android.permission.receive_boot_completed"/>     <uses-permission android:name="android.permission.wake_lock"/>     <application android:allowbackup="false" android:debuggable="true" android:icon="@drawable/notif" android:label="@string/app_name" android:name="fr.cls.mobility.myclsdroiddata.view.application.clsapplication_" android:theme="@style/apptheme2">         <activity android:configchanges="keyboardhidden|orientation|screensize" android:hardwareaccelerated="false" android:label="@string/app_name" android:launchmode="singletop" android:name="fr.cls.mobility.myclsdroiddata.view.activity.mapviewactivity">             <intent-filter>                 <action android:name="android.intent.action.main"/>                 <category android:name="android.intent.category.launcher"/>             </intent-filter>         </activity>         <activity android:configchanges="keyboardhidden|orientation|screensize" android:name="fr.cls.mobility.myclsdroiddata.view.activity.panelfragmentactivity" android:windowsoftinputmode="statehidden"/>         <service android:name="fr.cls.mobility.myclsdroiddata.service.android.datadownloadintentservice_"/>         <receiver android:name="fr.cls.mobility.myclsdroiddata.service.android.onbootreceiver_">             <intent-filter>                 <action android:name="android.intent.action.boot_completed"/>             </intent-filter>         </receiver>         <receiver android:name="fr.cls.mobility.myclsdroiddata.service.android.onnetworkstatechangedreceiver_">             <intent-filter>                 <action android:name="android.net.wifi.wifi_state_changed"/>                 <action android:name="android.net.wifi.state_change"/>             </intent-filter>         </receiver>         <receiver android:name="fr.cls.mobility.myclsdroiddata.service.android.onalarmreceiver_"/>       </application>  </manifest> 

you have not specified intent filter receiver in manifest. without intent filter not know when trigger or otherwise need invoke explicitly

<receiver android:name="fr.cls.mobility.myclsdroiddata.service.android.onalarmreceiver" >     <intent-filter>         <action android:name="android.intent.action.your_intent_action" />         <!--if want watch network connectivity state-->         <action android:name="android.net.conn.connectivity_change" />     </intent-filter> </receiver> 

otherwise have invoke explicitly

intent intent = new intent(getapplicationcontext(), fr.cls.mobility.myclsdroiddata.service.android.onalarmreceiver.class); sendbroadcast(intent);` 

Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -