How to override keys in Xamarin Android Manifest - google-maps

I'm using this guide to working with maps in Xamarin.
It says I should use different values of the key
<meta-data android:name="com.google.android.maps.v2.API_KEY"
android:value="AbCdEfGhIjKlMnOpQrStUvWValueGoesHere" />
for debug and release builds; the debug version should use an API key that contains SHA-1 certificates from debug.keystore, which has well-known default passwords.
In live mode, I should use SHA-1 certificates from my custom keystore files, whose passwords only I know. The live API key and SHA-1 certificate work in the live APK, but not in the debug build. This makes sense, I guess. I should have one Google Android API key for debugging, and one for production.
What I don't want to do is have this in my AndroidManifest.xml file:
<meta-data android:name="com.google.android.maps.v2.API_KEY"
android:value="<My Debug API Key>" />
<!--<meta-data android:name="com.google.android.maps.v2.API_KEY"
android:value="<My Release API Key>" />-->
...changing the commented out section depending on whether I'm doing a debug or release build. Is there a more efficient way to do this (something like config transforms in ASP.NET applications)?
I've done some searching, and there are some automatically applied debug overrides, but it doesn't seem like I have a great deal of control over the process.

You can use assembly level MetaData attributes to define tags within the Manifest's Application element and by using conditional compilation:
#if DEBUG
[assembly: MetaData("com.google.android.maps.v2.API_KEY", Value = "DebugKEYValue")]
#else
[assembly: MetaData("com.google.android.maps.v2.API_KEY", Value = "ReleaseKEYValue")]
#endif
Depending upon build type, this will result in:
<application android:allowBackup="true" android:icon="#mipmap/icon" android:label="#string/app_name" android:name="android.app.Application" android:debuggable="true">
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="DebugValue" />
Or:
<application android:allowBackup="true" android:icon="#mipmap/icon" android:label="#string/app_name" android:name="android.app.Application">
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="ReleaseKEYValue" />

Related

Use Corona renderer for rendering models in Autodesk Forge

