Plug-in development - adding attribute to existing item in AndroidManifest - phonegap-plugins

A great new plugin was just added to pg.build called LaunchMyApp which allows an app to be launched from an url.
The problem with this is that when I open my app from the browser, it creates an instance of the app "inside" the browser. If I then send the app to the background and open it normally from the launcher, this creates two instances of my app.
I guess some would want this behaviour, but to the users of my app I think it will be confusing - so I decided to write a plug-in for running the app as a single instance.
The plug-in itself is extremely simple since it is only supposed to add the attribute
android:launchMode="singleTask"
to the application tag in the androidmanifest.
I can see how I can add new nodes, but not how to add attributes to existing ones.
Is this supported in plugin.xml?

Related

Deploy Client Web Part globally using SPFx on SharePoint 2016 (On Prem)

I have succedeed in deploying a simple client web part on a SharePoint 2016 site with the following steps (following many guides, including https://www.voitanos.io/blog/definitive-guide-sharepoint-framework-sharepoint-server-2016/):
I configured the required Service applications (subscription and app management) and managed the blocked file types.
I created an App Catalog site for my Web Application.
I wrote two urls in "Central Administration -> Apps -> Configure App URLs" (it seems that it doesn't matter what URLs I write, the important thing is that they are not empty or I can't add the App to my sites).
I set up my CDN by creating a Document Library and a folder. I specified this location in the write-manifest.json -> "cdnBasePath".
I uploaded the sppkg (output of gulp package-solution --ship) to the App Catalog and it got distributed succesfully.
I went to the root web of the site collection I was working on and added the App.
I created a web part page with an empty web part zone and.
I succesfully added the client web part that was in the default "Other" group, and it rendered fine in the page.
Until here everything is fine. There was some tweaking to do with yeoman, gulp and node versions, but it works.
The problem is that if I add the app to the site root web, the web part is not available to the other webs, since from what I read, if I add an app that way the scope is only that web. In order to make the web part available on other webs, I would have to go to every web and add the app there. This could be fine if I had 2 or 3 webs, but what if I have 1000 webs?
I also read that if you add the app to the App Catalog Site, the scope should be "tenant", and you can then choose where to distribute the app so that it's added for all webs from this page:
https://i.stack.imgur.com/MAX8K.png
If I add the target site here, and the press "OK", an exception occurs:
Exception in page: https://i.stack.imgur.com/S8cl1.png
Exception in log: https://i.stack.imgur.com/K2GMB.png
I tried debuggingg the Microsoft.SharePoint.ApplicationPages.AppInvPage.SetControlStateUsingAppInstanceId method with dotpeek and I think I was able to identify the problem with the AppManifest object, that seems to have some null fields that on which gets called a "ToString", but wasn't able to pinpoint the exact problem yet.
So I thought I could maybe write some PowerShell script to add the App to all subsites, but it seems the method require some parameters that somehow don't seem right. For example, Install-SPApp requires a SPApp object that is obtained with Import-SPAppPackage. Even if I manage to launch the command with the .sppkg file stream, when you launch Install-SPApp an exception occurs: "Install-SPApp : Value cannot be null.".
Honestly I'm running out of ideas.
TL;DR: Has anyone had issues with SharePoint 2016 and globally deployed client web parts? Is it possible to automatically add the app containing one or more client web parts to all subsite on SharePoint 2016?

How To ADD Firefox Default Applications

So I'm trying to find a way to add default file extensions options to Firefox. Since for whatever reason it doesn't give you the option?
Example: Settings > General > Applications
I want to add new content types and then be able to select my default application of choice.
The current issue is, that I use an MSP client that when necessary allows us to remote into a client's workstation for troubleshooting. Normally one would just click on the "Start Remote Session," button, and it brings up the application to do so. However, since it operates in some form of Javascript (I think....?), it doesn't technically download a file for me to save and then execute through the app. It just opens the app automatically. It never gives me the option to save the a file or anything like that, that it would use for the Remote Session app.
So I want to figure out how to bypass this issue by just adding the extension needed for this process in Firefox's default content types.
Works on Windows, I'm currently on Linux. (So please don't tell me to not use linux or any form there of. That or to use wine or playonlinux. I already am)

Launch a local file with default file handler from chrome packaged app (or extension)

