Getting "Content not found" error when following app-scoped user ID - android

Thanks again to Cbroe who answered my original question. I implemented his suggestion and although the URL returned by GraphRequest.newMeRequest looks valid, when I followed it, I got a "Content not found" error:
reachOut.setOnClickListener(new View.OnClickListener(){
public void onClick(View view) {
// Navigate to person's Facebook page to send a message.
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(linkArray[selectedPosition]));
startActivity(intent);
}
});
BTW, in the above, I did confirm that linkArray[selectedPosition] contained the correct value.
I had previously (back in 2018!) successfully completed an app review for user_link, so I doubt that that's the problem.

Looks like I had to resubmit my app for approval because now it's working again.

Related

Firebase Dynamic links always returned CANCELED

I'm using dynamic links for my app.
I've followed the tutorial step-by-step and I'm able to open the app by clicking on the link posted on facebook.
But when I invoke getInvitation, I always have CANCELED as status of AppInviteInvitationResult.
AppInvite.AppInviteApi.getInvitation(mGoogleApiClient, this, false).setResultCallback(
new ResultCallback<AppInviteInvitationResult>() {
#Override
public void onResult(#NonNull AppInviteInvitationResult result) {
if (result.getStatus().isSuccess()) {
// Extract deep link from Intent
Intent intent = result.getInvitationIntent();
String deepLink = AppInviteReferral.getDeepLink(intent);
// [END_EXCLUDE]
} else {
Log.d("StartActivity", "getInvitation: no deep link found.");
}
}
});
Into debug, I can see that result.getStatus() returns CANCELED, but the click on lick open the app correctly.
Where I'm wrong?
EDIT: The link that I'm using is:
https://wft4z.app.goo.gl/?link=https://aqld.it/testlink/112972&al=aqld://test/about?params%3D17363&apn=com.project.mydeeplink
The filter on manifest:
The status is canceled when no intent has been received. I was wondering the same thing and it turned out that my links created in firebase web page were wrong. I wrote some ideas on how to debug the url problem as an answer to another question. If you have the same problem as I did, they should be helpful:
https://stackoverflow.com/a/37615175/4025606
Doesn't directly answer your question but you could eliminate badly formed urls as a root cause by using this page to create firebase dynamic links for both ios and Android: http://fdl-links.appspot.com/
Just double-check if you have added the SHA-1 in the firebase console and the added SHA-1 matches the SHA1 of the generated APK. I was seeing the same issue - result.getStatus() returning CANCELED prior to this, but after adding the SHA-1 on firebase console, it started working fine. :)

How to handle Facebook ShareDialog.canShow() == false on Android

Facebook's Sharing on Android documentation tells us to show the ShareDialog with the following code snippet:
if (ShareDialog.canShow(ShareLinkContent.class)) {
ShareLinkContent linkContent = new ShareLinkContent.Builder()
.setContentTitle("Hello Facebook")
.setContentDescription(
"The 'Hello Facebook' sample showcases simple Facebook integration")
.setContentUrl(Uri.parse("http://developers.facebook.com/android"))
.build();
shareDialog.show(linkContent);
}
My question is why do we need to check ShareDialog.canShow()? In what scenarios would this possibly return false and do we need to handle this scenario? The example code would just fail silently not tell the user anything.
I spent a lot of time yesterday trying to debug an error related to this. Facebook's docs are poor in this sense and when there is an error related to this canShow() method, it just fails silently, no logging at all.
So, to answer your question:
My question is why do we need to check ShareDialog.canShow()? In what
scenarios would this possibly return false and do we need to handle
this scenario?
Based on the scenario I faced: when the user doesn't have the Facebook app installed on their device and you want to share photos (SharePhotoContent) or videos (ShareVideoContent), canShow() will return false. The reason is that Facebook SDK's WebView version doesn't support sharing this kind of content.
I found this out debugging their FacebookActivity class, on the handlePassThroughError() method. The (not logged) error message is:
"Unable to show the provided content. This typically means that the Facebook app is not installed or up to date. If showing via the Web, this could mean that the content has properties that are not supported via this channel."
So, what should we do when canShow() returns false?
It depends on your scenario. Possible solutions would be:
Show a dialog (or SnackBar) telling the user that they need to install the Facebook app to be able to share this kind of content;
Request an authentication token, log the user using the Facebook SDK, and share the content using your own dialog and calling Facebook API directly.
Possible solutions for Facebook would be include this on their documentation or log this error on LogCat.
Hope it helps!
this answer for someone facing the same problem.
#leocadiotine was great.
From the facebook sdk sample, when the ShareDialog.canShow() return false you should use ShareApi.share function.
In AndroidManifest.xml, add:
<queries>
<provider android:authorities="com.facebook.katana.provider.PlatformProvider" />
</queries>
// for facebook
callbackManager = CallbackManager.Factory.create();
shareDialog = new ShareDialog(this);
// this part is optional
shareDialog.registerCallback(callbackManager, new FacebookCallback<Sharer.Result>() {
#Override
public void onSuccess(Sharer.Result result) {
}
#Override
public void onCancel() {
}
#Override
public void onError(FacebookException e) {
}
});

