Android Question Questions on intent

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
Hi

2 questions on intent:

1. Is there a way to determine if intent I called is still running or ended?
How?

2. My app calls intent, is there a way that intent will return data to my app?

Thanks

edit:
can any simple app run from another app?
i want my app to load another app (also mine) and wait in background until the loaded is done
as simple as that
whatever i try i get error that the second app is not found - it is installed on the phone...
it does not have to intent - any other way to load and run the second app will do
this is the code

B4X:
    Dim MyIntent As Intent
    Try
   
       MyIntent.Initialize(MyIntent.ACTION_VIEW, "")
        MyIntent.SetType("MyAppName")
        StartActivity(MyIntent)
       
    Catch
        Log("error: " & LastException.Message)
    End Try
 
Last edited:

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
gotch!
problem solved
managed to run the second app

now i just need to know if it is still running or ended

should i loop and wait for some time or is there a way to detect if it is still running and freeze until it ends?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
and this is the solution that works for me

B4X:
    Dim pm As PackageManager
    Dim in As Intent

    Try
        in.Initialize("","")
        in=pm.GetApplicationIntent("AppName")

        If in.IsInitialized Then
            StartActivity(in)
        End If
    Catch
        Log("error: " & LastException.Message)
    End Try

appname is NOT the app name shown in launcher, it is the package name like com.blabla.bla etc...

now just the waiting and i'm done...
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
You should expect App A can be killed by Android while still working with App B if android decide to do so.

You can send an intent to App A if App B finished to tell App A the finishstate
I don´t know any other way to "wait".
Oops, never thought of android killing my app...
App B will be running for max 1 minute and in most cases much less.

Is there a way to set my A app as one that may run in background in installation?
Maybe through the manifest? (how?)
I don't want the user to bother with it...

And how B tells A it finished?

Thanks
 
Upvote 0
Top