Launching app within another app - xamarin

So I'm looking for the best way to open an app within another app on Xamarin forms when the app is install.. Currently I have an external link to the playstore (which loads up the app on play store) but, when the app is installed I'd like to link directly to this..
How would i go about doing this with Xamarin forms? Cheers
Here's how I went about fixing this issue :
Setting up app linking in Xamarin
This is possible but we need to change the code to the app we are linking to.
"App from" (in our case) changes :
To link to another app the change made to the main app is minimal:
1) Create a new URI. E.g. (URI AppLink = new Uri("http://appto/load");)
2) Set up the link with Device.OpenURI(AppLink);
"App to" (in our case) changes :
Android:
In main activity we need to add an intent filter, here is an example of what this looks like:
[IntentFilter(new [] {Android.Content.Intent.ActionView },
DataScheme="appto",
DataHost="load",
Categories=new [] { Android.Content.Intent.CategoryDefault })]
The DataScheme and DataHost correspond to the uri link above.
iOS:
Within the info.plist file in the advanced tab we need to create a new "url type"
I added an identifier of “com.appto.test” and URL scheme of “appto” (corresponds with uri link)
After these changes are done, the app should link. Atleast with the example it worked.

Related

.NET MAUI app + MediaPicker is crashing with Android.Content.Res.Resources+NotFoundException

In my .NET MAUI app, I use the built-in MediaPicker to access user's photos. The app works fine until I tap the icon to access the photos. It then crashes with the following error message:
Android.Content.Res.Resources+NotFoundException Message=Drawable
com.mycompany.myapp:mipmap/appicon with resource ID #0x7f0d0000
I did replace the app icon recently and I also noticed that the app is not using it when I run the app on an actual device. I simply put a new svg file in the Resources/AppIcon folder with the same name as the original i.e. appicon.svg.
In the properties for this file, I set it as MAUIICON.
This is what's in the project file:
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" />
In case, it's helpful, this is how I'm using the MediaPicker:
try
{
var result = await MediaPicker.PickPhotoAsync(new MediaPickerOptions
{
Title = "Pick Image"
});
if (result == null)
return;
}
catch(Exception e)
{
// Log error
}
I never hit the catch block. It just crashes with the error message I mentioned above.
Any idea how to address this issue?
The issue is definitely the AppIcon. Looks like .NET MAUI is not generating correct size icons from the svg that I had under Resources\AppIcon.
The workaround is to manually create the necessary icons -- in my case, I only created one 72x72 -- and placed them in Platforms\Android\Resources\mipmap folder. In my case, the Resources folder was there under Platforms\Android so I just had to create the mipmap folder.
I then had to go into AndroidManifest.xml file and correctly link them:
<application android:allowBackup="true" android:icon="#mipmap/ic_launcher" android:roundIcon="#mipmap/ic_launcher_round" android:supportsRtl="true"></application>
So, in my case the file name for the app icon I manually generated is ic_launcher.png. I did have to have a second image named ic_launcher_round.png.
Looks like .NET MAUI is supposed to do this work but it's not doing it.
The second bonus -- which it shouldn't be -- is that when I now install the app on a device, I see the correct app icon for my app.
Here's a link to the issue I reported. Anyone experiencing this issue should up vote it so that it'll get the team's attention.
https://developercommunity.visualstudio.com/t/Changing-app-icon-of-NET-MAUI-app-then/10090581

can i send a tiny database from app inventor via whatsapp

I am trying to send a voice note from app inventor via whatsapp can I do that ,the activity starter isn't helping me at all. I tried creating a file text but still cant get through.It says unsupported file format.
Yes you can share via WhatsApp. You need to add element "sharing" for that.
Here's the example of sharing the image file to the whats app through the app created with app inventor.
But first you need to understand that there are two paths for any files while creating apps with app inventor.
Path where files are stored while development (live previews)
Path where files are stored after producing the app
path while development is:
file:///mnt/sdcard/AppInventor/assets/myFile
path after production is:
file:///android_asset/myFile
So while using "SHARE" component of app inventor you have to specify both paths to avoid any errors in future.
So here is the app:
Front End Arrangements:
Block Arrangements:
Pay attention to the if then else block.
It says if the image is not in the development path then the app is installed in the phone(produced). It saves our time to change path very often(and saves us from error if we forget to change paths)
Snapshot from the app:
After pressing share button:
After sharing through whats app:

Unable To Share Text On Xamarin Form

