Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all 91519 articles
Browse latest View live

Problems in Firebase Push Notification Plugin with Android Icon

$
0
0

Hi,

I have a problem with the FirebasePushNotification Plugin for Xamarin.Forms to send message with icon in Android.

I use this to send my push notifications and works perfectly but I can't find the way to show my icon.

var message = new Message()
{
To = pushnot.Token, //topic example /topics/all

            Notification = new AndroidNotification()
            {
                Body = pushnot.Body,
                Title = pushnot.Title,
                Icon = "icona",
                Color = "#3AAAF4"
            }
        };

        var result = await client.SendMessageAsync(message);

Anyone can help me?

Thanks a lot


How to programmatically insert some text in Entry in any cursor position?

$
0
0

Hi All Xamarin Experts / Developers,

I am facing issue related to programmatically insertion of text in Entry. Could you please provide some suggestion to solve this issue.

The scenario is as:

  • User is tapping (after "xamarin word") in Entry which is having some text i.e "This is xamarin Forms",
  • Now he is tapping on button to insert some text in that Entry where he was tapped (after "xamarin word").

Here, when user will try to tap on button to insert some text in the Entry in some position then he will loose focus from Entry and tapped location will be emitted.

Any suggestion how to achieve it?

HTTPClient when sending async requet keep poping up exception...

$
0
0

Hi guys,

When I'm sending async http request, it keep showing me the exception but...code won't go inside catch part.
The alert window as attached.
One more thing is ..this request due to some reason is really slow, has to wait for a while to get the result.
This is the line of exception happens:

HttpResponseMessage response = await httpClient.SendAsync(request);

All function code :

public async static Task SendHttpRequestProject(string url)
{
try
{
HttpClientHandler handler = new HttpClientHandler();
var httpClient = new HttpClient(handler);
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, url);
httpClient.DefaultRequestHeaders.Add("Authorization", "flynnsa bW******************=");
HttpResponseMessage response = await httpClient.SendAsync(request);
return await response.Content.ReadAsStringAsync();
}
catch (Exception ex)
{
return ex.ToString();
}
}

Any way to debug a Xamarin forms uwp app when I have created App packages

$
0
0

I have a project that work fine when I run it in debug, but when I create it as a UWP store app and install it on my machine it dont work, my android app works fine though.

So is there some way to create a debug version that "acts" completely as a UWP store app, so I can easily find out what the problem is?

https://github.com/Mech0z/FoosballXamarin/

And through stupid many compiles I found out its my
public ILeaderboardService LeaderboardService => DependencyService.Get();

That is null when called, not sure why that only happens when build as a uwp store app

Xamarin Uitest: How to click on the particular element of ListView

$
0
0

I have a List View in which on each list there is 3 field namely label ,button and image.
I want to to click on the button of particular named label.
How can I achieve it?

How to take picture from camera and retrieve it using Xamarin.forms for cross platform app ?

$
0
0

How to take picture from camera,save that image in gallery and retrieve it afterwards using C#? The same code which can be executed in android as well as IOS is required (using Xamarin.Forms).

Please Help.

Camera Overlay - Xamarin Forms

$
0
0

Hello,

i've been working on the sample provided by XLabs to work with the camera ( https://github.com/XLabs/Xamarin-Forms-Labs/wiki/Camera ) and its working ok (only if target API = 21) .

I wanted to know if its possible to Overlay the camera menu, the purpose is to add a rectangule to the screen. I know how to do it in Objective-C , but how would I implement it on Xamarin ? (for android and iOS)

Thanks in advance !

Notification Error

$
0
0

Hi,

I posted this previously in the Android and Cross Platform forums but did not get any responses. Trying again here.

I have a Xamarin for Visual Studio cross platform project and am getting an error trying to get notifications working using Azure Notifications Hub in the Android project. In the FirebaseInstanceIdService-derived class, I get an error when I try to instantiate a NotificationHub object. This is being called to register the user/device on Azure Notifications Hub.

NotificationHub hub = new NotificationHub(Constants.NotificationHubName, Constants.ListenConnectionString, this);

I usually get this error: "Unhandled Exception: Java.Lang.NullPointerException: occurred."

But have also received: "Unhandled Exception: Java.Lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference occurred."

I am calling this from a DependencyService that is invoked in the OnAppearing event of the Main Page. I can't rely on OnTokenRefresh() in the FirebaseInstanceIdService-derived class because I need the user to log in first.

I confirmed that the hub name and connection string are correct. And the context-related error certainly makes it seem related to "this." But I'm not sure what the issue is since this is how it is handled in all the sample code I've seen.

Any suggestions would be greatly appreciated.


How do i play/run video player and audio player at same time in xamarin IOS and Android?

$
0
0

How do i play/run video player and audio player at same time in xamarin IOS and Android?

Xamarin.Forms + Google Cloud

$
0
0

Hello,

Has anyone been able to set up a project that uses Xamarin in combination with Google Cloud .NET libraries. Basically, I am testing the different services of the Google Cloud platform in combination with Xamarin but came across different undesired behaviors and general exceptions with no easy explanation with some of the APIs. I came across the following thread -github.com/google/google-api-dotnet-client/issues/1162 - where its is explained that the storage service is not supported for Xamarin. Is this the case with all GCloud services? Does anyone know if there is an official statement on Xamarin and whether it is supported?

