iOS Question Merge two apps in B4i

Tecnoswitch

New Member
Good morning,
can someone help me to solve my problem?
In B4A I used StartActivity() to link two different App, but in B4i there isn't StartActivity().
What method or instruction should I use to merge the two apps?
Thanks a lot
Vincenzo
 

Tecnoswitch

New Member
Hi Erel,
I tried with your solution but it doesn't work.
I have two modules (Main and Main_2 associated with the two apps).

In Main:

#UrlScheme: Main_2

#QueriesSchemes: Main

Private Sub Button1_Click
If Main_2.App.CanOpenURL("Main://") Then
Main_2.App.OpenURL("Main://")
End If
End Sub

In Main_2:

#UrlScheme: Main

#QueriesSchemes: Main_2

Private Sub Button2_Click
If Main.App.CanOpenURL("Main_2//") Then
Main.App.OpenURL("Main_2//")
End If
End Sub

I have made some errors?
Thank you so much for your help.
 
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
You should be using the Package ID which is defined in Project->Build Configurations for this not the function name.

So App1, the package id is b4i.example
App2 the package id is b4i.example2.

This is what is used from App1 to start App2.
 
Upvote 0

Tecnoswitch

New Member
I'm trying but no results.
I used the package ID instead of the module name, leaving the two apps separate, as suggested but nothing.
I am not an expert.
I don't use the Main function, it must be declared, how?
Help me
Thanks
 
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
Here is a sample project which create 2 apps which will be an example.

1637849074646.png


How to use:

Stage 1
Set the build configuration to callee
1637848557337.png


Use Tools->Build Server -> Build release app

The Callee app should be installed on your device.

Stage 2
Set the build configuration to calling
1637848736052.png


Compile.

When run you can click on the button which will start the Callee app.
 

Attachments

  • Callingbetweenapps.zip
    8.9 KB · Views: 110
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
Caller and callee are Build configurations which allow me to create 2 apps from one source code.

see this:


Build configurations are available in all IDE's.
 
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
1638177218115.png


1638177243794.png



B4X:
#if Calling
    #ApplicationLabel: Calling another Example App
#else if callee
    #ApplicationLabel: Called example App
#End If

B4X:
#if calling
    #QueriesSchemes: uk.co.digitwell.app2
#Else if callee
    #UrlScheme: uk.co.digitwell.app2
#end if

B4X:
private Sub b4xpage_appear
    #if calling
    xui.MsgboxAsync("Click on the button to start the second app","")
    #else if callee
    xui.MsgboxAsync("I am the second app.","")
    
    #End If
    
End Sub

'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.

Private Sub Button1_Click
    #if calling
    If Main.App.CanOpenURL("uk.co.digitwell.app2://") Then
        Main.App.OpenURL("uk.co.digitwell.app2://")
    End If
    #else if callee
    xui.MsgboxAsync("Start the other app","")
    #end if
End Sub
 
Upvote 0
Top