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.
Related
I have added AdMob's ads into my flutter application.it shows adds with a "test ad" tag on it.No impresions.No revenue yet.what should I do? and it only shows in my testing device but not showing other devices. Please guide me to resolve this issue.
enter image description here
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-4881405240833971~497555****"
/>
You have to create an adMob project corresponding to your app with ad units
If you already did this, then don't forget to create your own ad in adMob and replace in your code the test ad id by the one you created
There is a Flutter Codelab explaining the whole process of integrating ads, you might want to look at it
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="*" />
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.
I would like to write a web application that behaves identically to transmission's (the BitTorrent client) web interface.
If you exit the web app, and then access the application switcher, transmission's icon is there.
All of the typical meta tags for ios web apps are leaving me with safari's icon in the app switcher.
Any ideas on how to achieve this behavior?
If you take a look at the web app source code you can see what it's doing.
The magic sauce is
<meta name="apple-mobile-web-app-capable" content="yes" />
and
<link rel="apple-touch-icon" href="./images/webclip-icon.png"/ >
All of this is documented in the Safari Web Content Guide
I am new to web apps. I read just about everyting of Apple's website about creating web apps for iphone but could not find any info on how do you create an icon that would be placed on user's phone that would launch the app.
I mean, is it possible to have an icon added to the iphone/ipad for a web app that would launch your web app the same was it launches the regular app?
See the Apple documentation on web apps,
Basicaly use:
<link rel="apple-touch-icon" href="touch-icon-iphone.png" />
(put it in your <head>)
If you don't want the shiny effect added to your icon use:
<link rel="apple-touch-icon-precomposed" href="touch-icon-iphone.png" />