ACTION_MY_PACKAGE_REPLACED not received

Posted by Ton on Stack Overflow See other posts from Stack Overflow or by Ton
Published on 2012-10-01T01:56:48Z Indexed on 2012/10/01 3:38 UTC
Read the original article Hit count: 290

Filed under:
|

I am using ACTION_MY_PACKAGE_REPLACED to receive when my app is updated or resinstalled. My problem is that the event is never triggered (I tried Eclipse and real device). This is what I do:

Manifest:

<receiver android:name=".MyEventReceiver" >
    <intent-filter android:priority="1000" >
        <action android:name="android.intent.action.ACTION_MY_PACKAGE_REPLACED" />
    </intent-filter>
</receiver>

Code:

public class MyEventReceiver extends BroadcastReceiver
{  
   @Override public void onReceive(Context context, Intent intent)
   {  
      if ("android.intent.action.ACTION_MY_PACKAGE_REPLACED".equals(intent.getAction())) 
      {  //Restart services
      }
   }      
}

This code is simple, in real one I used other events like BOOT_COMPLETED and others, and they work but ACTION_MY_PACKAGE_REPLACED. Thanks.

© Stack Overflow or respective owner

Related posts about android

Related posts about broadcastreceiver