Android Broadcast Receiver after app install - android

I developed an app that receives the boot completed intent. From my tests I concluded that I must open the app at least once to start receiveing this intent.
Is this the correct behavior? If so, is there any way to start receiveing intents without starting my app at least once?
Thanks,
-George

The app must be opened before any code can be triggered, there is no way around this.

Related

listen to install of my app

I want to register gcm_id imidiatly after app was install or updated (as gcm_id may change over application or android id) to be able to send user news asap.
I can listen for broadcast android.intent.action.MY_PACKAGE_REPLACED if my package is updated. However broadcast for android.intent.action.PACKAGE_INSTALL is deprecated and does not seems to work (have not seen logs with such intent) and broadcast for android.intent.action.PACKAGE_ADDED is never send to newly installed application as stated in docs.
Is there a work around to listen, when my app is installed?
Is there a work around to listen, when my app is installed?
No. Nothing of your app will get control until the user clicks on the launcher icon for one of your activities, or until something else uses an explicit Intent to start up one of your components.
Please register for GCM on the first run of your app.

Receive Android GCM after restarting phone (without running related app)

I'm guessing this is a really rookie question, so I'm hoping someone can steer me in the right direction quickly & easily.
I have an app that receives GCM messages. The code that contains the GcmListenerService-derived class is located within my app. Because of this, the user MUST run my app after starting their phone in order for my listener to start listening (verified by restarting my phone, sending a test from Postman, and NOT getting the message / notification until I launch my app).
Do I need to create some type of service or something that will allow my app to get new GCM messages, even after restarting the phone (and not launching the app)?
Thanks!
Yes. You will need a broadcast receiver which listens on the BOOT_COMPLETED broadcast message and launches the push notification service. However, you still have to start the app once to register the receiver. It will also not work if the user force quit the app. There are some approaches, which also will restart the app automatically if the user killed the app, but I think it is a bad practice. In some circumstances the user wants to stop the app and keep it closed.

Need to perform some activity during the unistallation of an Android app

I am working on an app in which i need to log, if user uninstalls the app. So i am following this approach How can an app detect that it's going to be uninstalled?
But i am facing the same problem as in this post
Can't get receiver when the app uninstall. As my phone is Android 4.4... Can anybody post the exact solution (code) to solve this problem???
Edit: During uninstallation QUERY_PACKAGE_RESTART intent should be broadcasted but i am not recieving it. I declared it in manifest as well i created a broadcastreceiver which is listening for this intent... I did it exactly same way as Can't get receiver when the app uninstall. I am not receiving the intent. What to do?

Android broadcast receiver to get status of installation even app is closed

Hi I am working with android.Firstly I am not familiar with broadcast receiver. I need to create an app in which, if anyone installed my app a broadcast receiver will run which check the installation status like ACTION_PACKAGE_INSTALL and android.intent.action.PACKAGE_REMOVED
.But How can i get these status even my app is closed ?? Is it possible with broadcast receiver ?? Please help me, thanks in advance :)
basically, BroadcastReceiver can receives broadcasts even if your app is not in foreground, or even if your application's process is not alive.
this can be done by declaring the receiver within your application's Manifest.xml file
when you declare a receiver in the Manifest file - then the system would wake up your application and invoke your receiver if it set with the appropriate intent filter that responding to the broadcast that been sent (in your case - ACTION_PACKAGE_INSTALL and PACKAGE_REMOVED actions..)
but unfortunately there are also bad news for you:
from Android ICS and above - you cannot receive any broadcasts until you application launched explicitly by the user at least once!
this is due to security reasons Google decided is necessary, to prevent from malicious apps doing staff entirely transparent without the user launched them at all even once..
so the answer basically is - no! you can't perform any code and receive any events from your app until it launched at least once.
by the way - you wouldn't received ACTION_PACKAGE_INSTALL and PACKAGE_REMOVED broadcasts for your own app that been installed or uninstalled anyway.
by reading your question again, honestly I'm not sure what is that you expects to happend:
it is no make any sense to "check your application installed status" if it unistalled or not. after all - if it uninstalled - then it can't run (and perform any code) anyway.

Android BOOT_COMPLETED

I have a question concerning the BOOT_COMPLETED event.
I need a service to be running at all time (done via AlarmManager) but I wonder if I have to start the service manually the first time the application is installed as the BOOT_COMPLETED event is sent only after the device is restarted. How is this commonly handled, it seems like no one is having this problem, am I getting something wrong here?
the user should be the one deciding on if the service is running or not when its first installed and not you, so yes it should be started manually when they launch the app for the first time

Categories

Resources