Android Question Switch focus between two apps (Service)

ElliotHC

Active Member
Licensed User
I have two apps running.

1. Camera
2. Another App

When the volume up is pressed, I want to bring app 2 to focus.. It will run the code, then bring the camera to focus again until the next volume up event.

Does anyone know if this is possible?
 

ElliotHC

Active Member
Licensed User
This is my thinking...

My app is running a service which looks for a volume down.

The camera is currently running waiting for the volume down to trigger and take a video clip..

On seeing the volume down, my service waits for a period of time (enough to allow the slow motion video clip to be taken and file to be saved)

It then makes itself active which will run the code to do what it needs to with the files, then opens the camera again when it's done ready for the next video clip.

I'm trying this but the camera won't open.

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim Pm As PackageManager 'Phone library
    Dim Inte As Intent
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    For Each st As String In Pm.GetInstalledPackages
        Log(st)
        If st.Contains("camera") =True Then
            Inte=Pm.GetApplicationIntent(st)
            If Inte.IsInitialized Then StartActivity(Inte)
            Exit
        End If
    Next
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
It's clearly on the list.
upload_2019-8-11_10-2-32.png

calc opens just fine.
 

ElliotHC

Active Member
Licensed User
Didn´t you told in #1 of this thread that you have two apps running (i expect BOTH are YOUR Apps).
Didn´t you say in #3 that the camera app is started?
No, I just have two apps.. The default camera app and my app..

I'm pretty sure that I can everything working now but I need to know how to inialize and open the default camera app
 
Top