N
N
NickNamee2016-09-27 09:11:02
Java
NickNamee, 2016-09-27 09:11:02

How to catch the self install event?

Good day!
Dear experts, please tell me the subtleties of the issue?
I'm trying to catch the moment of installing the application, but it doesn't work.
Other application installations after installing my application are caught normally.
Is there some secret?
Manifesto

<receiver android:name="net.prg.InstallReciever" android:enabled="true" android:exported="true">
            <intent-filter >
            <category android:name="android.intent.category.DEFAULT" />
            <action android:name="android.intent.action.PACKAGE_ADDED"  />
            <action android:name="android.intent.action.PACKAGE_CHANGED" />
            <action android:name="android.intent.action.PACKAGE_INSTALL" />
            <action android:name="android.intent.action.PACKAGE_REMOVED" />
            <action android:name="android.intent.action.PACKAGE_REPLACED" />
            <data android:scheme="package" />
            </intent-filter>
        </receiver>

receiver
public class InstallReciever extends BroadcastReceiver 
{
  public InstallReciever()
  {
    //This log will display in the logcat
    Log.d("log", "InstallReceiver constructor called.");
  }
  
    @Override
    public void onReceive(Context context, Intent intent) 
    {
    	Uri data = intent.getData();
    	Log.d("log", "Action: " + intent.getAction());
    	Log.d("log", "The DATA: " + data);
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
aol-nnov, 2016-09-27
@aol-nnov

but why?
maybe you will voice the ultimate goal of your "journey"?
I have read it in other comments.
No, the application will not launch itself after installation. moreover, from some version of the broadcast receivers to boot_completed and so on will not be installed even after the device is rebooted. first run must be by hand (by user)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question