Once an inline Chrome app is installed, how do you run it? - google-chrome-app

Once an inline Chrome app is installed, ie chrome.webstore.install(undefined,success(),fail()); // where success() is called ... how do you have the website automatically run the app?
Similarly, if chrome.app.isInstalled==true how do you have the website run the app?

If you are launching it from an extension, use chrome.management.launchApp:
chrome.management API for chrome extensions https://developer.chrome.com/extensions/management.html#method-launchApp
Edit: At this point I don't know of any way to launch a chrome packaged app using javascript other than the above. If you inspect the chrome object in the console you'll see that neither the chrome.app or the chrome.webstore objects provide any launching methods for installed apps.

Make your app externally_connectable and grant your website permission to connect.
In the website's code, use chrome.runtime.sendMessage (or chrome.runtime.connect in case you need a more involved communication channel) to send commands to your app.
In the app's event page, add a chrome.runtime.onMessageExternal listener to process commands from the website. From there, you can call chrome.app.window.open() just as you would from an onLaunched listener.

Related

Using brave browser to debug flutter web app

I just started-off with flutter web and I want to use brave browser to debug my flutter apps not chrome or edge.
When I use flutter devices command, it gives the following result.
No devices detected.
Run "flutter emulators" to list and start any available device emulators.
I'm using brave by using the link provided by web-server and it does not support hot reload.
So, how to configure browsers other than chrome or edge with flutter web for complete functionality.
I found this:
All you have to do, based on your Linux operating system (for Windows
and macOS the process is similar), is to modify your .bashrc file and
insert this line:
#Put your Brave installation location here
export CHROME_EXECUTABLE="/opt/brave.com/brave/brave-browser"
For MacOs,
export CHROME_EXECUTABLE="/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"
You can use flutter run -d web-server to run your app like a server.
This means that you can just enter the URL on any browser of your choice to access your Flutter app !
Drawbacks:
Hot Restart/Reload from the terminal is not possible. You must refresh the page on your browser instead.
Advantages:
You can use any browser for developing flutter apps.
You can even use ngrok to forward your port to a HTTPS URL, and access your flutter app from anywhere (your phone, your desktop , someone else's device etc.)
PS: Credits to the Issue #77229 for helping me find this solution. I am aware that this workaround has already been suggested on this thread.
I just wanted to put out a simpler answer for the general viewer.
I've been diving in the same issue, it's known Brave it's Chromium-based, this will help u https://github.com/flutter/flutter/issues/77229

Ionic 3, HTTP native vs. HttpClient

I am struggling to make HTTP native or HttpClient get to work for my app.
If I run ionic serve -c I get HttpClient working good on my browser at localhost:8100 and in Ionic Dev App. If I build for Android though, HttpClient fails thus I decided to give HTTP Native a try.
Then I don't understand how I could get some console log if that native plugin is not supported from Ionic Dev App (here says), neither I can see on my browser cause of Cordova is not present.
Is there a way to log on a device to debug HTTP Native?
You should debug your application connect your phone to your laptop and
Open your Google Chrome Browser
Go to Inspect (Ctrl + Shift +I)
Go To More Tools enter image description here
Open Remote devices and inspect your device
For more information click here
Thanks
You wont see native http calls log to the browser since they are called native from the device and never are called from the browser, but if you are debugging while connected to xcode, the xcode debugging output should give some information about your native HTTP calls success and failure.
Following #vd_virani answer, here is a quick link to inspect a device from Chrome
chrome://inspect/#devices
Plug your device via USB, then copy & paste this link in your Chrome address bar like a website.

Phonegap Build using Phonegap Facebook Plugin

I'm using PhoneGap Build. I'm using this plugin here: https://github.com/Wizcorp/phonegap-facebook-plugin only to add install tracking for a Facebook ad I have setup for mobile ads when people install the app after clicking the mobile Facebook ad.
In the Facebook SDK here under "4. Enable Install Tracking": https://developers.facebook.com/docs/app-ads/sdk
it says: "To enable install tracking call the App Events logger once your application becomes active."
In this plugin's README under Events, it says:
"Activation events are automatically tracked for you in the plugin."
Does this mean that there is no code to write, that once I only have to add the plugin to the config xml and it will automatically call FB.AppEvents.activateApp() ?
I have attempted to call FB.AppEvents.activateApp() manually using the Facebook SDK for Javascript but get an error AppEvents undefined.
If you look at the Facebook JS SDK documentation you'll find that it says...
Note: App Launches and App Installs are now logged automatically. It's no longer necessary to call activateApp to log those events.
https://developers.facebook.com/docs/reference/javascript/FB.AppEvents.LogEvent
So the readme for that plugin is correct to say it is automatic.

Get error messages Chrome packaged app

How can I see error messages when running a Chrome packaged app? I've been running the app in the browser and using DevTools but this technique has it's limitations.
If you need to inspect app windows, you can reach them at chrome://inspect/#apps
Or, as Daniel mentions, use the Developer Tool app.
General Chrome Debugging
By opening
chrome://inspect/#apps
you may debug all Apps and Extensions.
You may also like the official Google Chrome Apps & Extensions Developer Tool
Debugging Chrome Extensions
As described in the chrome developer Tutorial you can activate the developer mode within the settings. Afterwards an inspect popup option is avaialbe when you right-click an app-icon.

Call phonegap plugin function within web app

i am building my first phonegap app and when i open the app i instantly redirecting (window.location) the user to my server where my web app is hosted. Is it possible to load the phonegap plugins from there? Because the "deviceready" event is not firing and i cannot call any plugin functions.
I can confirm that loading remotely does appear to allow access to native components (when scripts are properly loaded) and that cordova.jsdoes not appear to need to be loaded by the local index.html bootstrap.
Short answer: Yes
Some 'gotcha's'
You will have to supply correct cordova.js version for the platform browsing to your site.
you can look here for more info https://github.com/apache/cordova-js. This project hosts the core js elements, and builds the platform specific cordova.js lib
Any plugin api's your app wants to interact with must be pre-installed into the Native App
any plugin with native code will have to be added to the project and deployed to device bundled inside the app. There is no way to lazyload native code. The js portions of the plugin could be hosted on your server, however.
More information, some apps that do this
The PhoneGap Developer App uses a similar technique to what is describe above and what you want. The only difference is that it is meant as a dev tool, and the server is a local dev machine.
The Cordova App Harness also uses this technique of pre-bundling an app package with plugins, to be consumed by remotely hosted resources
You cannot, deviceready only functioning if the app run on mobile phone environment only. If web based or dekstop application, it won't trigger.
No , dont do that . loading remote website will not able to intract with your plugins . and the app will get rejected on istore too