dimanche 14 février 2016

The broadcast reciever is not recieving the intent in android?

This is my code I am saving the app installation time and receiving it through broadcast intent but not able to do so. the onReceive() method has not getting

BroadcastReciever1.java:

        @Override
        public void onReceive(Context context, Intent intent) {
    String action = intent.getAction();

    if ("android.intent.action.PACKAGE_INSTALL".equals(action)){ 
                Date date= new Date(); 
                long time = date.getTime();
                CommonUtils.savePreferences(context, "installedTime", time);


            }
    }




AndroidManifest.xml:



<receiver
            android:name=".broadcast.BroadcastReceiver1"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>


                <action android:name="android.intent.action.PACKAGE_INSTALL" />

                <category android:name="package" />
            </intent-filter>

        </receiver>

Aucun commentaire:

Enregistrer un commentaire