I'm trying to get hot reload working on an existing xamarin.forms project, so I can deploy to my iOS devices directly without a mac.
I got this feature to at least show the 'Local Device' selection on a new project, but I can't get it to show this selection in the existing project therefore I cannot setup the hot reload.
Do you have any idea what might be the problem?
If it helps I also added the iOS project build properties.
Related
Starting from a standard Xamarin forms app template and changing the app icons in assets.xcassets, I am unable to make this take effect. The initial xamarin icon keeps showing when deployed to physical devices.
In assets.xcassets, I added all the required image sized.
I ensured that in plist info this asset was set as app icons source.
I have tried cleaning, rebuilding and deleting from the ipad and iphone I am testing with. No success.
I tried deleting the default asset and creating a new one, and make pinfo point to this, and still the old Xamarin icon shows up. This makes me think that there is a cache somewhere on either my windows pc, on which I am developing using vs2019, or on the mac which VS is connected to for doing the actual build, and this is not getting updated, since otherwise that old icon should not exist any longer.
I did read this answer
Xamarin forms: Launcher icon for ios
Which indicates that the OP has a problem with a mismatched path to the asset, but that does not seem to be the case for me. The xcasset folder is at the root of the ios project. As this is simply the default test project it is app1/App1.ios/Fawk.xcassets and the entry in pinfo is
XSAppIconAssets
Fawk.xcassets/AppIcons.appiconset
Does this make any kind of sense?
Edit: Tried vs2019, xamarin forms template. Deleted default asset in assetcatalogs under ios, created a new one, set all my custom icon images (png), updated info.plist/visual assets/appicon to my new asset and then ran it on a physical device. The default xamarin icon is what shows up. This seems to indicate it is not a cache issue, as I suspected, but... something else...
You can right-click Assets.xcassets and view it in the folder, there is a json file in it, please check if the file name is correct.
According to the official documentation, if you are not connected to a Mac, it will only display the original image. For more information, you can check: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/deploy-test/hot-restart#limitations
SUMMARY
I created an app App using Xamarin Form and Visual Studio 2019.
Folder/file structure:
[d] App
|-[d] App
| |-[d] App
| | |- ...
| |-[d] App.Android
| | |- ...
| |-[d] App.iOS
| |- ...
|-[f] App.sln
I finally got rid of all the errors and warnings and tried to upload APK to Google Play Console. I found multiple *.apk files and googled that I have to upload the one that has "-Signed" in its name. It resides in App/App/App.Android/bin/Debug. Upon the failed upload I got the following message:
Upload failed
You uploaded a debuggable APK or Android App Bundle. For security reasons you need to disable debugging before it can be published in Google Play. Find out more about debuggable APKs or Android App Bundles.
You uploaded an APK or Android App Bundle that was signed in debug mode. You need to sign your APK or Android App Bundle in release mode. Find out more about signing.
WHAT I DID
I found one SO Q&A that says I should change my project from Debug mode to Release.
I found that, if I right-click App.Android in (VS) Solution Explorer and choose Properties, I can choose Android Options tab on the left and then "Configuration: Release". It didn't work. But there is also Android Package Signing tab on the left which has the "Sign the .APK file using the following keystore details" checkbox unchecked.
Before I delved into the latter, I also found that in Visual Studio top-most menu I can open "Build" and choose "Configuration Manager" where I can change "Active solution configuration" to "Release" which in change turn all three project to "Release". I did so and it still didn't work. (No new *.apk file was created)
In the last link in quoted message above I found instructions on how to create the key needed
In the menu bar, click Build > Build > Generate Signed Bundle/APK.
In the Generate Signed Bundle or APK dialog, select Android App Bundle or APK and click Next.
Below the field for Key store path, click Create new.
{so forth...}
but these are only for Android Studio not Visual Studio. Is there any way how to do it with Visual Studio?
Xamarin can be annoying for newer users, especially if you have made any changes to the defaults unknowingly. And the release configuration in the default template creates a debuggable APK, so that's not helpful either.
Let's follow the steps to publish an app, and disable debugging from the Release APK:
Make sure you choose Android, Release configuration in the main window as shown.
Then double click on the Android project to open the Project Options and navigate to Compiler. Make sure that for the "Release" Configuration selected, you change the Debug Information to "None". Don't forget to press OK and save the changes.
Rebuild All.
Right click on the Android project and select Archive for Publishing.
Once archived, continue to Sign and Distribute as you were doing earlier.
Make sure to read the comments for more details!
I am trying to create a watchOS app in an existing Xamarin Forms application in Visual Studio 2017 on Windows. I have followed all the steps listed here. I have also added watchOS app project reference to the main iOS app by selecting add reference option of the references node of the main iOS app. Solution also builds successfully but when I try to launch watchOS app in watch simulator, it instantly throws the below error without even launching the simulator.
Error:
Main iOS app couldn't be found, please make sure you've created an iOS app and it is referencing
Please suggest what I am doing wrong.
I think you have add the watchOS app reference in a wrong place.
You should add the reference in xxx.iOS projecct instead of xxx(xamarin.forms project).
Let me show a screenshot for you:
Update:
Steps:
I create a new MobileApp(Xamarin.forms) project(platform iOS).
Right click on the solution -->add --> new project -->Apple Watch -->watchOS app-->ok.
Right click on the xxx.iOS project --> add---> reference --> check XXX.watchOSApp
Right click on the xxx.WatchOSApp --> Set as Setup Project.
(Clean and rebuild) Run on the appleWatch simulator.
How do you setup google firebase dynamic links, deep linking, in a xamarin forms app?
This is how I setup Firebase Dynamic Links in Android project of my Xamarin Forms App, so most of this will apply directly to android. I will work on finishing and documenting the iOS implementation in the future.
Disclaimer: I'm not an expert, any or all of this could be wrong. It's just what worked for me and my basic understanding. Please let me know if there are any errors and let's improve our collective intelligence of the Xamarin Community
If you don't already know what Dynamic Links are, watch the 2 min video, it's a great overview. https://firebase.google.com/docs/dynamic-links/
The Setup
Setup is broken up into 2 parts.
Part 1 - Configure the Dynamic Links in the Firebase Console (Easy)
Part 2 - Configure your app to be able to receive and process the Deep Links (Not as Easy)
Part 1 - Configure the Dynamic Links in the Firebase Console (Easy)
1- Setup a free firebase account at https://firebase.google.com/
2- Create a project.
3- Create a new dynamic link, the tab is at the bottom of the 'Grow' section.
It will generate a static domain name for you based off of your project name. Ex. 'https://myproject.page.link'
Short Link url is what users will click on to navigate to your appstore or launch your app.
Deep Link url is what actually gets sent into your app for you to work with. Ex 'https://myproject.com/MainPage'
iOS behavior. Currently set mine to open the link in a url browser, as my app is not connected to it yet.
Android behavior Very Important but not as hard as my explanation makes it look.
Here is where you register your app with firebase. The package name should be easy, use the same one as defined in your
apps Android properties. Ex 'com.mycompany.appname'
Adding the signing certs SHA-1 and SHA-256 are required for Dynamic Links, which is what we are doing here.
Microsoft has a great guide on this, better than I can explain. here
Download the google-services.json file - You will need it later. Also, you will need the one that has incorporated the SHA cert details in it.
Ignore the instructions for adding the firebase SDK, we will add these to our project later using Nuget packages.
When this is all done your app should be selectable in a dropdown for the android behavior.
Finally, add any extra tags to your dynamic link url if you want, its optional.
And that's it! Now you should have a working short link. When used on an android device it should already be able to determine if the app is already installed or not, and then either direct the user to the play store or open the app. However, it won't do anything with that deep link url that you set. That brings us to the next part.
Part 2 - Configure your app to be able to receive and process the Deep Links (Not as Easy)
1- Versions, might be important.
2- Nuget Packages - Hopefully this goes smoother for you than it did for me.
3- The Code
3a- Intent Filters
3b- Handling the Deep Link
1- Versions.
I was having a lot of issues trying to get dynamic/deep linking to work. So I went back and updated everything to the newest versions available at the time.
Visual Studio Professional 2017 - 15.7.5
.NET Framework 4.7.03056
Xamarin 4.10.10.2
Xamarin.Android SDK 8.3.3.2
Android SDK Manager - Got the latest. Android 8.1 API 27 and Android 8.0 API 26 (Targeting 8.1 might be required)
Android Properties -
-Application - Compile using Android Version(Target Framework): Android 8.1 Oreo
-Android Manifest: Target Android Version: Use Compile SDK Version(haven't tried targetting 8.1 directly, might work). My min target is still Android 4.4 API 19 Kit Kat
2- Nuget Packages. These are just for the Android project. MyApp.Android
You shouldn't have to add anything into the .NET Standard Project, just make sure the Xamarin.Forms Versions match
Below is what I did
Update:
Xamarin.Forms - updated to 3.0.0.482510
Install:
This is where it immediately got annoying for me. Issues here are what lead me to go back and update my Android API Levels to the most recent, 8.1
Xamarin.Firebase.Dynamic.Links by Xamarin Inc v60.1142.1 is what you want to install.
The other dependencies should automatically install. In my case, they did not.
Dependency MonoAndroid,Version=v8.0 is important here. That should be the SDK API version that your app is set to compile against.
However, the other dependencies like Xamarin.GooglePlayServices.Basement (= 60.1142.1) have nested dependencies of their own that require MonoAndroid,Version=v8.1
So if you run into issues installing the Dynamic Links Package, thats where I would recommend looking first.
For my purposes, the nested dependencies were not automatically getting installed, so I went down through each of them and their lists and did them all manually. Even the ones that said not to do manually. It's only 20 or so, but my guess would be if I had my project SDK's set to 8.1 before all of this that it would have gone smoothly.
The CODE
Intent Filters
These are defined in your AndroidManifest.xml file
What do they do? They listen for instructions while your app starts.
When an app start matches a pre-defined filter(short link), they it stores your intended action or data on the Intent Class. That is where we pull the deep link from.
For us, this is what let's the android app receive and begin to process the deep link url that you set all the way back in Part 1.
The firebase dynamic link docs have a good breakdown and example of what to do. here
The android developer docs have a good example and breakdown of this also. here
NOTE Focus on whats between the activity tags. I've just included the other tags to show general structure, in case you haven't edited these before.
That is about the minimum of what you need.
The highlighted line should match the Short Dynamic Link you setup in the established in the Firebase Console.
I'd recommend using a Wildcard like I did in the path prefix.
That way you can make new Dynamic Links and your app can handle them without having to release new versions.
Handling the Deep Link
At this point if your app is launched by the short link, you should be able to catch the deep link during the android startup process and handle it how you want.
All I will cover here is a basic example of how to get the Deep Link as a string.
I pass mine to the main app project (.NET Standard Library) using a simple dependency service.
You can use it however you want though, there's actions it can take in either the App or the App.Android project.
The important thing is getting the deep link.
The firebase docs have good examples, but written in java or whatever language native android uses. here
I'll be showing mostly the same, just in C# examples
Get The Intent.
What is the intent you want to get? The deep link you are sending into your app Ex. "https://mycoolapp.com/mainpage"
You want to get it in the MainActivity. Below is an extremely simplified example, but it's just about that easy. Now you should be able to do what you want with that link inside of your app.
TIPS
Be careful if you have something that interrupts your startup procedures.
My Application uses a splash screen. Part of that is a line of code that creates a new Intent, overwriting the one sent in from the dynamic link
So I have my DeepLinkHandler fire off before that operation, and store the deep link in a static string.
Once it's in a static string I can use a dependency service from the Main App(.NET Standard Library) to call the GetDynamicLinkString method and return the deep link as a string.
How to Test Using an Emulator and Debugger
I have a simple settings page on my app. I added a field that would print the deep link, if it has one.
Fire off the emulator like normal using the debugger. The deep link field should be empty.
With the emulator still running, minimize the app.
Open a browser and enter in the short link url.
This should re-launch your app, but this time the deep link field has the url that you set on the firebase console.
Hope this is able to save someone some headaches.
-Tim
I'm very new to backendless.
And a little bit new to developing an androip app.
I'm trying to show list of files in my Backendless to my Android app.
I'm trying to show my uploaded files in my Backendless to a List View in my Android Studio Project. Wherein the user could see the files(images,documents,pdf) inside the folder and other sub folders inside it.
Backendless cares about you even if you are "very new" to it :)
Just use it`s build-in code generation tool. It already provides you a file manager for you application. You can customize it so that would pass for all your needs.
Well, open console and create your new app. Then go to Code Generation section, select Android tab and check "Simple file manager" option.
As soon as you you download the project open it in your IDE, select SDK and run.
Found it.
https://github.com/Backendless/Android-SDK/blob/master/src/com/backendless/Files.java
This has all the codes you need concerning file management for backendless in your android project.