Branch IO generate link show in Quick Links Dashboard - android

Android Platform
i use below code to generate and share the link in Facebook etc, and click it, it has record in " Summary ", but not show in Quick Link Dashboard.
val lp = LinkProperties()
.addControlParameter("\$deeplink_path","https://www.google.com")
val buo = BranchUniversalObject()
.setCanonicalIdentifier("item/abcd")
.setTitle("Hellow Title")
.setContentDescription("Hello Description")
.setContentIndexingMode(BranchUniversalObject.CONTENT_INDEX_MODE.PUBLIC)
.setLocalIndexMode(BranchUniversalObject.CONTENT_INDEX_MODE.PUBLIC)
buo.generateShortUrl(
activity, lp
) { url, error ->
if (error == null) {
// share intent
} else {
Logger.e("error: ${error.message}")
}
}
Using the code, this cannot show in the Quick Link Dashboard.
About the doc, it need add two params "type:2" and "$marketing_title", i set it to LinkProperties:
lp.addControlParameter("type", "2")
.addControlParameter("\$marketing_title", "android _test")
Or: BranchUniversalObject:
buo.setContentMetadata(ContentMetadata().addCustomMetadata("type", "2"))
.setContentMetadata(ContentMetadata().addCustomMetadata("\$marketing_title","android"))
But it not work, so, how to solve?
Thanks!

By default, your SDK-created links will not be visible on the Quick Links Dashboard. The specification of passing type:2 and setting a marketing title in the request payload is limited to API-created links only.
Understanding that you'd want to check the conversions, it is highly recommended to tag these branch links (e.g. channel = API/campaign=Promo) so that you can segment your data to see all installs/clicks from links created via the SDK on the Branch Dashboard Sources/Summary section.

Related

DynamicLinks.API is not available on this device [duplicate]

