How set auto day/night mode google maps in Xamarin Forms - google-maps

I need to set the night mode Google maps, which will work automatically using the sensor in the phone and manual using the switch. I need some example or documentation

Install the Xamarin.Forms.GoogleMaps Nuget Package (source code available on GitHub)
which has already implemented it on Xamarin.Forms.
You can refer to the MapStylePage sample available here which basically explains you how to create original map styles using MapStyle With Google. You can use the wizard, select the Night theme from there and get the corresponding json style, which you'll use on your Xamarin app.

int currentNightMode = getResources().getConfiguration().uiMode
& Configuration.UI_MODE_NIGHT_MAS
switch (currentNightMode) {
case Configuration.UI_MODE_NIGHT_NO:
// Night mode is not active, we're in day time
case Configuration.UI_MODE_NIGHT_YES:
// Night mode is active, we're at night!
case Configuration.UI_MODE_NIGHT_UNDEFINED:
// We don't know what mode we're in, assume notnight
}

Related

In a forge web app, trying to get the unit's old short name from the new Revit 2021 units

I am developing a web application (using javascript) which uses forge viewer API.
In the application I display values of certain properties to the user.
I use Autodesk.Viewing.GuiViewer3D.getProperties to get the properties and from there find he specific property I want.
I believe I get an object of type PropertyResult (https://forge.autodesk.com/en/docs/viewer/v7/reference/globals/PropertyResult/) for this example will assign it to "prop".
Then I display the property value with the unit by (assuming I know it is a number and has units):
var res = prop.displayValue.toFixed(2) + " " + prop.units;
This worked as we wanted when used on models from revit 2019 or 2020.
Showing for example:
"102.79 m^2"
However in model from revit2021 it will show:
"335.59 autodesk.unit.unit:squareMeters-1.0.1"
I realize this happened because of the unit change in RevitAPI for 2021, however I have been trying to find a JS method to get the user friendly name from the new Autodesk unit type and wasn't able to find one.
Will appreciate if anyone can direct me to that method or offer an alternative solution.
Thank you,
This is a known problem that we've discovered recently. Unfortunately, there's no official workaround, and so if you need to compose measurements with units, for now you would have to map the Revit 2021 unit IDs to their display variants, e.g., mapping autodesk.unit.unit:squareMeters-1.0.1 to m^2.
Please stay tuned to the Model Derivative service changelog.

Viewing console output from TVJS

I'm working with the tvOS beta 3 and trying to do some basic debugging on the tvml/tvjs side of things.
Messages logged via console.log(...) in my js files don't appear in the main Xcode output window.
Is there somewhere else I can find these messages or a setting which needs to be configured?
You should actually use the debug console in Safari. (The developer forum suggests you use Safari 9 and upgrade to El Capitan, both of which I have so haven't been able to test with inferior version)
Open Safari > Develop menu > Simulator
Your app name should appear here once and from there you can use the console.
Give it a few seconds to appear, it's not always instantaneous.
You must give a name to the Bundle Identifier in General/Identity (com.yourcompany.appname) to appear the app in the developers tool.
If you are developing a hybrid application (TVML/TVJS + Swift) with TVMLKitchen you can implement a logging function in Swift and use it in the TVJS code. For my projects I use the following code:
Kitchen.appController.evaluateInJavaScriptContext({context in
let printInJS : #convention(block) (NSString!) -> Void = {
(string : NSString!) -> Void in
print("Log: \(string)\n")
}
context.setObject(unsafeBitCast(printInJS, AnyObject.self), forKeyedSubscript: "printInJS")
})

How to do Chart on Windows Phone Universal App

I'm new Windows Phone Universal App, I need to implement bar/pie chart.
Tried many dll, Metro UI, WinRtXamlToolKit and WinRtXamlToolKit.Controls.DataVisualization
These dll are not working.
Give me good idea to do this on Windows Phone Universal App. How to do chart programmatically.
Thanks
I believe the Telerik has some Chart libraries that cost money ( can't link though as stackoverflow only permits me to post 2 links ( less than 10 rep) ). I have not used it and it is in Beta version at the moment. Google "Rad Chart windows universal apps" and you can read about it.
When I have needed charts for universal apps i have used the Google Chart Tools. You can use https://developers.google.com/chart/image/ even though Google is not developing on it anymore. It is is freakingly easy to use if you do not want to spend time drawing your own Charts. With the API you can request a chart just through a http request. You can setup almost everything and it's really easy to use thanks to the well documented API.
Here is an example of a bar chart i made using the API.
http://chart.googleapis.com/chart?chtt=Karakterfordeling&cht=bvg&chof=png&chs=300x300&chxt=x,y&chco=0076A3&chf=bg,s,65432100&hxr=0,0,50&chxl=0:|2|4|7|10|12&chxr=1,0,20&chbh=40,0,10&chd=t:2,60,70,10,90
All the arguments are passed through the http request and you can set your Chart up using the Live Chart Playground:
These are the arguments for the http request posted above. You can use the Live Chart Playground to set up parameters like below.
chtt=Karakterfordeling
cht=bvg
chof=png
chs=300x300
chxt=x,y
chco=0076A3
chf=bg,s,65432100
hxr=0,0,50
chxl=0:
2
4
7
10
12
chxr=1,0,20
chbh=40,0,10
chd=t:2,60,70,10,90
In code you set the http string as your ImageSource. You can manipulate the http string in your code and adapt the chart parameters/data if needed. I would recommend using a Converter that you bind to from you XAML. Pass your data to the converter and let it return a ImageSource with the http request. If you are new to Converters you can probably find a few posts about it here on stackoverflow.
Don't use DLLs grab the files into your project.
Add WinRTXamlToolkit.Controls.DataVisualization.csproj to your solution and reference it in the main project and add this to your page.
xmlns:charting="using:WinRTXamlToolkit.Controls.DataVisualization.Charting"
xmlns:datavis="using:WinRTXamlToolkit.Controls.DataVisualization"
Look at the samples project http://winrtxamltoolkit.codeplex.com
Unfortunately, winrtxamltoolkit is only for WinRT; VS 2013 doesn't allow adding of project references of that kind to WinPhone projects.

Google map supports ArcGISDynamicMapServiceLayer from ESRI API?

i believe that in google API version 2, it could eventually call this method out. Moreover they do share or happen to be using the same type of coding.
However in version 3, i could not set this layer to the map neither via "layer.setMap(map)" because this esri method does not has this function , nor "map.addOverlay(layer)" because this function belongs to version 2 which has been taken down. can i ask what is the method replacing "map.addOverlay(layer)" in version 3. i have try using custom overlay function, but is comes out as a image which doesn't match the result i want.
** take note : ArcGISDynamicMapServiceLayer is to call a time aware data layer from esri
Have a look at these examples:
http://gmaps-utility-gis.googlecode.com/svn/trunk/arcgislink/docs/examples.html

Is there a way to target specific file in Box app on IOS through box:// url scheme?

Box:// seems to open the app, however I am not able to discern how to target a specific file.
Currently we don't have support for this, but it is a great idea that we'll consider for our roadmap.
We actually do support this. The best way to add this integration into your app is to use our OneCloud AppToApp framework (additional information available here http://developers.box.com/the-box-sdk-for-onecloud-on-ios/)
This is easy using the app-to-app framework. You just need to call BoxAppToAppAPI's sendFileDownloadRequestToApplication:withMetaData: if you want an app to go to a particular file and in Box's case download/preview it.
To make it go to the Box app you can simply pass in [BoxAppToAppApplication BoxApplication] in the first parameter.
As for the metadata parameter, you can create it with BoxAppToAppFileMetadata's appToAppFileMetadataWithFileName:fileExtension:folderPath:mimeType:fileID:folderPathByID:exportToken:username:
Assuming your app already integrates with the Box API via the SDK or otherwise, it should be able to get all of that information easily.
If the mimeType is not known, nil can be passed in. Also, nil can be passed in for the exportToken if the file was not exported out of the Box app (with the AppToApp framework, a roundtrip scenario is also supported where the user starts in the Box app, picks a file to view/edit/etc in your app, and then sends it back to Box to upload). So if it's not a round-trip, it's just a one-way from your app to Box, use nil for the exportToken.
Before doing this, you can also check if the Box app is installed by checking for [[BoxAppToAppApplication BoxApplication] isInstalled].
Below is a fictional example (the values are made up):
BoxAppToAppFileMetadata *metadata = [BoxAppToAppFileMetadata appToAppFileMetadataWithFileName:#"fileName"
fileExtension:#"png"
folderPath:#"All Files/Folder1"
mimeType:nil
fileID:[NSNumber numberWithLongLong:123456]
folderPathByID:#"0/12345"
exportToken:nil
username:#"username#email.com"]
BoxAppToAppStatus status = [BoxAppToAppAPI sendFileDownloadRequestToApplication:[BoxAppToAppApplication BoxApplication]
withMetaData:metadata];