Android intent BOOT_COMPLETED is never launched on Samsung SM-T230 Kitkat 4.4.2 tablet

604 views Asked by At

I'm creating a HOME (android.intent.category.HOME) typed application which launchs another app as soon as the first one is launched. Up until now I've been using onResume() on the activity fragment, which was working great (meaning on other tablets with other Android version) until I tried it on an SM-T230 (Galaxy Tab 4 7" Wifi) which has Kitkat 4.4.2.

I don't know why but with that tablet the "BOOT_COMPLETED" intent is never fired. I've tried launching many different apps and with every single one of them happens the same thing. The aforementioned intent is never launched. Only after pressing back repeatedly and getting back to the HOME typed app it is launched (it must be done repeatedly since the app launches every time in onResume() the second app). If it is never launched by the system, the wifi service, tethering and many more will not function.

Interestingly if I omit the launch of the second app, the intent is fired.

I'm thinking on trying to launch the app as soon as the HOME app fragment becomes visible but I have no idea as of how to do it. Does someone has any idea on how to do that?

Also if you have encountered the same problem I would like to read your comments.

2

There are 2 answers

1
Storo On BEST ANSWER

The problem was that the second app was launched before the first android fragment is visible. To solve this problem I added a very small timer that launches the second app after it times out.

@Override
public void onResume() {
    super.onResume();
    ...
    getView().postDelayed(scheduleLaunch, 2000);
}

private Runnable scheduleLaunch = new Runnable() {
    @Override
    public void run() {
        if (isAdded()) {
            launchMainApp();
        }
    }
};
2
Dominik Suszczewicz On

Did you add permission?

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />