Edit:
I am facing an issue with a copied and modified Android app. The copied version does not seem to be recognized as an independent app. If both versions (the original and the modified copy) are installed on the same device and one app is running in the device's background, upon activity change, the original navigates to the copy and vice versa.
At this point, the log shows:
02-23 22:29:44.732 1619-1634/system_process W/ActivityManager: startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { cmp=com.example.packagename/.NameOfActivity (has extras) }
Has anyone experienced this issue? Any support is highly appreciated - Thank you in advance!
ORIGINAL (longer) version:
I am currently facing a major challenge with Android apps for the robot Pepper. I have developed an Android app (Kotlin), which we are currently testing. In the scenario, two users are sharing one robot.
To allow for a personalized experience for each user, but without an additional log-in, each user was provided with an individualized application.
The original Pepper Android app was copied and adapted for this purpose. In addition to the user name and account, the following adjustments were made:
- Change of package names (all places)
- Change of root name (settings.gradle)
- Change of the process name (manifest)
- Change of the application ID (Gradle)
All apps were each signed with their own key and can be installed on a robot at the same time - either directly from the laptop or via the Command Center. Therefore, I assumed that these two apps are now recognized as different. Using the apps also works without any problems as long as only one app (say App A of user 1) is open and the other (App B of user 2) is no longer running in the background.
However, if app B is still running in the background, the first activity change causes app A to lose focus and fade into the background, while app B comes to the foreground and continues exactly at the point app A was supposed to navigate to. App A then continues to run in the background. This leads to the user being addressed by the wrong name and their input data being saved incorrectly.
Measures tried so far to stop this behavior:
- Creating a new project and only copying content from the original app
- Refactoring all activities and layouts in app B
- Checking the routings between the activities (seems to be OK)
- Refactoring the dialog files for the robot (Qi-topics) as well as their identifier
Unfortunately, none of these things helped and the apps continue to show the same behavior. No broadcasts or similar are used in the code. When the app is swapped unexpectedly, the log shows:
02-23 22:29:44.732 1619-1634/system_process W/ActivityManager: startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { cmp=com.example.packagename/.NameOfActivity (has extras) }
We also investigated the matter with the robots manufacturer, who suggested this might be an Android issue rather than an issue with the robot, respectively its SDK. Has anyone encountered a similar issue? Any idea or solution is highly appreciated here!
I've also looked into a solution to programmatically force the app which is not in use out of the background, but Android restrictions made this difficult. I previously used the workaround System.exit(0) (which I know is not recommended), but this led to a whole bunch of unintended behavior.
If anyone knows of an alternative method to remove an Android app programatically from the system's background that I haven't considered so far, I am also open to try that out!
Thanks in advance!