BroadcastReceiver and force close app

0 Fabio Petta · January 26, 2015
Excuse my english, I'm fabio from Italy.

Broadcastreceiver registred on manifest if app is kill broadcastreceiver not work.

if app is force close from task manager the broadcastreceiver not work ?

whi ?

<!-- manifest -->
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.xxxxxxx.app.avvio">
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <receiver
            android:enabled="true"
            android:exported="true"
            android:name="com.xxxxxxxx.app.avvio.BroadAvvio">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED">
                    </action>
                <category android:name="android.intent.category.HOME">
                    </category>
            </intent-filter>
        </receiver>

        <activity
            android:name=".esci"
            android:label="@string/title_activity_esci" >
        </activity>

    </application>
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
  
</manifest>


//broadAvvio class
public class BroadAvvio extends BroadcastReceiver{

    @Override
    public void onReceive(Context context, Intent intent) {
      
        if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){
            Intent i = new Intent(context, esci.class);
            i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(i);
           
        }
    }

activity is simple activity


if app is force close from task manager the broadcastreceiver not work ?
whi ?

Post a Reply

Replies

Oldest  Newest  Rating
0 Fabio Petta · January 28, 2015
is a bug of android 4.4.x

on force close app lost all service and broadcastreceiver of app
is impossible resolve it

  • 1

Java / Android Development

107,243 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator