Run program immediately after booting in android? - android

I need to know why my app didn't run immediately after booting in android real phone? My app run but after a few second.

First, you should make sure that your app has been installed in phone memory for your receiver to receive boot completion broadcast, As this broadcast occurs before media scanning.
just add an attribute to manifest file's root element
installlocation = "internalOnly"
rest is same as explained above.

Related

Android NFC enableReaderMode stopped working; needed to delete and reinstall app?

We have an app utilizing NFC and recently migrated from enableForegroundDispatch to enableReaderMode. Since then, we have been receiving bug reports where the user intermittently has trouble scanning tags.
I was troubleshooting remotely with a customer today who was unable to scan any tags (the app was working through yesterday). Sometimes they would receive an "NFC read error. Try again" message.
When we had them install the older version of our app which uses enableForegroundDispatch, NFC scans worked as intended. Scanning using the NFC Tools app was also working during this time, as was scanning with no app open. We tried rebooting the device and also toggling NFC on / off with no luck. It was just our app.
After much debugging, what appears to have resolved it was to fully delete our app from the device and then reinstall it. The device is a Google Pixel 2 running Android 11.
I have read countless threads about enableReaderMode and am also aware of this bug affecting kiosk apps in Android 11 (but our app isn't a kiosk). I also read about how there is a bug where Android might think our app is not in the foreground.
Is there any credence to the theory that deleting our app (vs. updating the same installed package with different builds) is what resolved this, and if so then what exactly is happening that is causing this?
Edit: I just found the threads about "NFC service dead" and am guessing this is what happened.
I have read the public code for NFC service, I cannot remember it having anything that would be affected differently by update vs uninstall/install other than possibly the Manifest(PackageManager?) permission to use NFC.
I have not looked in to details about how an app update updates the Manifest permissions, but guess an update might not update the permissions if it thinks they are not changed whereas remove/install would probably delete the whole entry and re-add it thus if there was corruption in the permission list a remove/install would likely fix it.
Also if the NFC Service is dead then other App's would not scan as well. I do seem to remember there is something in there to restart the NFC service if it had died.

Android / Cannot start app at boot on certain devices (e.g. Xiaomi)

I followed all the guidance found on SO to autostart app at boot time.
In my manifest, I have set the right permission (RECEIVE_BOOT_COMPLETED) and also declared my broadcast receiver: .BootReceiver picking up Android.Intent.Action.BOOT_COMPLETED.
I also launch my service in BootReceiver, this is very straightforward stuff.
The thing is, my app starts at boot time on certain devices (I hope most devices) but not on some of them. I have a Xiaomi phone that gives me the following error at boot time:
"Unable to launch app com..example/10120 for broadcast Intent {act=android.intent.action.BOOT_COMPLETE flg=0x8000010 (has extras) }: process is not permitted to autostart."
I am surprised to see this message, because I can see that the list of permissions includes running at startup.
There must be a way, because Whatsapp for instance is launched at boot time.
Any clue would be highly appreciated.
Same here. I tried to delete the file in the SD card ( but the system direct to internal storage ) by using the permission WRITE_EXTERNAL_STORAGE, and get the similar message from log-cat. Maybe it can be fixed by rooting the xiao-mi mobile, that's what I searched from the Internet.

Android Boot Completed Receiver doesn't work on system app

My application contains a BOOT_COMPLETED receiver like described in other threads here. It works perfectly until I changed my app into a system application. Now the Receiver does not trigger the event anymore.
Any ideas for this issue? I'm using Android Kitkat 4.4.2 on a Radxa Rock Pro. Compiled my own image to register the app as system application.
we need more detail to help you, post the code and the manifest, also debug log, in other hand you must use Log.i(TAG, "onReceive."); to know if the problem is in onReceive() or when trying to run the service class.

Change intent filter android priority of other applications

I have a SMS Blocking Android App. It worked fine until Google introduced SMS feature in Hangouts and so did Samsung in its ChatOn messenger. Both of them have the highest priority for SMS receiver ie 2147483647. I verified this from their manifest.
So is there anyway to decrease their SMS receiver priority using what so ever method including root?
I plan to implement a "click to fix" option after a user opens the app.
The only way I could think of doing this was to edit the manifest file of these applications.But again I am not sure how android processes the Broadcast receiver. Does it use its own internal memory to know which app will process the sms received broadcast, or does it read the manifest file of all the installed applications every time?
If there is a separate memory how can I access it(using root, if required) and if manifest file is read every time, is it possible to edit that file even with root, as I read there are signature related issues.
P.S In root programming i have just experimented with calling standard sudo commands inside an app. Also my main focus is on pre Kit Kat devices.

How to get the log of apps that get started after starting the android device ?

I am trying understand some concepts about android device startup ,I want to know that is there any way that I can get a log of applications that get started on device Boot-up ? How can we get that ?
I also want to know that, Is it possible to write an application that gets started at first after boot-up and stop certain apps from getting started on boot-up ?
Is there any IntentService that we have to write ? or this is not feasible unless we have root access ? Please help me in understanding this concepts.
The device log is kept in a buffer, so the most recent entries will be there. If you are early enough before the buffer gets overwritten you will get it since the device booted.
You can access it using
$ adb logcat

Categories

Resources