Passing data with app installation invitation

Hello all.
I’m developing an app with Ionic v6 + Angular in which a user invites his friends to install my app from the app store (Google Play / Apple Store).
The person inviting will enter the phone number of the invited friend, and I need to identify this phone number in the app after it was installed by the invited friend (so that I can link the two persons in my FireBase DB).
I would appreciate some guidance on how to pass over this parameter (phone number) to the receiving device and to be able to read it once the application is installed and run for the first time.

I thought of adding the phone number as a URL string parameter that will be opened in the device’s browser, and there will be a button to install the app (action to the app’s installation link in the App Store). However, I still need some sort of a shared storage accessible by both the browser and the app so they can write/read this data.
What are my options here?
Thanks!

I would be very leery of using phone numbers here for privacy and persistence reasons. What I would do is to totally decouple this linking from the app installation process, and instead emulate something like the meeting URL sharing feature of videoconference apps, in which one user asks your server for a meeting room token that they can then share with others. All the downstream responses with the same token can be linked as friends in your user database, no personal information is leaked, and you don’t have to worry about what happens when phone numbers change.

Hi rapropos and thank you for the advice. Good point!
However, I want to make sure we’re on the same page.
This is not for an ad-hoc meeting (session) (they may engage in such sessions later, throughout their lifetime in the app).
All I need at this point is to know who was the referrer. When the invited friend installs the app and opens it for the first time, I want to be able to show a message: “I see you were invited by Johnny to be on his friends list” (and of course, maintain this referral connection in the DB).
Following your advice, I’m OK to store the phone number in the DB and have some other token sent over, but my original question remains: how do I pick up this token upon installation and first run of the app on the invited friend’s machine?

While you wait for better answers, my suggestion is to delegate the mechanics of token exchange to your users. Alice, from within the app, asks for an invite token. She gets a small random string cookie or a URL and shares it with Betty via whatever means she likes - SMS, email, printed. Betty installs the app and is initially friendless. She uses a “redeem a friend” feature within the app, enters her code, and the database knows that code got generated by Alice and redeemed by Betty, so it can link the two as friends at that point.

Thank you rapropos.
Yes, if Betty proactively “redeems a friend” then there’s no problem at all :slight_smile:
I am trying to avoid her active involvement!
If it was a desktop application, I’d just store a text file in the Windows %TEMP% folder containing the token as extracted from the URL string params. But I can’t come up with a way to do this on the mobile device.

hello, were you able to solve this? if so how??

There is no way to get current device’s phone number (objective c - How to get own mobile number from the iOS Device programmatically? - Stack Overflow). This is iOS policy. So you should use different way just like @rapropos proposed.

Or you can get contacts list after receiving permission from the user (Permission dialog will be opened, and user can deny), and look through whether there is someone who invited him. For getting contacts list check this plugin (GitHub - capacitor-community/contacts: Contacts Plugin for Capacitor).

But it still seems not working for your case, because there is no way to store phone number of the person sending the invitation.

Please check other applications’ UX that has similar inviting feature (e.g Clubhouse).