views:

21

answers:

0

After I successfully configured alarms to go of after I start or restart my phone (thanks for that answer Macarese), I must have made something wrong, because stored alarms are not fired after 2 or even 3 hours after the phone has been turned on.

I tested alarms that supposed to be sending notifications every 5 minutes... Nothing happens!

I've been following up with the logcat and I've noticed that even the providers, for databases are being published late (like really, really late).

The following is what I have in terms of my application Manifest:

  <service android:name="Service_A" android:enabled="true">
      <intent-filter>
          <action android:name="com.magoco.main.Service_A"></action>
      </intent-filter>
  </service>

    <receiver android:name="AlarmReceiver" android:enabled="true">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED"></action>
            <category android:name="android.intent.category.HOME"></category>
            <action android:name="android.intent.action.PACKAGE_REPLACED"></action>
            <action android:name="android.intent.action.PACKAGE_RESTARTED"></action>
            <data android:scheme="package" android:path="com.magoco.main"></data>
        </intent-filter>

<uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>

The receiver suppose to start after boot is complete and the receiver call the service.

Here is the AlarmReceiver Code:

public class AlarmReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {


    try {
        Intent serviceIntent = new Intent();

        serviceIntent.setAction("com.magoco.main.Service_A");
        context.startService(serviceIntent);


    } catch (Exception e) {
        Toast
                .makeText(
                        context,
                        "There was an error somewhere, but we still received an alarm",
                        Toast.LENGTH_SHORT).show();
        e.printStackTrace();

    }
}

And finally here is the code for the Service_A, btw, most of this code has been stripped because is confidential:

public class Service_A extends Service {

public Service_A() {
    // TODO Auto-generated constructor stub
}

@Override
public void onCreate() {
    super.onCreate();
    this.searchForRNotifications();
    this.searchForAlarmsNotifications();

}

@Override
public void onDestroy() {
    super.onDestroy();
}

private void showNotification() {
}

private void serviceShowNotification(String _msg, int _notificationId) {
}

private void serviceShowAlarmsNotification(String _msg,
}

public void searchForRNotifications() {
}

private void incrementCounter() {
}

private void shutdownCounter() {
}

@Override
public IBinder onBind(Intent arg0) {
    // TODO Auto-generated method stub
    return null;
}

Any help in this regard, would be very much appreciated.

Thanks in advance,

monnet