Hide status bar in UWP - windows-10

I have used below code to hide status bar in UWP. When I run the app in development mode in my computer the status bar is not shown in windows phone. I deployed the app in Windows Store, after downloading the app, I see the status bar appears in my app.
Here is my code:
var isAvailable = Windows.Foundation.Metadata.ApiInformation.IsTypePresent(typeof(StatusBar).ToString());
if (isAvailable)
hideBar();
async void hideBar()
{
StatusBar bar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
await bar.HideAsync();
}
The question is, why the above code shouldn't work in windows store?
Also, I have the link to my app App link in windows store, but when i search for exact key word in windows store, my application is not shown in windows store, but clicking in link would appear my app in window store.
Thanks!

Checking for the Contract, rather for the type StatusBar works fine for me.
private async Task InitializeUi()
{
// If we have a phone contract, hide the status bar
if (ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1, 0))
{
var statusBar = StatusBar.GetForCurrentView();
await statusBar.HideAsync();
}
}

You have to use FullName instead of ToString():
...
ApiInformation.IsTypePresent(typeof(StatusBar).FullName);
...

This code won't work because after .Net Native compilation (which Store does) typeof(StatusBar).ToString() will not return the literal type name as you expect, but will return something like "EETypeRVA:0x00021968". Use literal string instead (you aren't going to rename StatusBar, right? ;) or use IsApiContractPresent or typeof(StatusBar).FullName (as was already advised).
P.S. The same issue can be reproduced without publishing, just run it using Release configuration.

Could it be that when you compile in Release and with the .NET Native toolchain, the type info gets discarded and so you're not passing the string you think you're passing? Maybe you can try hard-coding the full type name?

In Windows 10 the command is
Window.Current.SetTitleBar(null);

Related

Adaptive Card QuickView Navigation not firing