We are trying to use forge to render 360 view images for furniture models. Unfortunately, we need to use corona plugin for it. But while attaching dll files like we see in documentation - we still see an issue.
[08/17/2021 15:07:15] 8/17/2021 15:07:15 PM; DLL <t:\aces\applications\7b3e91f490aad59bb1502fc04a07ae97.ngrdh8rpmufavx5peithdvrycazwjxfq.renderall_1629212808[1].package\renderingtools.bundle\content\2021\CoronaMax2021.dlr> failed to initialize properly - not loading.
[08/17/2021 15:07:15] 8/17/2021 15:07:15 PM; DLL <t:\aces\applications\7b3e91f490aad59bb1502fc04a07ae97.ngrdh8rpmufavx5peithdvrycazwjxfq.renderall_1629212808[1].package\renderingtools.bundle\content\2021\CoronaMaxUtils2021.dlt> failed to initialize properly - not loading.
[08/17/2021 15:07:30] 8/17/2021 15:07:30 PM; Initializing Python version: 3.7.6
[08/17/2021 15:07:30] 8/17/2021 15:07:30 PM; WARNING Missing dll: coronamaxutils2021.dlt - CoronaMtl
[08/17/2021 15:07:30] 8/17/2021 15:07:30 PM; WARNING Missing dll: coronamaxutils2021.dlt - CoronaLayeredMtl
[08/17/2021 15:07:31] 8/17/2021 15:07:31 PM; WARNING Missing dll: coronamaxutils2021.dlt - CoronaColor
[08/17/2021 15:07:31] 8/17/2021 15:07:31 PM; WARNING Missing dll: coronamax2021.dlr - CoronaRenderer
[08/17/2021 15:07:32] 8/17/2021 15:07:32 PM; MAXScript ExecuteMAXScriptScript Exception: -- Runtime error: Unable to open renderer, possible recursion; Error occurred in anonymous codeblock; filename: t:\aces\applications\7b3e91f490aad59bb1502fc04a07ae97.ngrdh8rpmufavx5peithdvrycazwjxfq.renderall_1629212808[1].package\renderingtools.bundle\content\RenderingTools.ms; position: 442; line: 15
And nothing renders, obviously. I include plugin files as described in the docs.
<?xml version="1.0" encoding="utf-8"?>
<ApplicationPackage SchemaVersion="1.0" AutodeskProduct="3ds Max" ProductType="Application" ProductCode="3ds Max Rendering Tools Plugin" UpgradeCode="My UpgradeCode">
<CompanyDetails />
<Components Description="post-start-up scripts parts">
<RuntimeRequirements OS="Win64" Platform="3ds Max" SeriesMin="2020" SeriesMax="2023" />
<ComponentEntry AppName="RenderingTools" Version="1.0.0" ModuleName="./Content/RenderingTools.ms" />
</Components>
<Components Description="plugins parts">
<RuntimeRequirements OS="Win64" Platform="3ds Max" SeriesMin="2020" SeriesMax="2021" />
<ComponentEntry AppName="CoronaRenderer" ModuleName="./Content/2021/CoronaMax2021.dlr" />
<ComponentEntry AppName="CoronaUtils" ModuleName="./Content/2021/CoronaMaxUtils2021.dlt" />
</Components>
<Components Description="light icon paths parts">
<RuntimeRequirements OS="Win64" Platform="3ds Max" SeriesMin="2020" SeriesMax="2021" />
<ComponentEntry ModuleName="./Content/2021/UI/Icons/" />
</Components>
<Components Description="dark icon paths parts">
<RuntimeRequirements OS="Win64" Platform="3ds Max" SeriesMin="2020" SeriesMax="2021" />
<ComponentEntry ModuleName="./Content/2021/UI/IconsDark/" />
</Components>
</ApplicationPackage>
First, Corona is a third party render and from a licnesing perspective, you might want to double-check this is acceptable use case. Especially if they use some sort of "online" licensing, as the Design Automation environment will not allow the module to check for licensing via the internet. As long as it can be automated (without any UI interactions required) and licensing is not an issue, it could work.
Next, I would suggest to first try getting it working with a built-in 3ds Max renderer just for the steps (perhaps ART or Arnold). Do not worry about materials, etc, but get your script working without corona to be sure you have the automation worked out.
Then, you could try to work out the Corona issues (and no guarantees it can work because again it is a third party tool.) It might be obvious, but to be sure... From the ApplicationPackage it appears to be setup like an app store bundle. For 3ds Max Design Automation, you would need to also be sending all the necessary modules, and make sure the path is setup correctly to find them in your app bundle zip. An example for that is here: https://learnforge.autodesk.io/#/designautomation/appbundle/engines/max (see the PackageContents section). Note that similarly the app bundle is setup to load from a "contents" folder, but the modules must also be provided in the app bundle zip in the correct location. Another example is provided here: https://github.com/kevinvandecar/design.automation.3dsmax-csharp-meshoptimizer (use the deploy01 branch). You can find this example's bundle here: https://github.com/kevinvandecar/design.automation.3dsmax-csharp-meshoptimizer/tree/deploy01/forgesample/wwwroot/bundles. Note that the zip contains the folder structure and all the needed modules for the plugin.
Design Automation will not load interface plugins, i.e. anything with icons, forms, user interactions.
From the output, the CoronaMax2021.dlr is failing to load.

gdx-pay amazon integration

I'm trying to implement gdx-pay for Amazon, but I can't find any info for that.
First problem is when I try to register receiver on manifest fileI get this error :
Unresolved class 'ResponseReceiver'
here is my full code:
<receiver android:name="com.amazon.device.iap.ResponseReceiver">
<intent-filter>
<action
android:name="com.amazon.inapp.purchasing.NOTIFY"
android:permission="com.amazon.inapp.purchasing.Permission.NOTIFY" />
</intent-filter>
</receiver>
In my gradle file I use this dependencies : Configure dependencies using Gradle
Second, when I try to register store I don't know what key should I pass here:
purchaseManagerConfig.addStoreParam(PurchaseManagerConfig.STORE_NAME_ANDROID_AMAZON, "key_here?");
Is there any working simple for gdx-pay Amazon store integration?
Thanks
An example app was added and is linked in the main readme.

PhpStorm unable to resolve symbol 'doctrine.orm.entity_manager'