Hello Everyone I want to share the Text on Xamarin Form using Library plugin.share. I have successfully implemented the library and on android i can able to share the text but in iOS it returns me nothing. i have done the share code on button click event so when i click on button in iOS its doesn't returns me anything.i tried the Below code but doesn't got succeed
CrossShare.Current.Share("Hii alll", "Share");
please help me to get out of this,thanks in advance
You want to take a look at UIActivityViewController, you can find the documentation here https://developer.xamarin.com/api/type/MonoTouch.UIKit.UIActivityViewController/
And Xamarin.Forms specific example http://devcenter.wintellect.com/jwood/implementing-sharing-in-xamarin-forms
This is a bit old, but I was having a similar issue and was able to resolve it.
First of all, you need to add the plugin Plugin.Share to ALL Xamarin.Forms projects (Portable, iOS, Android, UWP).
In the class that references the share code, add...
using Plugin.Share;
using Plugin.Share.Abstractions;
CrossShare.Share() doesn't work with strings, directly. You need to new up a ShareMessage.
var title = "Title For The Share";
var message = "Text to share.";
await CrossShare.Current.Share(new ShareMessage { Text = message, Title = title });
I can't say specifically to iOS, as I don't have a Mac and can't test that project, but Android and Windows 10 is working.

Custom url protocol for OSX desktop app using electron by atom

I am new to dekstop app by electron. However i built a desktop app using this source code and just changing the links to my site. Now I have a functional desktop app for mac.
But i want to open my app using a link say appName://and-some-link-follows
How can i implement custom url schema to open dekstop app whenever i click appName://....
For example:
I want to do something like Slack desktop app which opens up by clicking slack://and-some-link
Any help please. Stuck here for 2 days. Thanks in advance.
Today I faced a similar thing and upon doing some researching, I found this useful tutorial on how to do it. It explains everything thoroughly and I think it might be useful for others facing the same issue. This is the highlights:
const electron = require('electron')
const protocol = electron.protocol
// handles links `todo2://<something>`
const PROTOCOL_PREFIX = 'todo2'
function createWindow () {
mainWindow = new BrowserWindow({width: 1000, height: 800})
protocol.registerHttpProtocol(PROTOCOL_PREFIX, (req, cb) => {
const fullUrl = formFullTodoUrl(req.url)
devToolsLog('full url to open ' + fullUrl)
mainWindow.loadURL(fullUrl)
})
}
Also there's a guide on how to build for both OSX and Windows at the end of the post I linked.
For those who'd like to read a bit more, here's a link to the official docs.
I found it.
Do a build for your app
Right click -> show package content
In info.plist add the following
Open app once to register customURL into system.
In terminal enter /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -dump|egrep "(bindings.*:$)"|sort to check wheather yours is in the list.

URL Scheme: what kind of string results

I'm using Marmalade to develop iOS applications via VisualStudio and a PC. The integration of a social feature like HeyZap needs its initialization by the use of:
loadHeyzap("YOUR_APP_ID_HERE","YOUR_APP_URL_HERE", true);
App_ID is the ID as defined in the itunes app page (I got it).
App_URL "should also similarly be replaced with your URL scheme for the iPhone" [from the HeyZap integration doc].
Well, the HeyZap help desk weren't useful to obtain this string via the use of VisualStudio+PC (in fact, they told me "use XCode+Mac instead...").
Since this is a simple string, I suppose I could obtain it starting from known parameters of my app. I suppose to find inside it something like [app_name]&=other-chars-....
Is there a way to build this string without the use of XCode, just starting from info I already have and putting here and there some special chars?
In other words, is there a standard way to automate the build of this string without the neeed to do it via XCode? I wonder to prepare a function in which I would pass my app parameters and I got the URL Scheme string as a result.
Cheers,
Zapp
The answer by Creator is incorrect. A URL schema is how apps can communicate with each other in iOS.
Here is what Apple has to say
http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007899
An example would be:
yourgame://
Here's how you would define one in XCode
When you define a URL schema in XCode, you can call that URL from Safari or any app installed on the device and it will switch to your game.
The way you define it in XCode is by going to your project settings, clicking the Info tab at the top, going to the bottom where it says "URL Types", expand that, and click the + button at the bottom. Then define both the identifier and the URL schemes with something reasonably unique like "yourgamename". Done!
http://i.stack.imgur.com/pxEKd.png
URL scheme is most probably the url of your app in App Store. You can obtain it from iTunesConnect. Go to your application and copy the url of View in App Store link. That's the string you wanted ;-)
Let me know if it doesn't work.
Edit:
Well App url worked for me, dunno why its not working for you. If you want to edit the URL scheme, you can do it without using XCode too. You need to include Info.plist file in the mkb settings. You can edit or check the current URL scheme being used by marmalade there. The default plist file is in the s3e folder. Don't know the exact location.

Resources