xamarin.android

Running an android Worker when phone boots doesn't work

泄露秘密 提交于 2020-01-15 10:16:19
问题 I have a worker which functions perfectly. I want to launch it when the phone is booted. I use a broadcast receiver which is supposed to listen to the system booted_completed event, but this broadcast receiver is never called. In my manifest, I added this permission: <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> Here is my broadcast receiver: [BroadcastReceiver(Enabled = true)] [IntentFilter(new[] { Android.Content.Intent.ActionBootCompleted })] public class

Running an android Worker when phone boots doesn't work

为君一笑 提交于 2020-01-15 10:15:10
问题 I have a worker which functions perfectly. I want to launch it when the phone is booted. I use a broadcast receiver which is supposed to listen to the system booted_completed event, but this broadcast receiver is never called. In my manifest, I added this permission: <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> Here is my broadcast receiver: [BroadcastReceiver(Enabled = true)] [IntentFilter(new[] { Android.Content.Intent.ActionBootCompleted })] public class

call monodroid method from javascript example

老子叫甜甜 提交于 2020-01-15 05:25:09
问题 I am looking for an example of how to call a monodroid method (C#) from javascript, using a webview. Something like: javascript: <a href="#" onclick="window.android.callAndroid('Hello from Browser')"> Call Android from JavaScript</a> C# public class LocalBrowser extends Activity { ... private class MyClass { public void callAndroid(final String arg) { textView.setText(arg); } } } Thanks 回答1: This is the example I used to finally solve this for me. Better late than never. Pay close attention

Xamarin.Forms App crash on android on serializing object using Newtonsoft.Json

霸气de小男生 提交于 2020-01-15 04:01:05
问题 I am using Xamarin to send data to a private server. I serialize some data which is an array of states objects consisting of an ID (int) and DateTime. When the code hits this method JsonConvert.SerializeObject(currentStates); The app crashes on the emulator with the following lines in the output window 09-14 10:46:52.677 D/Mono ( 3313): Config attempting to parse: 'System.Numerics.dll.config'. 09-14 10:46:52.677 D/Mono ( 3313): Config attempting to parse: '/usr/local/etc/mono/assemblies

Android: Global style for all Spinners in my app

空扰寡人 提交于 2020-01-15 03:41:25
问题 I'm using Xamarin Android in Visual Studio 2017. I have a few existing Spinners which are created in xml layout which all work perfectly and are styled exactly how I want them to look. The code for these is typically: <Spinner android:spinnerMode="dialog" android:id="@+id/SpnProject" android:layout_width="fill_parent" android:layout_height="40dp" android:layout_marginBottom="8dp" android:paddingTop="8dp" android:paddingBottom="8dp" android:paddingStart="8dp" android:paddingEnd="8dp" android

Monodroid getApplicationContext()?

一世执手 提交于 2020-01-14 10:28:33
问题 Does anybody know how to get the application context in monodroid (I'm searching for the monodroid implementation of getApplicationContext())? I tried Application.ApplicationContext but it doesn't work. I wrote a class inheriting Application and I want to explicitly cast the ApplicationContext to this type. At this point mono dies with a really unhelpful message on the output: 10-12 11:58:31.045 I/mono ( 1919): Stacktrace: 10-12 11:58:31.045 I/mono ( 1919): Edit: I want to access it from an

Ninject and MonoDroid

删除回忆录丶 提交于 2020-01-14 03:20:50
问题 Anyone had any luck getting Ninject to work on MonoDroid? i've tried the 2.0 and 4.0 mono builds from their website and also tried the .net versions. With the Mono builds i'm getting a MissingMethodException in the instantiation of my StandardKernel 回答1: I am experimenting with Ninject on a combined WP7/Monotouch/Mono for Android project and Ninject works surprisingly good. I used the latest sources, which contain a project file Ninject.WP7.csproj which seems to be outdated. It contains a lot

How to Bind data to a Custom ListView with Xamarin Android with Reactive UI

风流意气都作罢 提交于 2020-01-14 02:16:25
问题 I am using Xamarin Android with Reactive UI and Not using Xamarin Forms. I have a Custom ListView(I have defined it's layout as xaml). I have no idea how to bind this control into a observableCollection in ViewModel using OneWayBind method in the activity class. I wrote it as, this.OneWayBind(ViewModel, x => x.OutletListing, x => x.List).DisposeWith(SubscriptionDisposables); But gives, System.ArgumentException: Can't convert System.Collections.ObjectModel.ObservableCollection1 to Android

Testing Activities in Xamarin.Android

巧了我就是萌 提交于 2020-01-13 18:31:08
问题 I'm wanting to unit test some interactions on activity lifecycle (I'm working on a data binding library, that can't have unit tests without it). Android has some good documentation on the subject. However, I've not found anyone that has attempted to do this with Xamarin. Many of the classes in android.test are missing in Xamarin. So far I've attempted something like the following in the Xamarin test project that uses NUnit: [TestFixture] public class MyActivityTests { private TestActivity

Testing Activities in Xamarin.Android

折月煮酒 提交于 2020-01-13 18:31:07
问题 I'm wanting to unit test some interactions on activity lifecycle (I'm working on a data binding library, that can't have unit tests without it). Android has some good documentation on the subject. However, I've not found anyone that has attempted to do this with Xamarin. Many of the classes in android.test are missing in Xamarin. So far I've attempted something like the following in the Xamarin test project that uses NUnit: [TestFixture] public class MyActivityTests { private TestActivity