Can chrome app pass a message/communicate with an embedded page? - google-chrome-app

As far as I know, only chrome extensions can communicate to an embedded page using content scripts. But is there a way to communicate with an chrome app from a specific page?.

The docs explicitly say:
Similar to cross-extension messaging, your app or extension can receive and respond to messages from regular web pages.
So the "externally_connectable" approach should work, as described in the docs. Note that an event listener for onExternalMessage registered in a background page for an app will fire even if app is not open.

Related

Is it possible to for an Ionic(5) Capacitor(3) application to complete an Open ID (Auth0) flow?

I am struggling to utlise the angular-auth-oidc-client to add OIDC workflows into my Ionic app (android), although I feel the issues are more Capacitor so not sure that the library is the issue. There are numerous (old) posts on Google of people who have had similar problems, so I'm trying to ascertain the current state of play. I can:
By utilising a custom android scheme in my AndroidManifest, and an 'appUrlOpen' listener in app.component my OIDC login page loads in the Chrome browser on the device, and then returns to the Ionic app and opens the correct app page. Unfortunately because I've opened the login in Chrome it hangs around in the background with the username and password populated. I've no handle to it to close it, and the Capacitor plugins don't help me here.
Alternatively, I can add my ID Provider domain into 'AllowNavigation' in capacitor.config.json. This opens my login page in the app's webview, begins the redirect on successful login but fails (hangs) because Capacitor is not loaded when it attempts Window.Capacitor.triggerevent calls.
This is probably classed as a poor question, and I appreciate that it is light on code, but I'm interested in whether anyone has actually managed to do this successfully, as there are so many dead ends on google and github of people who've given up!
Yes it is possible to complete an Open ID Flow on ionic with capacitor.
You need a capacitor plugin to do so, ionic provides an own payed plugin (https://ionic.io/docs/auth-connect), other alternatives exist.
angular-auth-oidc-client out of the box works only on browser, not on iOS or Android. It seems that some adoption can be made, see https://github.com/damienbod/angular-auth-oidc-client/issues/807.

How to share an image from gallery with my flutter app?

Can anyone point me to a library or advice on how I can go about sharing an image from the gallery with my app using the share button? I want to have my app appear in the list of apps to share with. There are libraries such as [share] https://pub.dev/packages/share that allow you to share content from your app with other apps but it doesn't do what I am looking for.
TL:DR Coming from android,you can do this with a content provider. then using platfrom channels get it to flutter.
Allowing Other Apps to Start Your Activity
For example, if you build a social app that can share messages or photos with the user's friends, you should support the ACTION_SEND intent. Then, when users initiate a "share" action from another app, your app appears as an option in the chooser dialog (also known as the "disambiguation dialog")
To allow other apps to start your activity in this way, you need to add an element in your manifest file for the corresponding element.
When your app is installed on a device, the system identifies your intent filters and adds the information to an internal catalog of intents supported by all installed apps. When an app calls startActivity() or startActivityForResult(), with an implicit intent, the system finds which activity (or activities) can respond to the intent.
read more from docs
I guess you are searching for something like explained here:
https://medium.com/flutter-community/receive-sharing-files-to-flutter-app-from-another-app-7a84c0c0cd88
You could also try this flutter package: https://pub.dev/packages/receive_sharing_intent

Chat Extensions on Facebook Messenger web app

Facebook just launched Chat Extensions and open-sourced an example extension called TaskBot, which works in a chat between two people. The Github repo is here, and the official docs are here.
I tried to play around with it. Works fine within mobile app. But not within the web app (via messenger.com). When I try to edit a task list, I get redirected to the page https://messenger-taskbot.herokuapp.com/lists/{id} and I have the following message:
So I guess there isn't going to be Chat extensions for messenger.com on browser yet?
Chat Extensions use webviews, and on "desktop" Facebook Messenger and messenger.com webviews open in new tabs. Chat Extensions rely on webview windows opening within the chat thread itself.
From the docs you linked to:
When the user taps the chat extension's icon, it opens a webview-based
UI specified by the developer. The user can then create or select
content to be shared into the thread. The message shared into the
thread can contain images, links, and more.
So yes, it seems that chat extensions are meant to be mobile only.

How to implement my android algorithm on iOS?

I have an android app working this way:
User read QR-code with my specific URL
If the app installed it intercepts this URL and handles it somehow.
If app not installed standard browser opens this URL and it leads to Google play on app page.
When user install and run app first time it read browser's history and look for my URL.
If app found URL in browser's history then it handles this URL again.
Is it possible to implement this behavior on iPhone/iPad?
I suppose key features here are to read browser history and to intercept http URL's.
If this is impossible how would you implement this thing on iOS?
Thanks in advance for your help.
You can use custom application URLs in the form: myApp://... iOS will automatically launch the application if present. The logic for handling the 'not-installed' case has to be in the QR code scanning app. can be handled by the scanned website via a forwarding link using the iOS custom URL scheme (this might be useful for usage stats).
Additional info on implementing Custom URLs...

How to launch iOS app via custom URL and allow to open a webpage if it's not installed?

I'd like to be able to send invitation in an email to a specific "event" happening inside my iOS app. So I figured I'd need to use custom URL. That's fine.
But I'd also like to be able to handle the user that doesn't have the app installed yet, to be taken to a mobile Safari and to the webpage with installation instructions for the app.
What would be the best way to do it?
I could try the following:
In the email I send a link to a http://www.example.com/joinevent/?id=foo
User is taken to a Safari webpage that sends a redirect to mycustomscheme://joinevent/?id=foo
If the user doesn't have the app installed this redirection won't work and he stays in the Safari - I could then handle the displaying of installation instructions probably.
But this approach doesn't seem "natural" for me. Is there a better/more native way to do it?
Try http://rdrct.it
It is a web service that allows you to achieve exactly this functionality very easily.
Full disclosure - I created rdrct.it
Here's the basics:
Login to the site, create a project for your particular app. Choose a unique code (this could be the name of your app).
You'll then be provided with a URL in the form: http://rdrct.it/uniqueCode
Once you've done that, you need to register the app's ID in the app store, and also details about the custom URL scheme. Tick "Auto-redirect" - what it will then do is try to open the app, and if that fails, it will automatically send the user to the app store.
If the app is opened, then the querystring is also passed to the app, so in your example case, the device will have been served: mycustomscheme://joinevent/?id=foo
It also works across multiple device types, so if you have the app available for Blackberry, Android or Windows Phone, then it will also do the same for those depending on which device type the user is using.
Like I said, I created it, but it should solve your problem.
If you are using Distimo to track you app analytics, they provide a shortlink to your apps that can be used also used to track conversions. It shows a custom page depending on the device used to access. This is especially convenient if you have the same app published in the AppStore, Google Play, Amazon, etc.