With normal installed apps it's possible to use the technique of Deep Linking in order to not only open a specific application from an URL but also to redirect it to a specific section/function such as a specific Facebook post or specific coordinates on a map.
Since I've read that with Instant Apps this won't be possible because links already point to the specific module to download and run, how would it be possible to access not only the said module but also pass it some parameters?
For example:
This is the link from which the view-only module of my map application will be downloaded: "www.myinstantappexample.com/onlyviewmap"
If I want it to point to a specific set of coordinates how would the link be composed?
Will it be like this: "www.myinstantappexample.com/onlyviewmap/?x=0.000&y=0.000" ?
From what I've been able to find google doesn't cover this aspect and I really can't wrap my head around it.
If I want it to point to a specific set of coordinates how would the link be composed?
It's up to you how to include any additional info in the URL. It could be via URL parameters or in the path itself. Eg.
https://www.myinstantappexample.com/location/2/user/5
https://www.myinstantappexample.com/onlyviewmap/?x=1.2&y=3.4
You then parse the URL in the receiving Activity. The Uri class includes a number of helper methods such as getQueryParameter() and getPathSegments() to make this easier.
For example, to parse this URL:
https://www.myinstantappexample.com/onlyviewmap/?x=1.2&y=3.4
You would do something like this in your Activity:
Uri uri = getIntent().getData();
String x;
String y;
if (uri != null) {
x = uri.getQueryParameter("x"); // x = "1.2"
y = uri.getQueryParameter("y"); // y = "3.4"
}
if (x != null && y != null) {
// do something interesting with x and y
}
Instant Apps and Deep Linking
Instant Apps rely on App Links to work, and App Links are just one type of deep link. So deep linking is still possible for Instant Apps, and is in fact absolutely critical to how they function. However, URI scheme deep linking (which is still very prevalent in Android apps) is not supported.
The difference between a regular app and an Instant App is that the device will only load a single Activity in response to the App Link the user clicks, instead of needing to download the full package through the Play Store. It's a more seamless experience for the user, but the underlying technology works the same way.
Passing Custom Parameters
If the user clicks an App Links-enabled URL like http://www.myinstantappexample.com/onlyviewmap/?x=0.000&y=0.000, you will get that entire string back inside the app after it opens. You'll have to parse out the x and y variables yourself, but they will be available to you. Something like this:
Uri data = this.getIntent().getData();
if (data != null && data.isHierarchical()) {
String uri = this.getIntent().getDataString();
Log.i("MyApp", "Deep link clicked " + uri);
}
You'll just need to manipulate the uri value to find what you need.
Alternative Approach to Custom Parameters
Alternatively, you can use Branch.io (full disclosure: I'm on the Branch team) to power your links. We have full support for Instant Apps, and this allows you to work with a much more friendly data format. We let you create links like this, to control every part of the behavior:
branch.link({
tags: [ 'tag1', 'tag2' ],
channel: 'facebook',
feature: 'dashboard',
stage: 'new user',
data: {
x: '0.000',
y: '0.000',
'$desktop_url': 'http://myappwebsite.com',
'$ios_url': 'http://myappwebsite.com/ios',
'$ipad_url': 'http://myappwebsite.com/ipad',
'$android_url': 'http://myappwebsite.com/android',
'$og_app_id': '12345',
'$og_title': 'My App',
'$og_description': 'My app\'s description.',
'$og_image_url': 'http://myappwebsite.com/image.png'
}
}, function(err, link) {
console.log(err, link);
});
In return you get a URL like http://myappname.app.link/iDdkwZR5hx, and then inside the app after the link is clicked, you'll get something that looks like this:
{
tags: [ 'tag1', 'tag2' ],
channel: 'facebook',
feature: 'dashboard',
stage: 'new user',
data: {
x: '0.000',
y: '0.000'
}
}
In order to do that, you have to use the "app links assistant" in
Tools->App Links Assistant
Then check your links and, in the Path selector, check that the "pathPrefix" option is selected.
Then at the bottom of the OnCreate method of your activity (which is related to the link you recently edited) add this code:
Intent appLinkIntent = getIntent();
String appLinkAction = appLinkIntent.getAction();
Uri appLinkData = appLinkIntent.getData();
// then use appLinkData.getQueryParameter("YourParameter")
You can test and debug this, using the "editConfigurations" option, just open that window and edit your instantApp module (the one launched with the Link you recently edited) and in the URL field add the URL parameters that you need. (then just run that module :D )
Hope this to be helpful.

generate identical links on different devices with Branch.io

Is there any way generate identical links on different devices with Branch.io?
What I mean:
In the application I have post. I want to share this with friends. I click to share on one device and get a link
Then I want to share the same post from another device. I get the second link. They differ. But I need them to be the same.
If you use the exact same parameters to generate the link on both the devices it should generate the same link. If even one of the parameters you add to link is specific to the user/device etc. the value you provide for the Branch link will be different and hence a new link will be generated.
Also, if you are using setIdentity() in your application each link created will be tagged with the user Identity and hence will create a different link each time.
For example:
final BranchUniversalObject branchUniversalObject = new BranchUniversalObject()
.setCanonicalIdentifier("1234")
.setTitle("Test for link")
.setContentIndexingMode(BranchUniversalObject.CONTENT_INDEX_MODE.PUBLIC)
.setContentDescription("Your friend has invited you to check out my app!")
.setContentImageUrl("https://upload.wikimedia.org/wikipedia/commons/thumb/5/5a/Branch_Metrics_logo_color.png/1200px-Branch_Metrics_logo_color.png")
.addContentMetadata("var1", "abc")
.addContentMetadata("var2", "def");
LinkProperties linkProperties = new LinkProperties()
.setChannel("App")
.setFeature("Sharing")
.addControlParameter("$android_deepview", "branch_default");
branchUniversalObject.generateShortUrl(this, linkProperties, new Branch.BranchLinkCreateListener() {
#Override
public void onLinkCreate(String url, BranchError error) {
if (error == null) {
Log.v("url",url);
}
else {
Log.v("url",url);
}
}
});
The above will always generate the same link on any Android device. But is I am using Branch.getInstance().setIdentity(user_id) in my Android App it will generate a new link even if all the link parameters are the same.

Facebook iOS/Android SDK share link on friend's feed

I'm working on a game that runs on iOS, Android and Web. On the Web client I can set up a feed dialog that let's a user post on a friend's timeline:
That's achieved by using this code:
var params =
{
name: name,
link: link,
picture: picture,
caption: caption,
description: description,
actions: actions,
properties: properties
};
params.method = 'feed';
params.to = friend_id;
FB.ui(params, function(response){
...
});
The to field in the params is what makes the dialog select the friend's feed by default.
I want to do the same on the iOS and Android clients, but I can't find a way to achieve this with SDK 4.x.
The docs say:
"With the Share Button you will allow people to share content to their
Facebook timeline, to a friend's timeline or in a group."
Although it's true that the dialog allows the player to share on their friend's timeline, there doesn't seem to be a way to select this option before presenting the dialog to the user.
Looking at FBSDKShareDialog's and FBSDKShareLinkContent's interfaces I don't see a way to specify the "to" as we do in JS. Is this functionality just missing from the mobile SDKs?
So after some digging in the Facebook SDK's code I found a way to do what I wanted, but it's using undocumented and deprecated code... (according to the code comments this is there to support Unity). So it's not exactly recommended, but just in case it helps someone, here it goes:
On iOS, there's a hidden property in FBSDKShareLinkContent that lets you pass a free-form parameters dictionary for the share dialog in "feed" mode. Normally this is not accessible, but declaring an extension is all that's needed to make it public. Using the "to" key to specify the friend ID makes the dialog work as on the Web.
#interface FBSDKShareLinkContent ()
#property (nonatomic, copy) NSDictionary* feedParameters;
#end
...
FBSDKShareLinkContent* content = [[FBSDKShareLinkContent alloc] init];
content.contentTitle = title;
content.contentDescription = description;
content.contentURL = linkURL;
content.imageURL = imageURL;
content.feedParameters = #{#"to" : friendId}; // Setting hidden property
FBSDKShareDialog* shareDialog = [[FBSDKShareDialog alloc] init];
shareDialog.mode = FBSDKShareDialogModeFeedWeb; // Use feed mode
On Android, there's an undocumented class called ShareFeedContent that can be used instead of the normal ShareLinkContent and contains a toId field which is what I needed.
import com.facebook.share.internal.ShareFeedContent; // Import undocumented class
ShareFeedContent content = new ShareFeedContent.Builder()
.setLinkName(title)
.setLinkDescription(description)
.setLink(linkURL)
.setPicture(imageURL)
.setToId(friendId)
.build();
ShareDialog shareDialog = new ShareDialog(activity);
shareDialog.show(content, ShareDialog.Mode.FEED); // Use feed mode
It's probably not a good idea to use these, but they do definitely work. Hopefully someone else has a cleaner alternative.

Facebook App Invite with Cordova-plugin-facebook4

I am trying to implement Facebook app invite with this plugin in my ionic application. The implemented codes are following as below:
$scope.appInviteToFriend = function(user){
var url = "";
if (ionic.Platform.isAndroid())
{
url = "https://play.google.com/store/apps/details?id=com.example.application";
}
else if (ionic.Platform.isIOS())
{
url = "https://itunes.apple.com/nl/app/example-by-ionicapplication/id1983838444?l=en&mt=8";
}
var option = {
url: url,
picture : ""
};
facebookConnectPlugin.appInvite(
option,
function(obj){
if(obj) {
if(obj.completionGesture == "cancel") {
// user canceled, bad guy
} else {
// user really invited someone :)
}
} else {
// user just pressed done, bad guy
}
},
function(obj){
// error
console.log(obj);
}
);
}
When I executed these codes, the Facebook Invite Dialog opens and displayed app information correctly. But after click next button, select friend and also click send button, The error occurs. It says "Missing App Link URL. The app link used with this invite does not contain an Android or iOS URL.Developers are required to enter URl for at least one platform.". I've attached the error details with part of screenshot. Are these wrong the URLs which are store URL? How can I set the URLs?
You need to provide an App Link instead of a web URL. This link can be statically generated using Facebook's own tools, or you can generate them dynamically server-side. You can read more about these in the documentation.
Here's a tutorial that walks through setting up an Android app.

View activity list of google plus on android

I'm following the documentation of google plus list and I am using this code:
Plus.Activities.List listActivities = plus.activities().list("me", "public");
listActivities.setMaxResults(5L);
// Execute the request for the first page
ActivityFeed activityFeed = listActivities.execute();
// Unwrap the request and extract the pieces we want
List<Activity> activities = activityFeed.getItems();
// Loop through until we arrive at an empty page
while (activities != null) {
for (Activity activity : activities) {
System.out.println("ID " + activity.getId() + " Content: " +
activity.getObject().getContent());
}
// We will know we are on the last page when the next page token is null.
// If this is the case, break.
if (activityFeed.getNextPageToken() == null) {
break;
}
// Prepare to request the next page of activities
listActivities.setPageToken(activityFeed.getNextPageToken());
// Execute and process the next page request
activityFeed = listActivities.execute();
activities = activityFeed.getItems();
This does not work because I have to create a client object. I tried more example but I do not understand how to do. Now:
How do I create a client object?
Where do I insert this client object?
I've seen a lot of answers but none work. You can Help me.
The comment that proceeded that code sample asked you to take a look at the Google+ Java quickstart, see the source file in question for how to set up your credentials and Plus client. You'll also need to authorize your request, that sample project shows how to use Google+ Sign-In to authorize the user to get an access token. You must have an authorized user to search with "me".
This sample is Java code using the Google Java API client library, the Android SDK doesn't include the client library by default, so you'd need to import that into your project.
I think you should take a look at this project : google API calendar
It works exactly like that with the G+ API.

Categories

Resources