How to embed MasterDetailPage inside TabbedPage?

$
0
0

I want to embed MasterDetailPage inside TabbedPage.Children using XAML.
On samples page I did not find sample with such situation.
Is there any sample?

ZXing - defining scanning area

$
0
0

Hi everyone,
can I define scanning area in ZXing.Net.Mobile? I would like to scaned only center of screen.
I using ZXingScannerView and ZXingDefaultOverlay.

<zxing:ZXingScannerView Options="{Binding ScannerOptions}" IsScanning="{Binding IsScanning}" IsAnalyzing="{Binding IsAnalyzing}" IsEnabled="True" IsTorchOn="{Binding TorchOn, Mode=TwoWay}" Result="{Binding Result, Mode=TwoWay}" ScanResultCommand="{Binding ScanCommand}" /> <zxing:ZXingDefaultOverlay Opacity="0.9" />

Current listview switch state changing when the listview gets refresh?

$
0
0

I have a listview, which shows 20 users initially. Whenever the listview bottom reaches a new REST API call will start and it shows more users(20,40,60 etc). When loading more users the list gets refreshed.

Listview items have a switch option and if I press the switch option the userid of that user is added to a list. If I again press the same switch that userid is removed from the list.

My problem is the selected user's switches are going to off state when loading more users. But the userids saved in the list have no problem, the list contains the selected user's id. So how can I on the switch of already selected users after loading more users?

Thanks in advance :)

On the listview switch based on a condition,tried a method but getting NotImplementedException?

$
0
0

I have a switch in my listview. I need to on the switch state if the switch item userid exists in the local DB. I tried like below:

In xaml, a converter added for the **IsToggled **property:

<Switch
          IsToggled="{Binding userProfileTO.userId, Converter={StaticResource isToggledConverter}}"
          HorizontalOptions="EndAndExpand"
          VerticalOptions="CenterAndExpand"/>

Converter code:

    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        bool toggle = false;
        string selectedIds = Application.Current.Properties["GroupUserIds"].ToString();
        if (!string.IsNullOrWhiteSpace(selectedIds))
        {
            List<int> TagIds = selectedIds.Split(',').Select(int.Parse).ToList();
            if (TagIds.Contains(Int32.Parse(value.ToString())))
            {
                toggle = true;
            }
            else
            {
                toggle = false;
            }
        }
        return toggle;
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }

But I am getting an exception on ConvertBack when running this code.

Exception thrown: 'System.NotImplementedException' in Myprojectname.dll
An exception of type 'System.NotImplementedException' occurred in Myprojectname.dll but was not handled in user code
The method or operation is not implemented.

Thanks in advance :)

Upload Xamarin.From application from Visual Studio for MAC

$
0
0

Hello

I have built a smal xamarin.form application on Visual Studio Community edition 2017 for mac. Could any one please tell me how to upload the same application on the app store directly from Visual studio ? Please note that I have already purchased apple developer program.


How to save video in Gallery using Xamarin Forms

$
0
0

i have an video url so i need to save video in gallery to create specif folder using xamarin forms

Correct way to allow TabbedPage pass data between ViewModels with MessageCenter

$
0
0

I have a TabbedPage, Page1 and Page2, and they did not share the same ViewModel, I would like to pass data between Page1ViewMode and Page2ViewModel with MessageCenter when CurrentPageChanged event occur. What is correct way to do this? I did not use framework. Thanks.

Image custom aspect

$
0
0

I am trying to modify the aspect of an image

Assuming that the container of the image has a size ratio of 1:3
I want the image to take all the available width space and not be deformed or cropped if it doesn't fit the ratio. That's where my pan-able image comes into play, to be able to move the image around.

AspectFill => Crop
AspectFit => Width not 100%
Fill => Stretch

I also tried to find a workaround with AspectFit + WidthRequest but couldn't make it work.

How can I get a list of all local files in a directory?

$
0
0

I'm creating an app which creates zip files in the directory: /data/user/0/MyApp_Name/files

I need to read from this directory and put all of the files into a list of strings.

I have tried this

 try
   {
       using (var reader = new StreamReader(Environment.GetFolderPath(Environment.SpecialFolder.Personal)))
       {
           string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal));

           while (!reader.EndOfStream)
           {
               var line = reader.ReadLine();
               if (line.EndsWith(".zip"))
              {
                   lstLocalZips.Add(line.Remove(0, path.Length + 10));
               }
            }
        }
     }
     catch (Exception ex)
    {
        Console.WriteLine(ex.Message);
    };

but this gives me an error:
"I/mono-stdout(29386): Access to the path '/data/user/0/MyApp_Name/files' is denied.
Access to the path '/data/user/0/MyApp_Name/files' is denied."

How can I get all of the files into a list?

Video Chat options for xamarin

$
0
0

How to implement video chat in Xamarin by using WebRTC or is there any other better way to do it. Can anyone share sample code if you have ?

Viewing all 91519 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>