I can't get Deferred DeepLink - android

Recently I tested 'deferred deeplink' function by using facebook SDK.
But there is one problem.
# I did it.
First, I have completed all of setting for apps by using the "App Ads Helper" function from developers.facebook.com.
https://developers.facebook.com/tools/app-ads-helper
Second, so I obtained the good result by using "DeepLink Test" provided by"App Ads Helper".
And I could see what i want (AppLinkData)
06-04 12:58:25.598 11903-11925/? I/DEBUG_FACEBOOK_SDK﹕ Bundle[{com.facebook.platform.APPLINK_NATIVE_CLASS=, target_url=myapp://myapp.co.kr?test=1111, com.facebook.platform.APPLINK_NATIVE_URL=myapp://myapp.co.kr?test=1111}]
Third, here is the code what I used.
protected void onCreate(){
....
FacebookSdk.sdkInitialize(getApplicationContext());
AppLinkData.fetchDeferredAppLinkData(getApplicationContext(),
BSTracker.getInstance().getFacebookIdMeta() ,
new AppLinkData.CompletionHandler() {
#Override
public void onDeferredAppLinkDataFetched(AppLinkData appLinkData) {
if (appLinkData != null) {
Bundle bundle = appLinkData.getArgumentBundle();
Log.i("DEBUG_FACEBOOK_SDK", bundle.toString());
} else {
Log.i("DEBUG_FACEBOOK_SDK", "AppLinkData is Null");
}
}
});
}
Finally. This is My App Setting
Ad Setting
It is My Ad setting.
i did input the DeepLink in "Get install of your App" Ad Product.
# Problem
When I created commercial ad at Facebook and released for the audience but I can't get Deferred DeepLink.
Please let me know, anything is wrong with it.

Related

unable to retrieve link params when opening branch link inside app

Our android app is a chat app. Users can paste a branch link in a chat message. When another user taps on it, we want to retrieve the link parameters to take the user to another screen.
Unfortunately, we are unable to retrieve the link parameters when we tap on such link inside the app (note that we are not using a webview), we are getting the error "Warning. Session initialisation already happened.
To force a new session, set intent extra, branch_force_new_session, to true in the onInitFinished(#Nullable JSONObject referringParams, #Nullable BranchError error) method.
How can we solve this? It's not obvious to me how I could pass a new intent param in that use case.
Notes:
Our launcher activity is singleTask
We are on branch.io sdk 4.3.2
onNewIntent() does not seem to be called (in the code below), maybe that is the root cause for our issue.
sample code:
private Branch.BranchReferralInitListener branchReferralInitListener =
new Branch.BranchReferralInitListener() {
#Override
public void onInitFinished(#Nullable JSONObject referringParams, #Nullable BranchError error) {
...
}
#Override
protected void onStart() {
super.onStart();
Branch.getInstance().initSession(branchReferralInitListener, getIntent() != null ?
getIntent().getData() : null, this);
}
#Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
this.setIntent(intent);
// activity will skip onStart, handle this case with reInitSession
Branch.getInstance().reInitSession(this, branchReferralInitListener);
}
This is a known issue with the Android SDK v4.3.2 and we are working on a resolution.
Would suggest you to try the following in the meanwhile:
When the user tries to open an app that is running in the background, we get an error for set branch_force_new_session to true.
Branch SDK gets initialised on onStart for the Launcher Activity and when the app comes foreground from the background, its on onResume.
In this scenario, we could need to re-initialise the SDK here.
Would request you to implement the below snippet as per Branch docs (https://docs.branch.io/apps/android/#initialize-branch)
// activity will skip onStart, handle this case with reInitSession
Branch.getInstance().reInitSession(this, branchReferralInitListener);
Alternatively, would suggest you to install Branch SDK v4.3.1.
Initialized, you branch IO in application class so that it will initialize once and will not be require again
// Branch logging for debugging
Branch.enableLogging();
//Disable Device ID #2966
Branch.disableDeviceIDFetch(true);
// Initialize the Branch object
BranchIOManager.setupBranchInstance(this);
// It tells the Branch initialization to wait for the Google Play Referrer before proceeding.
Branch.enablePlayStoreReferrer(1000L);
Then inside initSession() branch method use. Pass them as JSON Object to method where you can retrieve the value based on key names.
if (branch != null && uri != null) {
branch.initSession(new Branch.BranchUniversalReferralInitListener() {
#Override
public void onInitFinished(BranchUniversalObject branchUniversalObject, LinkProperties linkProperties, BranchError error) {
// Log.d("onInitFinished", error + "");
if (error == null && branchUniversalObject != null) {
JSONObject jBranch = branchUniversalObject.getContentMetadata().convertToJson();
if (!branchJSONString.equals(jBranch.toString())) {
//This check is applied as if we launch another mLandingScreenPhoneActivity from Branch link then app will become in loop
branchJSONString = jBranch.toString();
loadScreenFromBranchIODynamicLink(jBranch, 0);
}
}
if (error != null) {
// //Toast.makeText(LandingScreenPhoneActivity.this, error + "", Toast.LENGTH_SHORT).show();
}
}
}, uri, this);
}
Here you can get screen values
String screenName = referringParams.optString("screen_key");
//Screen in app where needs to navigate
int screenIndex = referringParams.optInt("screen_index");

How Can I Integrate mobileCore Stickeez Ad?

I explored mobileCore a month ago and decided to use today. But I couldnt integrate.
My Code for İntegrate Stickeez Ad Type:
MobileCore.init(MainActivity.this, "4U5PUKTA688XO2HBFI8O2SPYVVJ47",
MobileCore.LOG_TYPE.PRODUCTION,MobileCore.AD_UNITS.INTERSTITIAL, MobileCore.AD_UNITS.STICKEEZ);
MobileCore.showStickee(MainActivity.this, MobileCore.AD_UNIT_TRIGGER.APP_START);
I dont know why showStickee but it isnt wrong. How can I fix it?
It seems that you're trying to show the ad unit before it is ready. We recommend to use the Ad Unit Event Listener to confirm that the ad unit is ready before calling showStickee(), or at least to not call it together with MobileCore.Init().
Also, if you're using the latest version (v2.0), note that we've added a new loadAdUnit() method that requires to manually fetch the ads before displaying.
Here's an example using Android SDK v2.0:
First, In the onCreate() method of your main activity, Init the SDK:
MobileCore.init(MainActivity.this, *YOUR_DEVELOPER_HASH_HERE*,
MobileCore.LOG_TYPE.PRODUCTION,MobileCore.AD_UNITS.INTERSTITIAL, MobileCore.AD_UNITS.STICKEEZ);
Now here's an example code that loads the ad unit after Init has finished and then displays the ad upon receiving AD_UNIT_READY event:
MobileCore.setAdUnitEventListener(new AdUnitEventListener() {
#Override
public void onAdUnitEvent(MobileCore.AD_UNITS adUnit, EVENT_TYPE eventType,
MobileCore.AD_UNIT_TRIGGER... trigger) {
if (adUnit == MobileCore.AD_UNITS.STICKEEZ) {
if (eventType == EVENT_TYPE.AD_UNIT_INIT_SUCCEEDED) {
MobileCore.loadAdUnit(MobileCore.AD_UNITS.STICKEEZ, MobileCore.AD_UNIT_TRIGGER.APP_START);
}
else if (eventType == AdUnitEventListener.EVENT_TYPE.AD_UNIT_READY) {
for (MobileCore.AD_UNIT_TRIGGER myTrigger : trigger) {
if (myTrigger.equals(MobileCore.AD_UNIT_TRIGGER.APP_START)) {
MobileCore.showStickee(MainActivity.this,
MobileCore.AD_UNIT_TRIGGER.APP_START);
}
}
}
}
}
});
Feel free to contact us at support#mobilecore.com with any question.

Facebook Android - Install App and Engage App campaigns are not delivering deferred link

I have done everything in my app to fetch deferred links for ads, but they never deliver the deferred link. AppLinkData is always null:
private class DeferredAppLinkDataCompletionHandlerListener implements AppLinkData.CompletionHandler {
#Override
public void onDeferredAppLinkDataFetched(AppLinkData appLinkData) {
if (appLinkData != null) {
final Uri deferredReceivedUri = appLinkData.getTargetUri();
} else {
// Always null
}
}
}
I have even tested the deferred link fetching, using the Ads Helper of this link: https://developers.facebook.com/tools/app-ads-helper/?id=1460634867586845 and everything work:
... but they don't with a real ad.
What else should I do?
This is a known issue and it is being tracked here https://developers.facebook.com/bugs/393947180805373.
You can subscribe to that bug to follow the updates.

Sharing to Facebook shows error "We are Sorry, this post is no longer available. It may have been removed"

I'm trying to implement Facebook sharing in my game using Unity 3D + Facebook Unity SDK. But when I tried testing to post to my wall, this error shows up: "We are Sorry, this post is no longer available. It may have been removed." Can anybody help me? Thanks in advance.
BTW, here's my code:
using UnityEngine;
using System.Collections;
public class FacebookController : MonoBehaviour {
public bool isUsingFacebook = true; //Are we using Facebook SDK? This variable is only
//Feed parameters.
private string link = "market://details?id=com.LaserCookie.Queue"; //The link that will show the user the game's google play store address
private string linkName = "Queue"; //The link name
private string linkCaption = "Wow this game is great! 10/10 must play!"; // The caption of the link
private string linkDescription = "I achieved the score of " + PlayerController.instance.score.ToString() + "! Try to beat me if you can!"; //The description of the link
private string picture = "http://www.drycreekequestriancenter.com/testImage.jpeg"; //This is the image / game icon for the link. For now, it's shamelessly got from a random source. Thank you, random citizen...
void Awake()
{
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
//Init FB
private void Init()
{
if (!FB.IsInitialized)
{
FB.Init(OnInitComplete, OnHideUnity);
}
}
//Callback that will be called when the initialization is completed
private void OnInitComplete()
{
Debug.Log("FB.Init completed: Is user logged in? " + FB.IsLoggedIn);
//Check if we are logged in.
//If not, we will log in.
//If we are, post status.
if (!FB.IsLoggedIn)
{
LoginWithPublish();
}
else
{
PostImpl();
}
}
//Callback that will be called when the game is shown / not
private void OnHideUnity(bool isGameShown)
{
Debug.Log("Is game showing? " + isGameShown);
}
//Post to Facebook. This is the only exposed method because we only use this to post to Facebook.
//The initialization and login will be called when needed.
//It will first detect whether or not we have been initialized. And will init if we haven't.
//Then it will check whether or not we have been logged in with publish. And will log in if not.
public void PostToFacebook()
{
//Are we using facebook SDK?
if (isUsingFacebook)
{
if (!FB.IsInitialized) //Check for initialization
{
Init();
}
else if (!FB.IsLoggedIn) //Check for login
{
LoginWithPublish();
}
else //Post if we are already initia;ized and logged in
{
PostImpl();
}
}
}
//The true implementation of the posting
private void PostImpl()
{
FB.Feed("",link, linkName,linkCaption,linkDescription,picture);
}
//Login to Facebook with publish
private void LoginWithPublish()
{
// It is generally good behavior to split asking for read and publish
// permissions rather than ask for them all at once.
//
// In your own game, consider postponing this call until the moment
// you actually need it.
FB.Login("publish_actions", LoginCallback);
}
//Login callback
void LoginCallback(FBResult result)
{
if (result.Error != null)
{
Debug.Log( "Error Response:\n" + result.Error );
//TODO: Retry login if we have error? Or do we display a pop up?
}
else if (!FB.IsLoggedIn)
{
Debug.Log( "Login cancelled by Player" );
//TODO: Do we display a pop up?
}
else
{
Debug.Log( "Login was successful!" );
PostImpl();
}
}
}
You need to add Key Hash for FB application.
Go to My Apps, select you application, open Setting tab, add platform for android, and add you key hash.
check this link out
Setting a Release Key Hash
I've fixed the issue. It turns out it's because I used my still in development google store address as the link. I thought it would be automatically recognized regardless of my app is live or not. Thank you anyway. :)

Invite Facebook friends thorogh android app

When I invite friends from facebook it displays Toast invitation was send but not display in friends notification.
I use Simple Facebook SDK for Android in my app. My invite is sent, but it isn`t displayed in friends wall.
I asked the same question here: https://github.com/sromku/android-simple-facebook/issues/13
Can you tell me why I need Canvas?
Can you explain what is Canvas and why we need it to make invites work?
I read facebook Canvas explanation.
It is written that: "A Canvas Page is quite literally a blank canvas within Facebook on which to run your app. You populate the Canvas Page by providing a Canvas URL that contains the HTML, JavaScript and CSS that make up your app. When a user requests the Canvas Page, we load the Canvas URL within an iframe on that page. This results in your app being displayed within the standard Facebook chrome."
I don`t want my app to run from page, or it just will have a link to playstore?
What permissions I should ask?
Today I ask for: "user_friends","publish_actions".
Can you give me an example of invite friends that work with people that don`t have the app installed?
public void invite(String message, final OnInviteListener onInviteListener, String data) {
InviteAction inviteAction = new InviteAction(mSessionManager);
inviteAction.setMessage(message);
inviteAction.setData(data);
inviteAction.setOnInviteListener(onInviteListener);
inviteAction.execute();
}
#Override
protected void executeImpl() {
if (sessionManager.isLogin(true)) {
Bundle params = new Bundle();
if (mMessage != null) {
params.putString(PARAM_MESSAGE, mMessage);
}
if (mData != null) {
params.putString(PARAM_DATA, mData);
}
if (mTo != null) {
params.putString(PARAM_TO, mTo);
}
else if (mSuggestions != null) {
params.putString(PARAM_SUGGESTIONS, TextUtils.join(",", mSuggestions));
}
openInviteDialog(sessionManager.getActivity(), params, mOnInviteListener);
}
else {
String reason = Errors.getError(ErrorMsg.LOGIN);
Logger.logError(InviteAction.class, reason, null);
mOnInviteListener.onFail(reason);
}
}
The code is taken from Simple Facebook implementation. Am I missing something?
Thanks

Categories

Resources