I am developing an app, in that i want to give an option for users, to invite friends, for installing this app. I am not getting how to do that.
If anyone have any idea please tell me.
You can implement this feature using App Invite option offered by Firebase.
Send and Receive Firebase Invites from Your Android App
This will help you in achieving your app sharing functionality easily.
Below are the steps that you will need to implement.
1. Add the dependency for Firebase Invites to your app-level build.gradle file:
compile 'com.google.firebase:firebase-invites:9.4.0'
2. Send invitations on button click :
private void onInviteClicked() {
Intent intent = new AppInviteInvitation.IntentBuilder(getString(R.string.invitation_title))
.setMessage(getString(R.string.invitation_message))
.setDeepLink(Uri.parse(getString(R.string.invitation_deep_link)))
.setCustomImage(Uri.parse(getString(R.string.invitation_custom_image)))
.setCallToActionText(getString(R.string.invitation_cta))
.build();
startActivityForResult(intent, REQUEST_INVITE);
}
You can customize your invite further by referring the above link.
Related
I have to implement Invite and Earn functionality in my Android application.
What I have to do is : User can share the link to anyone on social media,
On receiving the link, another user can click the link to get the application installed using that link.
After the user installs the app using that link, the sender or the invitee can be rewarded. How this can be possible ?
So far, I go through the Firebase's Dynamic Link concepts and found some demo. But, still confused in it.
Can you please guide me what another stuffs I have to gone through to achieve such thing ?
Is it possible in react-native. If not then How can I achieve that in Android ?
Thanks
You can Integrate Refer & earn in your react native application using react-native-branch
Just following the documentation of integrating branch.io in your react-native application and you will be good to go.
Documentation for react-native-branch
Here is also a github example for your reference Example
Since you have already gone through firebase, therefore it would be easy for you to use the procedure based on the same.
Here's the roadmap for getting started
Set Up
Follow the Initial Setup Guide to configure adding the project to Firebase
Configure the android/app/build.gradle and MainApplication.java to add the firebase dynamic links
Configure the Firebase invites package
If you haven't configured deep link , take a look at this tutorial
Usage
SendInvitation Component
import firebase from 'react-native-firebase';
const title = 'Demo Firebase Invites'
const message = 'You have been invite to join the xxxxx app'
const invitation = new firebase.invites.Invitation(title, message);
invitation.setDeepLink(// Your App's Configured deep link)
invitation.setCustomImage(// Image Uri)
invitation.setCallToActionText(// Set the text on the invitation button on the email)
// ... On some button click
sendInvitation = async () => {
const invitationIds = await firebase.invites().sendInvitation(invitation)
// Invitation Id's can be used to track additional analytics as you see fit.
}
Handle Receive Invitation
Either use getInitialInvitation method or listen for invitations using the onInvitation listener.
At the root of your app you can add
import firebase from 'react-native-firebase';
firebase.invites()
.getInitialInvitation()
.then((invitation) => {
if (invitation) {
// app opened from an Invitation
// Set the rewards points here and update data in your firebase
} else {
// app NOT opened from an invitation
// No rewards for this user
}
});
The invitation contains the following objects which will help you with the queries on updating the sender reward points.
deepLink: string
invitationId: string
You can route to specific page using the deep link, and also get custom data passed from the invitee such as a random userId to create the user on the firebase.
Use invitationId to query other stuff.
For implementing this feature developers need to learn App links. And For implementing this you can use react-native-deep-linking.
I am giving you a little overview, You need to add some XML in the manifest file for android according to your needs and you will handle it using linking.
I've just started out and I'm following this tutorial
https://www.dropbox.com/developers/documentation/java#tutorial
But there's no login. Nothing asks you for a username, password. That means I can't actually get a GUI that every app with "Share to Dropbox" option has.
Am I stuck with one account? Do I have to find a way to get a person's ACCESS_TOKEN or is there a more elegant GUI solution out there(like with Google Drive and their intentsenders)?
To use the Dropbox API v2 in Android, you should use the API v2 Java SDK. There's an example Android app that uses it included with the SDK. You should refer to that as an example of how to implement the app authorization flow, which is accomplished via OAuth 2. That requires the user to authorize your app with Dropbox, by signing in to Dropbox if necessary. After that, your app can store and re-use the resulting access token for that user, as the example does here.
Implementing it that way allows any user to connect their Dropbox account to your app. You can also handle multiple accounts per instance of your app if you want.
Unfortunately, there isn't much out there in terms of documentation for this flow. Here is how I was able to successfully authenticate users. First, you want to launch the authentication flow with Dropbox's auth activity:
import com.dropbox.core.android.Auth
....
Auth.startOAuth2Authentication(context, context.getString(R.string.dbx_api_app_key))
After a user has successfully authenticated, call the following method in the onResume method of the activity you started the Dropbox activity from:
#Override
public void onResume() {
super.onResume();
String token = Auth.getOAuth2Token()
}
The token that you receive here should be used when you create your instance of the DbxClientV2 like so:
DbxRequestConfig requestConfig = DbxRequestConfig.newBuilder(MyUtils.getVersionText(context))
.withHttpRequestor(OkHttp3Requestor(OkHttp3Requestor.defaultOkHttpClient()))
.build()
DbxClientV2 dbxClient = DbxClientV2(requestConfig, accessToken)
You'll also need the following dependencies in your build.gradle file:
implementation 'com.squareup.okhttp:okhttp:2.7.5'
implementation 'com.squareup.okhttp3:okhttp:3.7.0'
I am working on a new android app and I want to integrate the 'Invite Friends' from fb in order to invite them to use the app. I have added the required code in the app, I've also created the app in the developer portal from Facebook, but users are not getting the notification if I share it.
I tried to also add the user in the settings -> tester users and yet no notification for them.
Can someone help me on this? I over searched the internet, but I could find an answer on this.
Code used for opening the sharing dialog:
private void InviteFriends()
{
if (AppInviteDialog.CanShow())
{
var content = new AppInviteContent.Builder()
.SetApplinkUrl(Resources.GetString(Resource.String.app_url))
//.SetPreviewImageUrl(previewImageUrl)
.Build();
AppInviteDialog.Show(this, (AppInviteContent)content);
}
}
Thank you in advance,
Alex
we are using facebook unity sdk game requests on android.
when someone clicks a game request in their facebook notifications
they switch to the game or the app store page (if it's not installed)
when the game runs, we call FB.GetAppLink(DeepLinkCallback)
however, we receive empty url.
anyone knows how to achieve this ?
Thanks.
Full code:
void AfterInit(){
FB.GetAppLink(DeepLinkCallback);
}
void DeepLinkCallback(IAppLinkResult result) {
Debug.Log("app url = "+result.Url);
}
Update:
Sorry For posting the same code. I have a question for you.
Is your app life in the store and linked to Facebook developer profile correctly? If is in test mode it can fail.
However I believe that the ID you need to send in-app invites is the app ID from Facebook developer profile.
(check the image)
Facebook developer profile
the example code for the in-app invites is this
FB.Mobile.AppInvite(
new Uri("https: // fb. me/810530068992919"), //the ID
new Uri("http://i.imgur.com/zkYlB.jpg"), // optional image
AppInviteCallback //callback function
);
Hope that this can solve your issues.
Thanks.
I have imported the Facebook Demo into netbeans and followed the guidelines as mentioned in the developer guide and as well as set required facebook permissions. But I'm failing to share the text on to the wall, where as am able to retrieve friends list, profile info and news feed.
final ShareButton share = new ShareButton();
final TextArea t = new TextArea(" This is sample text from using CodenameOne api");
t.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
share.setTextToShare(t.getText());
}
});
c.addComponent(BorderLayout.CENTER, t);
share.setTextToShare(t.getText());
Is there anything which im missing to integrate or set any additional permissions?
You need to be clear if this is in the device or in the simulator. On iOS/Android the native share functionality is used and the behavior is very different from the simulator.
Facebook recently made changes to the way permissions work and essentially blocked support for non-iOS/Android platforms. This still worked after the blocks but its possible that it stopped.