When I open the services.xml in PhpStorm with Symfony Plugin enabled, it's able to resolve all the services, I can Ctrl+Click and go the Service Definition , except doctrine.orm.entity_manager.
It says unable to resolve symbol 'doctrine.orm.entity_manager'
Here is the services.xml file
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="example_manager" class="Vendor\XysBundle\Manager\ExampleManager">
<argument type="service" id="doctrine.orm.entity_manager" />
</service>
</services>
</container>
PhpStorm Details:
PhpStorm 2016.3.1
Build #PS-163.9735.1, built on December 6, 2016
JRE: 1.8.0_112-release-408-b2 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
appDevDebugProjectContainer.xml file exists in the app/cache directory .
How can I get get this working ?
I have the same issue. If you open up the vendor\doctrine\doctrine-bundle\Resources\config\orm.xml file where doctrine services are defined, you can see, there is no service with the id "doctrine.orm.entity_manager" but only "doctrine.orm.entity_manager.abstract"
The definition looks like:
<service id="doctrine.orm.entity_manager.abstract" class="%doctrine.orm.entity_manager.class%" abstract="true" />
As you can see the abstract attribute is set to true. This means this service can serve as a parent of other services, and when you define child services with this abstract parent you don't have to define the method calls or the parameters injected into the constructor for example, instead these definitions will be inherited from the parent.
If you investigate a bit deeper you will find that %doctrine.orm.entity_manager.class% is defined in the same file as a parameter that actually references to the Doctrine Entity Manager:
<parameter key="doctrine.orm.entity_manager.class">Doctrine\ORM\EntityManager</parameter>
So I guess we should use doctrine.orm.entity_manager.abstract, however doctrine.orm.entity_manager is recognised as well, although I don't know how.
For further explanation of abstract service definitions have a look at this Symfony doc page: https://symfony.com/doc/current/service_container/parent_services.html

Azure role configuration management