Ok, so I'm just getting started with adaptive cards and downloaded the PNP ACE project (Git Hub Link) to use as a jumping off point. Started the project up and ran gulp serve.... everything seemed great.... until I tried to click either the View Items or Add Item buttons on the CardView. Both of these buttons fire QuickViews, but when you click them nothing happened. Tried 2 different browsers, no errors registered in the console, it just acts like there isn't an action tied to the buttons.
So, thinking "well maybe something got screwed up in a commit", I started a brand new project using yeoman.
Got the project set up, building and served it up; EXACT SAME PROBLEM!! The button in the default ACE project template didn't work either. I can't figure out what gives.
Here is the function for the button that the template created :
public get cardButtons(): [ICardButton] | [ICardButton, ICardButton] | undefined {
return [
{
title: strings.QuickViewButton,
action: {
type: 'QuickView',
parameters: {
view: QUICK_VIEW_REGISTRY_ID
}
}
}
]};
That looks just like the PNP example (and every other example I've seen online). Even the quickViewNavigator is populated the same. Here is the one from the template project (class definitions removed to save space):
const CARD_VIEW_REGISTRY_ID: string = 'JasonAdaptiveTest_CARD_VIEW';
export const QUICK_VIEW_REGISTRY_ID: string = 'JasonAdaptiveTest_QUICK_VIEW';
public onInit(): Promise<void> {
this.state = { };
this.cardNavigator.register(CARD_VIEW_REGISTRY_ID, () => new CardView());
this.quickViewNavigator.register(QUICK_VIEW_REGISTRY_ID, () => new QuickView());
return Promise.resolve();
}
So what gives? Why do these not work? Is there some NPM package that may be missing?
Well, found the line buried in the tutorials that explains my problem. A single note, in a page that isn't necessarily about quick views.
Note
ACE interaction is disabled while in Edit mode. The Workbench or Page must be >in Preview or Read mode to interact with the ACE.

getClipboard Content in Overlay Service not working on new Android version. Alternative?

I have an App that uses a floating overlay over other apps with a Search function.
Basic User Story is to copy a text to the clipboard, click on Overlay, and search for text in Clipboard.
this worked for a long time no Problem but with Android 10 it only works if the App is in the foreground.
If another App like Chrome is in the foreground the clipboard.getPrimaryClip() returns only a null pointer.
I guess they changed some permissions in Android. I searched on google and co but I didn't find any clues.
Is there an alternative way to get the Clipboard content event when I'm not in the App the overlay comes from? This kinda breaks the whole idea of that feature.
Technical Info: I'm extending the Service class and a WindowManager like this:
mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
this is how I get the clipboard text:
public String getClipboardText()
{
try {
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
if (clipboard.getPrimaryClip().getItemCount() > 0) {
return clipboard.getPrimaryClip().getItemAt(0).getText().toString();
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
return "";
}
It seems Android 10 changes privacy settings and there is no alternative way to access the clipboard text. its also not possible to request permission, because clipboard permission given by "READ_LOGS" permission is only allowed for system apps.

Remove terminal icon in node notifier

I am using the https://github.com/mikaelbr/node-notifier package to show notifications in shell.
This is my code:
var notifier = require('node-notifier');
var path = require('path');
notifier.notify({
title: 'My awesome title',
message: 'Hello from node, Mr. User!',
icon: path.join(__dirname, 'coulson.jpg'), // absolute path (not balloons)
sound: true, // Only Notification Center or Windows Toasters
wait: true // wait with callback until user action is taken on notification
}, function (err, response) {
// response is response from notification
});
notifier.on('click', function (notifierObject, options) {
// Happens if `wait: true` and user clicks notification
});
notifier.on('timeout', function (notifierObject, options) {
// Happens if `wait: true` and notification closes
});
The notification comes like this:
As you can see a terminal icon is coming before the name.
Can you help me how to remove that icon?
It is known issue with node-notifier.
From issue #71:
mikaelbr:
No, I'm afraid that's how the notification work, as it's the terminal that initiates the message. The only way to avoid this is to use your custom terminal-notifier where the Terminal icon is swapped for your own. It's not a big task, and you can easily set customPath for notification center reporter.
kurisubrooks:
This happens because of the way notifications in OS X work. The notification will show the referring app icon, and because we're using terminal-notifier to push notifications, we have the icon of terminal-notifier.
To work around this, you'll need to compile terminal-notifier with your own app.icns. Download the source, change out the AppIcon bundle with your own in Xcode, recompile terminal-notifier and pop it into node-notifier. (/node-notifier/vendor/terminal-notifier.app)
Now that you have your own terminal-notifier inside node-notifier, remove all the icon references from your OS X Notification Center code, and run the notification as if it has no icon. If the old app icon is showing in your notifications, you need to clear your icon cache. (Google how to do this)
Another valuable comment from mikaelb:
That's correct. But keep in mind, node-notifier uses a fork of terminal-notifier (github.com/mikaelbr/terminal-notifier) to add option to wait for notification to finish, so this should be used to add your own icon. A easy way to do it is to copy/paste from the vendor-folder and use customPath to point to your own vendor.
I tried #Aleksandr M's steps but it didn't seem to work for me. Maybe I didn't understand the steps well enough. Here's how it worked for me.
I cloned https://github.com/mikaelbr/terminal-notifier . Then opened the project with xcode and deleted the Terminal.icns file and replaced it with my custom icon Myicon.icns.
Then edited terminal-notifier/Terminal Notifier/Terminal Notifier-Info.plist by setting the key icon file to Myicon.
After doing this, simply building the project did NOT work. I had to change the values of the build version and build identifier (any new value would do) see this.
Afterwards I just built the project with xcode and then copied the built .app file (you can find it by clicking the Products directory of the project from xcode Products > right click the file > show in finder) to my electron project
e.g your final path may look like this. electron-project/vendor/terminal-notifier.app.
Then I set customPath as #Aleksandr M suggested.
Here's what mine looked like
var notifier = new NotificationCenter({
customPath: 'vendor/terminal-notifier.app/Contents/MacOS/terminal-notifier'
});
And THEN it worked! 🙂
This solved my problem and you only need to have your icns file ready:
run this command in terminal after downloading :customise-terminal-notifier
** path/customise-terminal-notifier-master/customise-terminal-notifier -i path/Terminal.icns -b com.bundle.identifier

where to put a while loop in a system tray application so that loop starts with the app

I have created a System Tray Application using Windows Forms Template (Visual C++) in Visual Studio 2008. I have used ContextMenuStrip and NotifyIcon. It's a managed code as I have used the form and Drag/Drop.
I want as soon as this System Tray Application starts, it starts polling for any new USB devices (from a specific vendor) connected.
The logic is ready except I don't know "Where to put this while(1) loop?"
It works fine in a console app that I made but now we want it to be integrated to the system tray app.
Here is the code snippet:
int numDevices, n = 0;
while(1)
{
Sleep(5000);
numDevices = usb_find_devices();
if(connectedDevices > numDevices)
{
enumDevices();
connectedDevices++;
}
}
It would really be appreciable if anyone could suggest me some pointers on how to proceed.
Thank you Hans! I added a new "Component Class" with WM_DEVICECHANGE and it is working fine.
Just in case anyone needs this info:
If a function needs to be called as soon as the Windows Forms App starts (Systray app in my case), the respective function can be called after the call to "InitializeComponent()" function. Though it is clearly mentioned "TODO: Add the constructor code here", still a beginner (like me) has inhibitions regarding "Where to put this Function Call??" Hope this helps somebody..

Flash trace output in firefox, linux

I'm developing an applications which I've got running on a server on my linux desktop. Due to the shortcomings of Flash on Linux (read: too hard) I'm developing the (small) flash portion of the app in Windows, which means there's a lot of frustrating back and forth. Now I'm trying to capture the output of the flash portion using flash tracer and that is proving very difficult also. Is there any other way I could monitor the output of trace on linux? Thanks...
Hope this helps too (for the sake of google search i came from):
In order to do trace, you need the debugger version of Flash Player from
http://www.adobe.com/support/flashplayer/downloads.html (look for "debugger" version specifically - they are hard to spot on first look)
Then an mm.cfg file in your home containing
ErrorReportingEnable=1 TraceOutputFileEnable=1 MaxWarnings=50
And then you are good to go - restart the browser. When traces start to fill in, you will find the log file in
~/.macromedia/Flash_Player/Logs/flashlog.txt
Something like
tail ~/.macromedia/Flash_Player/Logs/flashlog.txt -f
Should suffice to follow the trace.
A different and mind-bogglingly simple workaround that I've used for years is to simply create an output module directly within the swf. All this means is a keyboard shortcut that attaches a MovieClip with a textfield. All my traces go to this textfield instead of (or in addition to) the output window. Over the years I've refined it of course, making the window draggable, resizable, etc. But I've never needed any other approach for simple logging, and it's 100% reliable and reusable across all platforms.
[EDIT - response to comment]
There's no alert quite like javascript's alert() function. But using an internal textfield is just this simple:
ACTIONSCRIPT 1 VERSION
(See notes at bottom)
/* import ExternalInterface package */
import flash.external.*;
/* Create a movieclip for the alert. Set an arbitrary (but very high) number for the depth
* since we want the alert in front of everything else.
*/
var alert = this.createEmptyMovieClip("alert", 32000);
/* Create the alert textfield */
var output_txt = alert.createTextField("output_txt", 1, 0, 0, 300, 200);
output_txt.background = true;
output_txt.backgroundColor = 0xEFEFEF;
output_txt.selectable = false;
/* Set up drag behaviour */
alert.onPress = function()
{
this.startDrag();
}
alert.onMouseUp = function()
{
stopDrag();
}
/* I was using a button to text EI. You don't need to. */
testEI_btn.onPress = function()
{
output_txt.text = (ExternalInterface.available);
}
Notes: This works fine for AS1, and will translate well into AS2 (best to use strong data-typing if doing so, but not strictly required). It should work in Flash Players 8-10. ExternalInterface was added in Flash 8, so it won't work in previous player versions.
ACTIONSCRIPT 3 VERSION
var output_txt:TextField = new TextField();
addChild(output_txt);
output_txt.text = (String(ExternalInterface.available));
If you want to beef it out a bit:
var alert:Sprite = new Sprite();
var output_txt:TextField = new TextField();
output_txt.background = true;
output_txt.backgroundColor = 0xEFEFEF;
output_txt.selectable = false;
output_txt.width = 300;
output_txt.height = 300;
alert.addChild(output_txt);
addChild(alert);
alert.addEventListener(MouseEvent.MOUSE_DOWN, drag);
alert.addEventListener(MouseEvent.MOUSE_UP, stopdrag);
output_txt.text = (String(ExternalInterface.available));
function drag(e:MouseEvent):void
{
var alert:Sprite = e.currentTarget as Sprite;
alert.startDrag();
}
function stopdrag(e:MouseEvent):void
{
var alert:Sprite = e.currentTarget as Sprite;
alert.stopDrag();
}
[/EDIT]
If you only need the trace output at runtime, you can use Firebug in Firefox and then use Flash.external.ExternalInterface to call the console.log() Javascript method provided by Firebug.
I've used that strategy multiple times to a large degree of success.
Thunderbolt is a great logging framework with built-in firebug support.
I use the flex compiler on linux to build actionscript files, [embed(source="file")] for all my assets including images and fonts, I find actionscript development on linux very developer friendly.
Then again, I'm most interested in that flash has become Unix Friendly as aposed to the other way around :)
To implement FlashTracer, head to the following address and be sure you have the latest file. http://www.sephiroth.it/firefox/flashtracer/ . Install it and restart the browser.
Head over to adobe and get the latest flash debugger. Download and install the firefox version as FlashTracer is a firefox addition.
Now that firefox has the latest flash debugger and flash tracer we need to locate mm.cfg
Location on PC: C:\Documents and Settings\username
Inside of mm.cfg should be:
ErrorReportingEnable=1
TraceOutputFileEnable=1
MaxWarnings=100 //Change to your own liking.
Once that is saved, open firefox, head to the flash tracer window by heading to tools > flash tracer. In the panel that pops up there is two icons in the bottom right corner, click the wrench and make sure the path is set to where your log file is being saved. Also check to see that flash tracer is turned on, there is a play/pause button at the bottom.
I currently use this implementation and hope that it works for you. Flash Tracer is a little old, but works with the newest versions of FireFox. I am using it with FireFox 3.0.10.

Resources