Code to Create referral code concept in Android studio - android

I want to create a referral code concept app where each user joins the app by using another's referral code. During the registration of the app if he has the referral code the user will become the child of the owner of that referral code if he do not have the code he will be the parent and he will sends the referral code and invites the friends and they will join below him and so on I want to apply this concept to make a binary tree like structure in firebase. Can anyone give me the suggession of how to complete it
I have tried of adding the users to the firebase and if the referral code exists add him as the child and if code doesn't exist add him as the parent but I'm unable to create a tree structure with it

Related

Is there any way we can update the link added to the app in webview dynamically without updating the app?

I've been working on an app which displays a list of websites when click on it will be redirected to webview in the app itself, I'm unable to find a way how to update the links dynamically without updating the app. So, If I want users to interact with new links the new links should automatically be updated in the app without update and in the webview too. Is it possible to do that?
You should use firebase remote config feature, which best fits in your case.
Firebase Remote Config is a cloud service that lets you change the
behavior and appearance of your app without requiring users to
download an app update.
Well to do that you first need to create a project in firebase console
In remote config feature you can add data in key-value pair. Like in this image:
I have added two key-value pair, as can add as much as you want. Now in the app side you have to add dependency:
implementation ‘com.google.firebase:firebase-config:11.8.0’
And to fetch the values which you have added in firebase, you can easily get those url but first you need to follow some steps to do that. You can check this simple tutorial.
Note: To get the values from firebase remote config you must need to click on publish changes button(Which you can see in above image top right corner).
You can store that link to a server and return that link when the app hits a certain API of that server. But for doing that, you need to setup a server, build a server application if you haven't already. Which is a lot of work for just storing a website link.
Another option could be, you can use services like http://bit . ly and create a custom link from that service, like http://bit . ly/my_specific_domain and use this link in your app. When you need to point to a different website, you can just update where http://bit . ly/my_specific_domain redirects to.
But you best bet would be to use Firebase Remote Config, which is both reliable and easy to implement, but that is already described in previous answer.

Creating groups with Firebase Realtime Database in Android app

I have an Android app that uses the Firebase Realtime Database. At the moment it is a single user app, in that when a user logs in, using Firebase Auth, the data they create is kept private to them. What I need to do for the next phase of the project is to allow for the creation of teams or user-groups that have access (read and write) to the data currently created by a single user.
The database structure and rules for doing this are understood, however, the issue I have is how to create the groups.
I did find the following blog and it is very close to what I need, it does not make clear how a new user would create the pending membership entry in a specific "chat" (this is a group chat sample).
https://firebase.googleblog.com/2016/10/group-security-in-firebase-database.html
Any points on resolving this final issue would be much appreciated.
Sid
Just simply create groups like below
|--Groups
|---group1
|-----uID1 - owner
|-----uID2 - participant
|-----uID3 - participant
..............
follow this https://firebase.googleblog.com/2016/10/group-security-in-firebase-database.html link. There are example groups and rules. It will help for u to proceeds it.
Follow this https://firebase.google.com/docs/database/ios/structure-data to make good structure of data to increase performance

How can I create my own user-code authentication on firebase in android app?

I'm trying to build android application uses firebase server, I would like to add an authentication to the application, I have searched a lot in the internet, all firebase authentication examples are using google/email/..
But none is using own authentication, what I want to do is:
I will initialize all users data in firebase with unique "id" for each user (no sign up/registration from user)
I will give each user his private unique "id" I initialized for him
User will enter in the application the "id" I gave him - app should check if there is any user with this "id" or not and behave accordingly.
I did the first 2 steps, I have no idea of how to do the third one.
I know how to initialize firebase and iterate over user, but this will be enough ?
How can I gain such an authentication ?
Any help is appreciated
Please forgive my lack of knowledge.
Thanks a lot

Forwarding A User To A Particular Chat Room Using Firebase

Similar to this question. However, I am looking for a way to add a token to the invitation link so that an android application can read such said token and then "automatically" join that user to that particular chat room. However, I haven't found example in a repo or the docs. So how if possible can I achieve this goal? Is invitation links the best way to achieve this?
You can pass a URL to your dynamic link with setLink(url). This URL is passed to your application when/after the user has installed that and it is up to your application to call getLink() and then interpret the URL. You can see an example of handling the link in the Firebase documentation.
So if your chat room has a unique ID (if you're using the realtime database, typically that'd be the key that you use in the JSON), then you'd include that key in the link/URL.
Note that the user might also open the URL in a web browser. So it's best to ensure that it's a complete URL that resolves to a reasonable web page for the chat room. That URL would still include the key of the chat room, so that it works both on the web and in your Android app.

How to validate new install using Firebase Invites

I done all the implementation of Firebase Invites in my android app through Firebase invites.
If new user(device) install my app through Firebase Invite, I will give some credits to that user.
Here:
- How is validation done for user who has already installed the app?
If the validation is not done from Firebase end then is there any way to do it??
Do I have to generate my own reference code or will it be generated by firebase?
See documentation here :- https://firebase.google.com/docs/invites/android
You will get appinvite id which is auto generated by the firebase and its upto you,how you use it.
You can save this id in the database such that it will saved in both profile
,invited person profile and the person who invites such as you will access these ids easily inside the database.
Or put id as a key and put both person proile id inside it.
Hope this will help!!.

Categories

Resources