I don't see how Windows Azure lets you vary the configuration of an application when you have no choice but to hold configuration settings in web.config (or app.config).
For example...
Quite often projects will make use of a 3rd party library that makes heavy use of web.config. The use of web.config may involve connection strings, app settings or custom configuration sections. A good example of this is ELMAH. A web.config file for ELMAH might look like the following:
<configuration>
<configSections>
<sectionGroup name="elmah">
<section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
<section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
</sectionGroup>
</configSections>
<connectionStrings>
<add
name="MyElmahDatabase"
providerName="System.Data.SqlClient"
connectionString="Server=tcp:myServer.database.windows.net,1433;Database=myDB;User ID=user#myServer;Password=password;Trusted_Connection=False;Encrypt=True;Connection Timeout=30" />
</connectionStrings>
<elmah>
<security allowRemoteAccess="1" />
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="MyElmahDatabase" />
</elmah>
</configuration>
There are a couple of problems here:
There is no way for me to update or vary whether remote access is enabled between Service Configurations.
There is no way for me to update or vary the ELMAH connection string between Service Configurations.
This is because the web.config is packaged as is into the .cspkg file and ELMAH will not look at the Service Configuration settings (which are the only way I can vary configuration settings between Service Configurations).
I can think of many other examples where this is a problem...
Any data access frameworks that look directly at the connection strings section.
Any custom configuration settings I need to create.
...to name just two.
Am I missing something or is this a significant gap in the configuration management offered by Windows Azure?
EDIT
From the answer and comments below, it looks like this is something that is not well supported. I think that managing multiple solution build configurations to support different configuration profiles is a very weak solution. I should not have to rebuild the solution for each configuration profile I need (there will likely be quite a few). Compilation is not equal to configuration.
I was wondering if there was a way to modify the .cspkg file as it is just a zip file. According to this documentation you can on Linux.
I've looked at the manifest in the .cspkg file and it looks like this:
<PackageManifest version="2">
<Encryption keytype="1" />
<Contents hashtype="1">
<Item name="MyApp.Web.UI_<GUID>.cssx" hash="AED69299C5F89E060876BC16BD3D6DE5130F6E62FFD2B752BAF293435339B7E2" uri="/MyApp.Web.UI_<GUID>.cssx" />
<Item name="MyApp.Web.Services_<GUID>.cssx" hash="7AC81AFF642E4345173C8470C32A41118A4E3CFD4185B82D0ADA44B71057192D" uri="/MyApp.Web.Services_<GUID>.cssx" />
<Item name="SMPackage_<GUID>.csmx" hash="B5E6B83B62AF64C7C11CAC1A394ABBF15D7DB7667A773C5284CE5BE95C5834E9" uri="/SMPackage_<GUID>.csmx" />
<Item name="SDPackage_<GUID>.csdx" hash="F34B7C02A551D82BAD96881E2DA9447D0014D49B47CCB3840475BDC575234A7D" uri="/SDPackage_<GUID>.csdx" />
<Item name="NamedStreamPackage_<GUID>.csnsx" hash="FA2B5829FF5D9B2D69DCDDB0E5BDEE6B8B0BC09FFBF37DAEEE41CF3F3F4D0132" uri="/NamedStreamPackage_<GUID>.csnsx" />
</Contents>
<NamedStreams>
<Stream name="RequiredFeatures/MyApp.Web.Services/1.0" />
<Stream name="RequiredFeatures/MyApp.Web.UI/1.0" />
<Stream name="SupportData/MyApp.Web.Services/1.0" />
<Stream name="SupportData/MyApp.Web.UI/1.0" />
</NamedStreams>
</PackageManifest>
Unfortunately, if I re-compute the hash of the unchanged "MyApp.Web.UI_.cssx" file, my hash is different from the one in the manifest.
Hash from manifest: AED69299C5F89E060876BC16BD3D6DE5130F6E62FFD2B752BAF293435339B7E2
My calculated hash: E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855
Note that I have not yet changed the file, so the hash should be the same.
This suggests I'm calculating it wrong. My method was as follows:
class Program
{
static void Main(string[] args)
{
using (FileStream fs = new FileStream(args[0], FileMode.Open))
{
ComputeHash(new SHA256Managed(), fs);
}
}
private static void ComputeHash(HashAlgorithm hashAlgorithm, Stream stream)
{
byte[] hash = hashAlgorithm.ComputeHash(stream);
string hashString = BitConverter.ToString(hash);
Console.WriteLine(hashString.Replace("-", string.Empty));
Console.WriteLine();
}
}
The documentation link above, suggests it is straightforward to re-calculate the hash (on Linux anyway).
Does anyone know how to re-compute the hashes?
Passing a Stream to ComputeHash() ends up with a different hash as compared to using the byte[] overload. I don't know why.
Try something like:
private static void ComputeHash(HashAlgorithm hashAlgorithm, Stream stream)
{
BinaryReader reader = new BinaryReader(stream)
byte[] hash = hashAlgorithm.ComputeHash( reader.ReadBytes( (int)stream.Length ) );
string hashString = BitConverter.ToString(hash);
Console.WriteLine(hashString.Replace("-", string.Empty));
Console.WriteLine();
}
This will give you the hash you're after.
As you've probably already discovered, on linux you can get the digest with
openssl dgst -sha256 /path/to/file
I you have items in your web.config that you want to change depending on how it's being built, there is a solution that is outside of Azure that you can use. You can use Web.config transforms. These transforms are tied to your build configuration not your service configuration, but your service configurations a likely closely tied to your build configurations anyway (...Local.csfg -> Debug, ...Cloud.csfg -> Release). If the default build configurations don't work for you, just create the ones you need.
If you want to use different service definitions per service configuration, then it's not supported by the UI, but you can mess around with the build process to make it work

How can I add Snapshot and test variations to my ivy.xml