ParseTwitterUtils: No login dialog appearing

I used the following in a straight copy paste from the Parse documentation:
ParseTwitterUtils.logIn(view.getContext(), new LogInCallback() {
#Override
public void done(ParseUser user, ParseException err) {
if (user == null) {
Log.d("MyApp", "Uh oh. The user cancelled the Twitter login.");
} else if (user.isNew()) {
Log.d("MyApp", "User signed up and logged in through Twitter!");
} else {
Log.d("MyApp", "User logged in through Twitter!");
}
}
});
with the exception of the context I'm passing to it. Because I'm inside a button click event which is in a fragment, I pass as context: view.getContext()
I have also called: ParseTwitterUtils.initialize("YOUR CONSUMER KEY", "YOUR CONSUMER SECRET");
before everything with my API Key and API Secret. However, there is no Twitter login dialog appearing. What appears is a small rectangle with text saying: "loading..." and a moving circle, but it closes without opening any authentication dialog. Because of that the done() method part is never being called.
I realize that in order to use the ParseFacebookUtils one needs the Facebook SDK for android and that such SDK is the one that contains the Login Screen. In fact, when I use ParseFacebookUtils, it works perfectly. But there is no SDK with login screen for Twitter in Android. Plus the Parse documentation clearly states that a Twitter Login Dialog is supposed to appear when the code above is executed. No further action needed according to it.
What am I missing here. How do I make the Twitter login dialog appear?
Please make sure you have entered your consumer key, and consumer secret correctly. Next please make sure you follow item 3 in the Parse.Com Android developer guide under setup.
That is,
3. When asked to specify a "Callback URL" for your Twitter app, please insert a valid URL. This value will not be used by your iOS or Android application, but is necessary in order to enable authentication through Twitter.
You must specify a callback URL (a valid URL) although it won't be used. That means, use a made up URL or use something like http://myCompanyWebsite.com/callbackurl. This can be set under the "Settings" tab in your twitter developer console.
I don't use Twitter in my Parse applications, but I was able to duplicate the problem by also missing step 3 and then subsequently fix it.
If you are still having trouble please post your logcat of when you press the click button.

Facebook Android Unity can't post screenshot

I made a unity project and included facebook in it. Everything worked fine until I used OBB spliter.
Actually, I just wanted to share a screenshot of the game so I did this:
private void CallFBLogin()
{
print ("test");
FB.Login("email,publish_actions", LoginCallback);
StartCoroutine (TakeScreenshot ());
print ("test2");
}
When I push a button, this function is called but the problem is that the process finishes before I'm logged with Facebook. When I'm logged in, I'm already out of this function. What's the best way to log, wait to be logged and then launch the coroutine?
I haven't used the Facebook api yet so I can't give you exact code but based on what I see here you need to launch your coroutine from inside the LoginCallback function.
This way it will automatically execute after the user is logged in.
As TheValar stated, you need to do the following..
private void CallFBLogin()
{
print ("test");
FB.Login("email,publish_actions", MyLoginCallback);
print ("test2");
}
void MyLoginCallback(FBResult result)
{
// Do whatever you need, or nothing. You can check if you are logged in correctly
StartCoroutine (TakeScreenshot ());
}
This will guarantee that the take screenshot gets called after you are logged in Facebook

android in-app testing error

I am developing android In-App with 10 In-App product.I complete integrate Android Billing library, the Google test account and setting the Product id, but when I am click on Accept & Buy button the following error occurs
your order could not be processed please try again.
What is the reason for this error. What I am doing wrong?
public void onClick(View v){
if(BillingController.isPurchased(context, MainActivity.ITEM_ID[position])) {
String msg=(String) holder.txtViewname.getText();
Intent intent= new Intent(context,RecipeMenu.class);
intent.putExtra("name", msg);
intent.putExtra("id", position);
context.startActivity(intent); }
else{
BillingController.requestPurchase(context, MainActivity.ITEM_ID[position], true /* confirm */);
}
}
});
Android provide us one example for this same In-app billing example. Please refer Android In-app. And name of that is market_billing. You can find it at android-sdk/extras/google/market_billing.

Categories

Resources