Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all 204402 articles
Browse latest View live

Is there a 'wake on movement' API?

$
0
0

I want to write an app that will basically sleep (to extend battery life) and somehow wake up when some movement (more of a vibration detection than physically moving metres).

Is there an API that can do this, or will I have to make some sort of 'wake on timer, check position etc'. The device will by physically static until something happens, so there isn't any need for GPS until it wakes up.


iPhone simulators missing from debug device list

$
0
0

I am running Visual Studio 15.9.5 on Windows 10, I have a MacBook Pro with Visual Studio for Mac and all the latest updates, with Xcode 10.1.

In Xcode Preferences/Components, you can see I have installed iOS 10.0 Simulator, 10.1,10.2,10.3.1,11.0,11.1,11.2, 11.3, 11.4, 12.0.

While paired up with the MacBook Pro, in DEBUG mode, I can see all the iPhone 5 and 6's from 10.3 to 12.1 (I am targeting 10.3).
However, in this list, there are no iPhone 7's or above. In the unsupported list, it does some some iPHone 7's, but they are older than 10.3.

Does anyone have some suggestions as to how I can fix this?

I am stuck while publishing my ios app

$
0
0

i am stuck on publishing my app on App store.
it has been 5 times & every time people there delay for reply (between 24 and 48 hours). More over, every time re-ask for something else

I am confused with the last review..

What this means:

Guideline 2.2 - Performance - Beta Testing

Your app appears to be a pre-release, test, or trial version with a limited feature set. Apps that are created for demonstration or trial purposes are not appropriate for the App Store.

Next Steps

To resolve this issue, please complete, remove, or fully configure any partially implemented features. Additionally, remove all references to "demo," "trial," "beta," or "test" in your app description, app icon, screenshots, previews, release notes, and binary.

Resources

If you would like to conduct a beta trial for your app, you may wish to review the TestFlight Beta Testing Guide.

Please see attached screenshots for details.

my app on android has been uploaded and there was no problem at all. Why IOS app store is sooooooo confusing
Can any one know what this means..
my app is not pre-release or test or test version...
What are they talking about

XF image tapgesturerecognizer not working on UWP?

$
0
0

xamarin forms image tapgesturerecognizer not working on UWP, working fine on Android. How to fix it? Thank you!

R U Subscribed to Notifications?

$
0
0

Our Xamarin Forms app uses Notifications. How can I check to see if the user is subscribed ? (Meaning: Did they click NO when asked for permission?)

The awesome Xamarin.Essentials has an AppInfo tool that can show the settings of the app where the user can change Notification choices.

I need to know if I should show AppInfo.ShowSettings dialog that if the user changes their mind.

help, how to make an api or sdk for dvr dahua?

$
0
0

idea of how to make an api that allows me to play video of a dahua dvr, this is a sdk, but it does not work for me, because it is typed in c ++

How can Xamarin.Forms class access JSON from REST WCF service?

$
0
0

Hi,

I'm learning all about Xamarin.Forms, so please bear with me. This may seem like a simple question, but finding a solution has been an uphill battle.

This code snippet is from a class in my Xamarin.Forms project that loops through a json stream. I use the Newtonsoft library for the json:

string ar = "[{\"lon\":\"-66.105721\",\"lat\":\"18.466333\"},{\"lon\":\"-65.827385\",\"lat\":\"18.149683\"}]";
var obj = JsonConvert.DeserializeObject(ar);
string lat = string.Empty;
string lon = string.Empty;

foreach (var item in ((JArray)obj))
{
    lat = item.Value<string>("lat");
    lon = item.Value<string>("lon");
}

This works as expected.

Now, instead of being that string, it will be a JSON stream returned by calling URL http//IP/Service1.svc/GetTableData (the forum doesn't let me post URLs). This URL will return the same exact json stream that was used in the snippet above:

[{"lon":"-66.105721","lat":"18.466333"},{"lon":"-65.827385","lat":"18.149683"}]

My question: How can my class in the Xamarin.Forms project call the URL and read the json being returned? I only have access to the URL, so I can't add it to my project as a service reference.

I'm using Visual Studio 2017.

Any help is appreciated.

TableView ImageCell Problem

$
0
0