I'm using ant+ivy+nexus to build and publish my java OSGi projects (just good old jars if you're unfamiliar with OSGi). After the usual mind-melting period one has when engaging with new tech I've got a mostly functional system. But, I now have two dimensions of artifact variation: snapshot/release and main/test.
The main/test dimension speaks for itself really. The snapshot/release is essential for publishing into nexus in a maven-friendly way. (Extremely useful for integration with open-source OSGi runtimes). So, I have the following artifacts on a per-project basis, and I have many many projects:
project-revision.xml (bp)
project-test-revision.xml (b)
project-revision-SNAPSHOT.xml (bp)
project-test-revision-SNAPSHOT.xml (b)
b = successfully building
p = successfully publishing
(I haven't yet got the test stuff publishing correctly)
It's taken me a while to get that far without duplicating code everywhere in my build scripts, but I've managed it... with one big caveat. For the SNAPSHOT branch I append "-SNAPSHOT" to all revisions. In ant I manage to achieve this programatically, but for ivy I'm using a duplicated ivy.xml; ivy-SNAPSHOT.xml. This has
<info ... revision="x.x-SNAPSHOT">
Notice the -SNAPSHOT. Without this I could never get my
<ivy:deliver>
<ivy:resolve>
<ivy:publish>
chain of commands to correctly publish artifact and maven pom. (Remember I have a requirement to make this maven friendly... I'll be damned if I actually end up using maven to build it mind!)
Now I'm stuck introducing the test/main dimension. I'm ideally looking to publish
project-test-revision(-SNAPSHOT).jar
(Note the optional snapshot). I really don't want to do this by specifying
<info ... module="project-test" ... >
as opposed to <info ... module="project" ... > in yet another ivy file. If I went this route (like I've already started) then I simply end up with loads of ivy-Option1-Option2...-OptionN.xml files. With each new two-value variation doubling the number of build and ivy files. That's crap. There's got to be a better way. I just can't find it.
If you have managed to successfully get ivy publishing artifacts with embellished names from one ivy file, would you mind posting the configuration snippets that achieve this? Would be extremely useful. (Don't forget maven won't know about configurations so I need to get the variations into the filename and pom).
Many thanks
Alastair
Ok, update: I've now got the artifact publishing. I struggled a little while I had the test conf extending the default conf. I'd get a complaint during publishing that the default configuration artifacts weren't present... something I don't care about while only publishing the test case. By making them independent but overlapping I get back fine-grain control of what to publish.
BUT!!!!! There's no viable test pom - that's NOT publishing yet. Well, actually it does publish, but it contains data for the non-test case. So this is still not maven friendly. If anyone has suggestions on this that'd be great.
either way, the code I'm now using, in case it helps you too:
ivy.xml:
<info
organisation="MY_ORGANISATION"
module="MY_PROJECT"
status="integration"
revision="1.0-SNAPSHOT">
</info>
<configurations>
<conf name="default" description="Default compilation configuration; main classes only" visibility="public"/>
<conf name="test" description="Test-inclusive compilation configuration. Don't forget to also add Default compilation configuration where needed. This does not extend default conf" visibility="public"/>
</configurations>
<publications>
<artifact name="MY_PROJECT type="jar" ext="jar" conf="default"/>
<artifact name="MY_PROJECT type="pom" ext="pom" conf="default"/>
<artifact name="MY_PROJECT-test" type="jar" ext="jar" conf="test"/>
<artifact name="MY_PROJECT-test" type="pom" ext="pom" conf="test"/>
</publications>
<dependencies>
<dependency org="MY_ORGANISATION" name="ANOTHER_PROJECT" rev="1.0-SNAPSHOT" transitive="true" conf="*"/>
<dependency org="junit" name="junit" rev="[4,)" transitive="true" conf="test->*"/>
</dependencies>
build.xml:
<property name="project.generated.ivy.file" value="SNAPSHOT_OR_RELEASE_IVY_XML_FILE" />
<property name="ivy.publish.status" value="RELEASE_OR_INTEGRATION" />
<property name="project.qualifier" value="-SNAPSHOT_OR_EMPTY" />
<property name="ivy.configuration" value="DEFAULT_OR_TEST" />
<target name="publish" depends="init-publish">
<ivy:deliver
deliverpattern="${project.generated.ivy.file}"
organisation="${project.organisation}"
module="${project.artifact}"
status="${ivy.publish.status}"
revision="${project.revision}${project.qualifier}"
pubrevision="${project.revision}${project.qualifier}"
conf="${ivy.configuration}"
/>
<ivy:resolve conf="${ivy.configuration}" />
<ivy:makepom
ivyfile="${project.generated.ivy.file}"
pomfile="${project.pom.file}"
/>
<ivy:publish
resolver="${ivy.omnicache.publisher}"
module="${project.artifact}"
organisation="${project.organisation}"
revision="${project.revision}${project.qualifier}"
pubrevision="${project.revision}${project.qualifier}"
pubdate="now"
overwrite="true"
publishivy="true"
status="${ivy.publish.status}"
artifactspattern="${project.artifact.dir}/[artifact]-[revision](-[classifier]).[ext]"
conf="${ivy.configuration}"
/>
</target>