Android Question Open another App

jvrh_1

Active Member
Licensed User
Times ago, I could open external applications in my apps with the following code, but now this code does not work. In the logs nothing appears but the app does not open.

B4A:
    Dim in As Intent
    Dim pm As PackageManager
    in = pm.GetApplicationIntent("com.oplus.ocloud")
    If in.IsInitialized Then StartActivity(in)

I have checked the package name and It is correct.
The app is this one (is about my externa camera): https://play.google.com/store/apps/details?id=com.langshixing.cloudhome&hl=es_419&gl=US&pli=1
I do not want to manage it. Only open it. Like a shortcut. Any idea? any permission? I do not remember how get to work it in the pass. Thank you.
 

jvrh_1

Active Member
Licensed User
Put this line in manifest and check if works:
B4X:
AddManifestText(
<queries>
    <package android:name="com.oplus.ocloud" />  
</queries>
)
I added this and does not work. Pero...

If I write this, appear a error in the log:
B4X:
    Dim i As Intent
    Dim pm As PackageManager
    i = pm.GetApplicationIntent("com.oplus.ocloud")
    StartActivity(i)

java.lang.RuntimeException: Object should first be initialized (Intent).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:67)
.
.
.


And if I use:
B4X:
    Dim in As Intent
    Dim pm As PackageManager
    in = pm.GetApplicationIntent("com.oplus.ocloud")
    If in.IsInitialized Then StartActivity(in)
    StartActivity(in)

Nothing appears...

I do not know. Any idea? Thanks.
 
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
Is this not the package name?

com.langshixing.cloudhome
 
Upvote 0

jvrh_1

Active Member
Licensed User
Times ago, I could open external applications in my apps with the following code, but now this code does not work. In the logs nothing appears but the app does not open.

B4A:
    Dim in As Intent
    Dim pm As PackageManager
    in = pm.GetApplicationIntent("com.oplus.ocloud")
    If in.IsInitialized Then StartActivity(in)

I have checked the package name and It is correct.
The app is this one (is about my externa camera): https://play.google.com/store/apps/details?id=com.langshixing.cloudhome&hl=es_419&gl=US&pli=1
I do not want to manage it. Only open it. Like a shortcut. Any idea? any permission? I do not remember how get to work it in the pass. Thank you.
Works! I have changed the packagename to com.langshixing.cloudhome (thanks @mcqueccu) and added to the manifest editor "package android:name="com.langshixing.cloudhome" (thanks @asales). If I only do one of them, It does not work. Really thank you!
 
Upvote 0
Top