0

I am new to android.. I had created an application (AgentApp) which has an activity and a broadcast receiver. The intent filter of the receiver is android.intent.action.PACKAGE_ADDED .After launching the application,if any other app is getting installed the receiver is working fine.

But my doubt is when my application(AgentApp) is getting installed the receiver is not listening it y?..

Dipak Keshariya
  • 22,193
  • 18
  • 76
  • 128
Sudarshan
  • 1,291
  • 3
  • 26
  • 35
  • because your receiver will start after the installation of your App. – Mohsin Naeem Jul 30 '12 at 11:28
  • if i want my receiver to start before installation..what i need to do – Sudarshan Jul 30 '12 at 11:38
  • i need to install my app (but not launching).Before launching i need to run a activity(This i can do by using broadcast receiver -> IntentService ->startActivity),but main pbm is the listening of my App got installed. I should not listen from some other agent app or listener.. – Sudarshan Jul 30 '12 at 11:42

1 Answers1

2

See ACTION_PACKAGE_ADDED docs.

Broadcast Action: A new application package has been installed on the device. The data contains the name of the package. Note that the newly installed package does not receive this broadcast.

biegleux
  • 13,179
  • 11
  • 45
  • 52
  • thanks for ur reply... I have a following scenario to do.. i need to install my app (but not launching).Before launching i need to run a activity(This i can do by using broadcast receiver -> IntentService ->startActivity),but main pbm is the listening of my App got installed. I should not listen from some other agent app or listener. Plz help – Sudarshan Jul 30 '12 at 11:48
  • See http://stackoverflow.com/q/2127044/1300995 and http://stackoverflow.com/q/8531926/1300995 Why you can't start your desired activity when your app is started for the first time? – biegleux Jul 30 '12 at 11:59
  • @Deepak: Fortunately, what you want is not possible, for obvious security reasons. Please allow the *user* to launch your app when the *user* wants on the *user's* device, then do your setup work at that point. – CommonsWare Jul 30 '12 at 12:09
  • Thanks for ur reply sir..Still one clarification.. I have A.apk (which has a receiver not a activity.As i changed the AndroidManifestfile) and B.apk (Which has an activity).. Now could i bundle 2 apk into one (as C.apk) and wen i install C.apk it should install A.apk first and B.apk second... Is this possible? Plz help – Sudarshan Jul 30 '12 at 12:16