Sharing to Facebook Stories - facebook

We were able to implement sharing to Instagram Stories, but not to Facebook Stories, following these instructions . Android is not able to find an app for the intent com.facebook.stories.ADD_TO_STORY, despite Facebook app being installed and updated. Has anybody been able to accomplish that?

It might be too late but i thought to answer it if it can help people who might be facing issues in sharing to instagram without Intent Chooser dialog.
Facebook expects us to launch an intent chooser dialog to select from 4 -5 activities within facebook app itself that can handle com.facebook.stories.ADD_TO_STORY as action.
Nevertheless here is the code i used to launch the exact story editor screen from facebook app. It uses ACTION_SEND instead of com.facebook.stories.ADD_TO_STORY.
So First define a fileprovider inside application tag in manifest
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_provider_paths" />
</provider>
Then keep file_provider_paths.xml inside xml folder in res directory.
file_provider_paths.xml
<paths>
<external-path
name="share"
path="/" />
</paths>
Then perpare a uri of file you want to share
File file = new File(imagePath);
Uri fileUri = FileProvider.getUriForFile(getApplicationContext(),getPackageName()+".fileprovider",file);
Then send intent to facebook as below
Intent storiesIntent = new Intent(Intent.ACTION_SEND);
storiesIntent.setComponent(new ComponentName("com.facebook.katana", "com.facebook.composer.shareintent.AddToStoryAlias"));
storiesIntent.setDataAndType(uri, "image/*");//for background image
storiesIntent.putExtra("interactive_asset_uri", uri);//for sticker assets
storiesIntent.putExtra("content_url", "https://dexati.com/");
grantUriPermission("com.facebook.katana", uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivityForResult(storiesIntent, 0);
Here we are making explicit call to the story editor activity of facebook app.

Related

How Can You Open Android Application Property Pages in MAUI

I have a MAUI app that uses Contacts; this feature was added after the initial release. People that upgrade the app didn't grant permissions to Contacts when the app was first installed because we weren't asking for it then (since we weren't using it). I can capture the fact that they're getting denied access, but is there a way in MAUI that I can navigate through the Android settings (like I've seen other apps do) to open the Permissions page for our app so users can more easily grant us permissions to Contacts?
I don't know if I understand correctly.
is there a way in MAUI that I can navigate through the Android
settings (like I've seen other apps do) to open the Permissions page
for our app so users can more easily grant us permissions to Contacts?
First, add this permission in AndroidManifest.xml
<uses-permission android:name="android.permission.READ_CONTACTS" />
Then open Setting->Apps&notifications-> Select App ->Permissions->Contacts
For more information, you can check Contacts - .NET MAUI | Microsoft Learn and Permissions - .NET MAUI | Microsoft Learn.
It took a bit of bumbling around, but I found a solution that will open the app's settings page, and you can click on Permissions from there. I got mixed result in researching this, but it sounded like you can't open the Permissions page directly. In any case, here is the code in case it is helpful to you:
#if ANDROID
//from: https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/provider/Settings.java
string APP_DETAIL_SETTINGS = "android.settings.APPLICATION_DETAILS_SETTINGS";
var act = Microsoft.Maui.ApplicationModel.Platform.CurrentActivity;
Android.Net.Uri appUri = Android.Net.Uri.Parse("package:" + act.PackageName);
Android.Content.Intent tent = new Android.Content.Intent(APP_DETAIL_SETTINGS, appUri);
tent.AddCategory(Android.Content.Intent.CategoryDefault);
tent.SetFlags(Android.Content.ActivityFlags.NewTask);
act.StartActivity(tent);
#endif

Flutter : Unable to show Images from some urls

I am trying to display images in my flutter app. If I use a google link of the image, it is displayed. But, if I use my server URL, the image is not visible in the installed app.
I tried accessing the URL from both mobile and web browsers and it loads successfully there.
I have already used:
<manifest xmlns:android="...">
<uses-permission android:name="android.permission.INTERNET"/> <!-- Add this -->
</manifast>

Switch to a different activity from TWA

I've put together a PWA and wanted to convert it into an Android App.
I've done so and my Android app consists of Main Activity and TWA that I start from the Main Activity.
Is there a way to switch from inside the TWA to some other activity on some event in the PWA running in this TWA? Like button click. Preferably from the HTML/Javascript of the PWA itself.
The end goal is to ad ads to the app (I'm using some paid APIs in the PWA so I need to at least break even and cannot monetize it on the web development side since Google AdSense and likes need context rich web-apps like blogs) and I've figured out that Google AdMob don't show up in TWA, they require a native Android Activity.
This question is closely related but I don't know where to put this URI:
Launching another activity from a Trusted Web Activity (TWA)
Thank you!
Yes, it is possible to start a different Activity. You will need to define a custom schema and link to that schema from the PWA:
This is defined inside AndroidManifest.xml, where the Activity you want to open from the PWA is specified. In the example below, we want to open ReviewActivity from the PWA, so we define:
<activity android:name=".ReviewActivity"
android:theme="#android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="doom-fire" android:host="review" />
</intent-filter>
</activity>
Then, in the web application, whenever you link to doom-fire://review, ReviewActivity will be opened:
Rate app now!
I wrote a complete blogpost for the in-app review use-case that you may want to check out.

Ionic iframe issue when opening an external link

I am trying to use an iframe inside my hybrid app. The iframe works perfectly, but it as some links inside that won't open when you click on them specifically when they are deployed to the iOS platform. It works in the browser view, but not in the iOS device. Is there a solution for this?
Put this in your confix.xml and try it.
<content src="index.html" />
<access origin="*" />

How to add a flash game to my facebook APP

I tried adding a flash game to my APP.
I looked on the (terrible) facebook developer website. All I found was this page:
http://www.google.be/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CCcQFjAA&url=http%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Freference%2Ffbml%2Fswf%2F&ei=e-CXT4SAMMfpOamGqb8G&usg=AFQjCNGCKaCIDbWs0PrItofyEIlR4MSasg
But it says this will be legacy code and I should use a new method... I have no clue what that method is or where I can find it.
I tried these lines:
<embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="http://mywebsite.com/game.swf" />
and
<fb:swf swfsrc='http://mywebsite.com/game.swf' imgsrc='http://www.myurl.com/myflash.jpg' width='400′ height='300′ />
both failed... I'm desperate here, please help!
Just create an iframe application. That means create a page for your flash game to run on its own and then just point the iframe app to that url
Do exacly as on http://ugamesfree.com
Create a canvas app on facebook.
But remember, you need to have a SSL certificate to use iframes and redirects.