I'm building a launcher for internal use with a Chrome packaged app which includes links to internal resources (databases, web links, etc.).
The problem is with local files. I want them to launch using whatever program is the default handler for them. For example, access databases open in Access, etc.
I've tried:
Creating a file link file:///. Nothing happens in this scenario on click and the link is not followed.
I found an extension (locallinks) here: https://code.google.com/p/locallinks/, which will open local file links. I've tried borrowing from that extension and passing the file link to the background script in my packaged app which would then open a new window with that url. Unfortunately, that results in a file not found, even for simple types such as text files. So obviously the local filesystem is sandboxed. Not surprising.
I thought maybe it would work to pass the link to an extension to open, but in that case, the file would be opened in Chrome and if Chrome does not support it, it would attempt to download the file locally.
The reason I'm using Chrome Packaged Apps is:
1. This will be updated often and the Chrome Web Store update feature would make it easy to keep clients updated without having to build our own update mechanism.
2. We can restrict installation of the app through CWS to internal users.
3. The app would be used in a Windows, Linux and Mac environment. Obviously the file paths here would be different but since they would point to a samba share, and mount points and network share drive's are known this is an easy problem to overcome.
4. There is additional functionality we will be building into the Chrome app in the future other than the launcher which fits very well with how Chrome Apps are designed.
My thoughts are:
Native Client? I have read a bit about these, but I think I would end up with the same limitations where the native client app would be sandboxed and may not actually have any better way of launching a local file.
Sockets? Maybe a simple Qt app listening on a socket to launch apps? Since the Qt app would be run with user permissions, and the socket would only accept connections from localhost, I guess the socket could in theory be used by a non-privileged app to launch something with user-level permissions. Is there a way for me to limit connections through the socket to only be accessible from my extension?
The sockets solution isn't ideal but may work since the app would not be updated often (if ever) since functionality is so simple.
Am I missing an obvious way of doing this that wouldn't require another component (a Qt app?)
Relating to your thought #2, not sure what local installation footprint you are willing to tolerate, but you may consider:
Hosting a miniscule local web server, or Qt app as you mention, which can also launch local programs (any of those lightweight web server frameworks). Have your packaged app, or your own chrome extension rewrite links such that they point at your web server along with the url of the original link, which can easily launch whatever program. Downsides: this may cause bypassing some browser security screening of the original links in some forms of implementation.
You may also look at this stackoverflow question if it helps.
You can limit access by confirming the requests originate from the local machine, or by embedding a key or hash inside your chrome extension. You may generate the key upon installation so that it's unique per machine. None of this will pass very proper security scrutiny so it depends on your risk profile. You will have a hard time justifying how each part is secure and clean of exploitation attack potential.
It seems you will need both a chrome extension and a local miniscule web server to make this work. Maybe it's easier to let users just download the files and click them...
Sorry if this isn't help enough, but basically you are trying to do something that is by design not made possible in Chrome, so at this state of affairs there would likely not be a simple solution.

Changing app identity when app is created from another base app

I created an app for imaging application to start with.
Now I had to build another app which uses a lot of functionalities of the previous app.
I copied and pasted the first project, and changed the app Display Name, etc. in WMAppManifest.xml file.
But now when I try to deploy this app, I notice that the first app is replaced by this second one.
How can I resolve this? I suppose I require a different product/publisher ID for this app in Packing section. How do I obtain these?
You don't need to "obtain" these IDs. When you submit your app to the marketplace, they are automatically replaced by the appropriate values. When developing on your computer, just put whatever value you want. The values are located in the application manifest (WMAppManifest.xml).
You can create a GUID in Visual Studio by going in the "Tools" menu, then clicking on "Create GUID".
You need to change the product ID (it's a GUID you can generate a new one).

WF4 hosting conversion of self hosting console app to service hosted in IIS

I have a console application project which is a workflow service self hosted using WorkflowServiceHost. It contains a flowchart workflow definition (xaml) and some custom activities in cs files. This application connects (via a service reference) to a WCF data service hosted as .svc. I have an aspnet web app that interacts with the workflow service via a service ref. It's all working fine.
I'd like to convert the workflow service console app to instead be hosted on IIS (I'm developing using IIS5 and the live environment is IIS6) but am unsure how to go about it. I tried creating a WCF WorkflowService Application project and copying my xaml (changing to xamlx - not sure if I needed to do that or not) and cs files in, and created a service reference to my WCF data service but when I tried to browse the xamlx I got an error "Cannot create unknown type x" x being a type that it should be able to "see" via the service reference it has.
What are my options for hosting - do I have to use WorkflowServiceApplication or can I host using .svc? Can someone point to a tutorial or talk me through what I need to do? Also I would like to have the workflow definition in a class library project if possible, thus separating it from its host. Not critical though.
A XAML and XAMLX file are almost the same but not quite. The XAML file results in a class being generated to wrap the XAML and you work with that type as if it is a normal class. A XAMLX file is not compiled and parsed at runtime. The root element is also different for the two and the XAMLX has no x:Class attribute because it isn't compiled.
The easiest way is to just create a XAMLX file and copy the activities from the XAML file into the XAMLX file.

Resources