xamarin.android

Xamarin Android Start app using link with parameters

断了今生、忘了曾经 提交于 2020-01-16 11:32:32
问题 I have a problem. I created a IntentFilter so my app launches when clicked on a specific link. Here is my IntentFilter: [IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault, Android.Content.Intent.CategoryBrowsable }, DataScheme = "myapplication.app" )] And here is the link: <a href='myapplication.app://'>here</a> But how can I pass a parameter (integer) in that link and how can I use that parameter in my C# code? 回答1: A complete URL Scheme protocol format

XAMARIN.FORMS: FCM Push Notifications won't vibrate if app is in background in Android

回眸只為那壹抹淺笑 提交于 2020-01-16 11:21:21
问题 I'm using Xamarin.Forms but I'm having a few problems handling push notifications. They only work fine when app is in foreground. When the app is in background, all notifications are received and displayed correctly but I can't manage to get them to vibrate or even turn led on. I have found a lot of documentation but it's pretty old and most of the time, methods referred are deprecated. Anyway, I have a FirebaseMessagingService to handle FCM events and this is the action that generates the

How to insert a menu when i click in a item on the contextual action bar

自古美人都是妖i 提交于 2020-01-16 10:04:07
问题 I am using Xamarin Android in my apllication. I created RecyclerView, and I created a contextual action bar in it. I wonder how can I show a menu when someone clicks on an item on the contextual action bar like this: https://i.stack.imgur.com/nQSM0.png my contextual action bar code: public class MyActionMode : Java.Lang.Object, ActionMode.ICallback { private RecyclerViewHolder holder; private Context mContext; private RecyclerView.Adapter mAdapter; private int currentPosition; public

Xamarin.Android Background task disposed after application closed

泪湿孤枕 提交于 2020-01-16 08:59:12
问题 Task: Create a background task to run when application is stopped/paused that periodically (3-7 seconds) performs HTTP requests and stores response information in mysqlite and displays local notifications when required. I have create a background service like the following, [Service(Enabled = true)] public class MyRequestService : Service That is started like an intent from MainActivity, public void StartMyRequestService() { var serviceToStart = new Intent(this, typeof(MyRequestService));

Xamarin: Determine if element in GetSpans() is bold or italic?

家住魔仙堡 提交于 2020-01-16 05:08:15
问题 Native Android Spanned.getSpans(......,SyleSpan.class) function return type StyleSpan[] Xamarin ISpanned.GetSpans(......) function returns type Java.lang.Object[] though it returns <T> ( T = StyleSpan in my case) in native android. Therefore there is a loss of information since the Mono interface doesn't expose what it would have been exposed if I had used the native SDK. Since propery Style ( getStyle() in native android) is only available in StyleSpan there is no way to read that a given

Shared preferences in mono android

我怕爱的太早我们不能终老 提交于 2020-01-16 03:38:52
问题 Hello I am new to mono android I want to use shared preferences for saving Login details in my application someone please help me 回答1: To repeat my answer from this question... Retrieve: var prefs = Application.Context.GetSharedPreferences("MyApp", FileCreationMode.Private); var somePref = prefs.GetString("PrefName", null); Store: var prefEditor = prefs.Edit(); prefEditor.PutString("PrefName", "Some value"); prefEditor.Commit(); 来源: https://stackoverflow.com/questions/13762032/shared

Switch to tab 2 after selecting ListView from tab 1

你说的曾经没有我的故事 提交于 2020-01-15 12:52:11
问题 Here is a complete project: Google Drive. Follow code: Frag_Home_1_Tab.cs: public class Frag_Home_1_Tab : Fragment { public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); } public static Frag_Home_1_Tab NewInstance() { return new Frag_Home_1_Tab { Arguments = new Bundle() }; } public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View inflate = inflater.Inflate(Resource.Layout.frag_tab1, container,

Switch to tab 2 after selecting ListView from tab 1

南楼画角 提交于 2020-01-15 12:51:10
问题 Here is a complete project: Google Drive. Follow code: Frag_Home_1_Tab.cs: public class Frag_Home_1_Tab : Fragment { public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); } public static Frag_Home_1_Tab NewInstance() { return new Frag_Home_1_Tab { Arguments = new Bundle() }; } public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View inflate = inflater.Inflate(Resource.Layout.frag_tab1, container,

NullReferenceException Json.NET Xamarin.Android android 4.3

五迷三道 提交于 2020-01-15 12:48:08
问题 I believe I have just run into this bug https://bugzilla.xamarin.com/show_bug.cgi?id=4902 on my Nexus 4 now that I have updated to android 4.3. Basically, when JSON.NET tries to get the timezone via the mono runtime, we get a null reference exception because there are issues with an environment variable in certain android builds. The same code worked fine before I updated and still works fine on other android devices. Are there any workarounds available for this? Is there anything else I can

System.InvalidCastException while casting an object type to custom class

喜夏-厌秋 提交于 2020-01-15 12:06:48
问题 Today working on my code I came across a phase where i needed to cast an object type to my custom class which should have been very simple, but I ended up hours resolving System.InvalidCastException , finally I ended up using JsonConvert to get the job done. I am not really sure if there was a better way to handle this, if there is I would like to know what I could have done better. Given is the structure of my custom class using SQLite.Net.Attributes; namespace DataContract { public class