When I used this code, its running and showing picture in IOS. But İn Android, it is not showing the Picture, Text is appearing, but Picture is not.
My Picture is in drawable, and drawable-xxhdpi folders. My android simulator is Nexus 5 which has 1080*1920 screen resolution


arm support for 8.0 and up?

$
0
0

While trying to build the default Xamarin.Forms xaml app ("Welcome to Xamarin.Forms!") I encountered the following oddity:

Where is the ARM support for 8.0 (and up)? Isn't this going to be a problem for apps destined for ARM devices?

The “XamlCTask” task failed unexpectedly Error

$
0
0

I'm currently using Xamarin.forms and i'm trying to build but i keep getting this error :

Error MSB4018: The "XamlCTask" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. Le fichier spécifié est introuvable.
File name: 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
at Xamarin.Forms.Build.Tasks.XamlCTask.Execute(IList`1& thrownExceptions)
at Xamarin.Forms.Build.Tasks.XamlTask.Execute()
at Microsoft.Build.Framework.ITask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()

I already saw some posts but any of them is resolving this problem and i can't start working because of this issue . Any help .. ? Thank you .

How can I add a border for a BoxView

$
0
0

How can I add a border for BoxView? I thought about putting a smaller boxview inside a larger boxview and trying to position them on top of each other?

Thanks

Cannot deploy to Apple Watch

$
0
0

Hi all,

Relatively new to Xamarin development.. I have created an iOS project and added a WatchKit App to it. I can deploy the phone app perfectly fine, and the watch app is available to install (iPhone > Watch > MyWatch > Available Apps). I can press install but the app does not complete installation. On a Simulator the application is fine on both phone and watch.

I have downloaded Sample Xamarin packages and these all work fine on a Simulator also.

Can anyone direct me to some 'installation' logs that may be helpful? Any other ideas will be appreciated!

AndroidRuntime exception on app restart after app is open a long time

$
0
0

My xamarins forms app is crashing immediately on startup. This only happens after the app has been sitting on for ~1 hr, closed, and then opened again. Once it crashes like this one time, the app will then crash every time I try launching it until I plug it in and debug with Visual Studio, at which point it stops crashing.

Full stack trace captured from logcat:

Time    Device Name Type    PID Tag Message
11-25 22:50:51.794  Google Pixel    Error   21626   AndroidRuntime  android.runtime.JavaProxyThrowable: System.NullReferenceException: Object reference not set to an instance of an object
  at Xamarin.Forms.Platform.Android.AppCompat.Platform.LayoutRootPage (Xamarin.Forms.Page page, System.Int32 width, System.Int32 height) [0x00034] in <6b73296523894c3d8d57f5a8e3480a43>:0 
  at Xamarin.Forms.Platform.Android.AppCompat.Platform.Xamarin.Forms.Platform.Android.IPlatformLayout.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x0000a] in <6b73296523894c3d8d57f5a8e3480a43>:0 
  at Xamarin.Forms.Platform.Android.PlatformRenderer.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00018] in <6b73296523894c3d8d57f5a8e3480a43>:0 
  at Android.Views.ViewGroup.n_OnLayout_ZIIII (System.IntPtr jnienv, System.IntPtr native__this, System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00009] in <a10f61e70eeb434e952fef884856c199>:0 
  at (wrapper dynamic-method) System.Object.18(intptr,intptr,bool,int,int,int,int)
    at md51558244f76c53b6aeda52c8a337f2c37.PlatformRenderer.n_onLayout(Native Method)
    at md51558244f76c53b6aeda52c8a337f2c37.PlatformRenderer.onLayout(PlatformRenderer.java:63)
    at android.view.View.layout(View.java:20672)
    at android.view.ViewGroup.layout(ViewGroup.java:6194)
    at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1083)
    at android.view.View.layout(View.java:20672)
    at android.view.ViewGroup.layout(ViewGroup.java:6194)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
    at android.view.View.layout(View.java:20672)
    at android.view.ViewGroup.layout(ViewGroup.java:6194)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
    at android.view.View.layout(View.java:20672)
    at android.view.ViewGroup.layout(ViewGroup.java:6194)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
    at android.view.View.layout(View.java:20672)
    at android.view.ViewGroup.layout(ViewGroup.java:6194)
    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1812)
    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1656)
    at android.widget.LinearLayout.onLayout(LinearLayout.java:1565)
    at android.view.View.layout(View.java:20672)
    at android.view.ViewGroup.layout(ViewGroup.java:6194)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
    at com.android.internal.policy.DecorView.onLayout(DecorView.java:753)
    at android.view.View.layout(View.java:20672)
    at android.view.ViewGroup.layout(ViewGroup.java:6194)
    at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2793)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2320)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1460)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7184)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949)
    at android.view.Choreographer.doCallbacks(Choreographer.java:761)
    at android.view.Choreographer.doFrame(Choreographer.java:696)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6669)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
  Force finishing activity com.companyname.BingoBongo/md576593553c14f400ecd2910c52fe340e6.MainActivity

Here is my App.xaml.cs (it seems to be crashing either here or before because the crashes don't show up in my AppCenter crash log):

public partial class App : Application
    {
        private IFirebaseAuthService _firebaseAuthService;

        public App()
        {
            InitializeComponent();
            SetUpUnity();
            // no try catch around this line, but crashes were happening before it was added
            _firebaseAuthService = ServiceLocator.Current.GetInstance<IFirebaseAuthService>();
        }

        private void StartAppStore()
        {
            // no try catch around this line, but crashes were happening before it was added
            AppCenter.Start("android=[my-app-key];",
                  typeof(Analytics), typeof(Crashes));
        }

        private void SetUpUnity()
        {
            try
            {
                var unityContainer = new UnityContainer();

                // Register Firebase Singletons
                unityContainer.RegisterSingleton<IFirebaseAuthService, FirebaseAuthService>();
                unityContainer.RegisterSingleton<FirebaseClient, FirebaseClientSingleton>();

                // Register Services
                unityContainer.RegisterType<IMessageService, FirebaseMessageService>();
                unityContainer.RegisterSingleton<IAccountStoreService, AccountStoreService>();

                ServiceLocator.SetLocatorProvider(() => new UnityServiceLocator(unityContainer));
            } catch(Exception ex)
            {
                HandleStartupException(ex, "Error setting up Unity dependency injection");
            }
        }

        private void HandleStartupException(Exception ex, string title)
        {
            // Added as an attempt to capture the exception, but seems to crash before reaching this method
            MainPage = new NavigationPage(new ExceptionView(title, ex));
        }

        private async void CheckAuthAndRedirect()
        {
            try
            {
                var auth = await _firebaseAuthService.GetAuth();
                if (auth == null)
                {
                    MainPage = new NavigationPage(new LoginView());
                }
                else
                {
                    MainPage = new NavigationPage(new MessageView());
                }
            } catch(Exception ex) {
                HandleStartupException(ex, "Error refreshing authentication. Please log in again.");
            }
        }

        protected override void OnStart()
        {
            StartAppStore();
            CheckAuthAndRedirect();
        }

        protected override void OnSleep()
        {
            // Handle when your app sleeps
        }

        protected override void OnResume()
        {
            // Handle when your app resumes
        }
    }

My app has dependencies on firebase-database-dotnet, firebase-authentication-dotnet, Xamarin.Auth (using AccountStore to persist credentials, Microsoft.AppCenter, and Unity. I haven't made any changes in the Android specific project.

Any idea why these crashes might be happening?

deploying error

$
0
0

1>------ Deploy started: Project: TipCalculator, Configuration: Debug Any CPU ------
1>Error: Cancelled
========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========

on visual studio 2017

How to set value to customstepper

$
0
0

I have a list with a custom stepper in it, and I have a detail page for every item in this list, I need to change the value of the custom stepper when I change it in the detail page and also when I refresh the list.

This is the list of items and the info button is to go to the item detail page

And here is the item detail page

How can I change it? thanks in advance


Changing a specific value in a list during runtime.

$
0
0

Hello everyone,

I have a simple Xamarin.Android-App.

On the Activity of this app, there is a list displayed. Please see following MyActivity.axml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android        ="http://schemas.android.com/apk/res/android"
android:orientation  ="vertical"
android:layout_width ="match_parent"
android:layout_height="match_parent">
<Button
    android:layout_width ="match_parent"
    android:layout_height="wrap_content"
    android:text         ="Click Me"
    android:layout_marginTop   ="20dp"
    android:layout_marginLeft   ="25dp"
    android:layout_marginRight   ="25dp"
    android:id="@+id/button" />
<Space
    android:layout_width="match_parent"
    android:layout_height="25dp"
    android:id="@+id/space" />
<ListView
    android:minWidth="25px"
    android:minHeight="25px"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/list" />
</LinearLayout>

One row of this list contains simply two entries, please see ListRow.axml:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android"     
android:orientation="horizontal"     
android:layout_width="fill_parent"     
android:layout_height="fill_parent">        
    <TextView             
        android:id="@+id/name"            
        android:layout_width="wrap_content"          
        android:layout_height="wrap_content" 
        android:layout_marginLeft  ="5dp"
        android:layout_marginTop   ="10dp"
        android:layout_marginBottom="10dp"
        android:layout_marginRight ="5dp" />
    <TextView             
        android:id="@+id/value"            
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:layout_marginLeft  ="5dp"
        android:layout_marginTop   ="10dp"
        android:layout_marginBottom="10dp"
        android:layout_marginRight ="5dp" />
</RelativeLayout>

So the code-behind of that activity looks like the following:

public class MyActivity : Activity
{
    List<Entry> List = null;

    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);

        SetContentView(Resource.Layout.MyActivity);

        List = PopulateList();
        var lv = FindViewById<ListView>(Resource.Id.list);
        var adapter = new ListAdapter(this, Resource.Layout.List, List);
        lv.Adapter = adapter;

        FindViewById<Button>(Resource.Id.button).Click += OnButtonClick;
    }
}

For the sake of completeness, here is the code for my ListAdapter.cs-class:

class ListAdapter : ArrayAdapter
{
    List<Entry> List;
    public ListAdapter(Context Context, int ListId, List<Entry> List) : base(Context, ListId, List)
    {
        this.List = List;
    }
    public override int Count
    {
        get { return List.Count; }
    }
    public override View GetView(int position, View convertView, ViewGroup parent)
    {
        View v = convertView;
        if (v == null)
        {
            LayoutInflater inflater = (LayoutInflater)Context.GetSystemService(Context.LayoutInflaterService);
            v = inflater.Inflate(Resource.Layout.List, parent, false);
        }
        v.FindViewById<TextView>(Resource.Id.name).Text = List[position].Name;
        v.FindViewById<TextView>(Resource.Id.value).Text = "Original Value";
        return v;
    }
}

So my question now is the following: Assuming that there is more than one item within that List. On click of the button, I want to change one specific text within that list. Let's say of the second entry in the list the (Resource.Id.value).Text (which now says "Original Value") to "Changed Value" or something like that. But only of the second one. All the other items should stay the same.

Please see following scenario, maybe it's easier to understand what I am trying to do:

NameValue
Item Number 1Original Value
Item Number 2Original Value
Item Number 3Original Value

[Button Click]

NameValue
Item Number 1Original Value
Item Number 2Changed Value
Item Number 3Original Value

Can anyone maybe help me / tell me how to do this? What does my private void OnButtonClick(object sender, EventArgs e)-method have to look like? How can I access a single entry in that list?

Thanks in advance for all answers and best regards

How to debug/step into Xamarin.Forms source code?

$
0
0

I have seen this article https://shaneneuville.com/xamarin/forms/debugging/2018/02/01/debug-tips.html
but it is not clear for me how this should work and what it meant that "Now you’re ready to step into the source code. Run your project and when you try to step into anything or view the call stack it’ll let you navigate to the files at d:/a/1/s"
Does it mean that we can continue using xamarin.form nuget and step into clone of the source code somehow? if that is the case, how is that linked? Could anyone achieve this what article is telling us?

Any xamarin bluetooth example project? without using any plugin?

$
0
0

Any xamarin Bluetooth example project? without using any plugin?

Not able to change Tabbed Page's tab once modal is shown

$
0
0

Hi,

I am facing issue with Tabbed Page in iOS. I have added 5 navigation pages in the tabbed page. After showing and closing modal, I am not able to change tab on tap. If I hold another tab for 3-4 seconds (long press) then that tab is getting selected. Not sure what is the issue. No logs as well.

The same code is working fine on Android. Please let me know if someone has faced a similar issue.

How to make the MasterDetail page in iOS slideover the content Page instead of Pushing

$
0
0

How to make the MasterDetail page in iOS slideover the content Page instead of Pushing...?

MasterBehaviour=PopOver is not working

Viewing all 204402 articles
Browse latest View live


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