Difference between PreferenceFragment and Activity on startactivity Android

368
July 28, 2017, at 08:55 AM

I have the following situation: An application A that have a service A call another application named application B. This second application listen the service A to execute some task. The application B is called inside of a PreferenceFragment from application A with the follow piece of code:

Calling Application B

Intent launchIntent = getPackageManager().getLaunchIntentForPackage("applicationB.package.name");
launchIntent.putExtra("AGENTE", "MANUAL");
if (launchIntent != null) {
    startActivity(launchIntent);//null pointer check in case package name was not found
}

This code works perfectly and the application B starts to run in front of application A. The problem occurrs the the service A send a broadcast, the application B receive the message from service A but the application A goes to front of application B. The same situation, but calling application B from an Activity class this comportment don't occurs . How can I prevent this behavior when using a PreferenceFragment?

Rent Charter Buses Company
READ ALSO
cancelAlarm method not actually canceling my AlarmManager

cancelAlarm method not actually canceling my AlarmManager

I have used this cancelAlarm method from another reputable answer on stack, and it isn't getting the job done, and I am out of ideas of why this isn't working

313
Connecting database using PHP with some other way in android

Connecting database using PHP with some other way in android

Okay so I have already achieved the above task, but I am not satisfied with itIt looks very complex

222
AVD Emulator ERR_CONNECTION_REFUSED after API forces TLS 1.1 and higher

AVD Emulator ERR_CONNECTION_REFUSED after API forces TLS 1.1 and higher

I have an application that consumes a third party API and all was working well till this week when the third party started enforcing TLS 11 and higher

2447
Run time issue while detecting a fall

Run time issue while detecting a fall

I have a OnSensorChanged method makes an issueI'm trying to find the fall

252