Re: [mono-android] PostSharp 2.1 and Mono for Android

2012-08-24 Thread Matthew Leibowitz
Hi all,

Just some new from the PostSharp guys:

> Mono is only unofficially supported (you'll see in the support agreement
> that it is not supported). From the next version of PostSharp, we will
> completely stop testing our product with Mono (Mono testing currently is
> very weak anyway), so the support will even be worse.

http://support.sharpcrafters.com/discussions/questions/34-unofficial-mono-for-android-monotouch-support

Bad news for the MonoTouch guys who have to use the Mono compiler.

But, this looks good (you still need the Microsoft.NET):

> Portable class libraries are not supported in PostsSharp 2.1. It will be
> supported in PostSharp 3.0.

http://support.sharpcrafters.com/discussions/problems/258-portable-class-libraries-support

I put in a feature request for MonoTouch/Mono for Android here:
http://support.sharpcrafters.com/discussions/suggestions/7-mono-for-android-monotouch-support


So, if you feel that you could use PostSharp in your apps, then just leave
some incentive for Gael. Remember that there is a free full version for
OpenSource projects and Students as well as a free Starter Edition:
http://www.sharpcrafters.com/purchase/discounts

So, let's stand together and fill that request with replies and keep
support for Mono.

My use case is with the MvvmCross framework. It is so good that all code
virtually goes into a Totally 100% cross-platformable ViewModel, and I just
use the different Views and Bindings. But we have to implement the
INotifyPropertyChanged and the horrible RaiseEvent for each property. I
have a POC that works brilliantly with PostSharp, so there is very little
non-bussines logic in the VM.


Matthew Leibowitz



On Fri, Aug 3, 2012 at 10:44 AM, Sayed Arian Kooshesh wrote:

> which mean (guessing) you are targeting v3? Perhaps you changed it 4?
>
>
> On Fri, Aug 3, 2012 at 3:43 AM, Sayed Arian Kooshesh 
> wrote:
>
>> Look like, from the log, it was looking for 'mscorlib_3' and couldn't
>> find (till now)
>>
>> On Fri, Aug 3, 2012 at 3:04 AM, Matthew Leibowitz <
>> mattleibowm...@gmail.com> wrote:
>>
>>> Well, some weird news, all is now working. I did nothing except:
>>>
>>> I first tried updating PostSharp to version 2.1.7.6. This made no
>>> changes.
>>> Then, I created the sample in VS 2012:
>>> http://www.sharpcrafters.com/postsharp/documentation#getting-started.
>>> No work...
>>> In utter desperation I created the same project in VS 2012. It worked.
>>> Hmm.
>>> So I tried the VS 2012 project again. Still no go.
>>> Then, the brainwave. The VS 2010 project works, so lets open that in VS
>>> 2012. That worked. The only difference was the project files and the VS
>>> version.
>>> I assumed that as the same project file (the one from VS 2010) worked in
>>> both VS versions, then it must be the project file. Wrong! Both the code
>>> and the project file were exactly the same. The only difference was the
>>> project GUID - one line.
>>>
>>> Now here comes the crazy part (before I broke down in tears):
>>> I opened the original project (the one with the errors). It now builds
>>> fine :)
>>>
>>> Don't ask me what happened. I haven't touched that project since
>>> yesterday. Maybe it was the upgrade slowly kicking in or maybe it was the
>>> first build with VS 2010. Or maybe it was the incessant building and
>>> re-building. (Or the hand waving).
>>>
>>> Note: you do need the PostSharp.Custom.targets file.
>>>
>>> So the sum of the story is: It works. Who knows why.
>>>
>>> Hope this helps :)
>>>
>>> Matthew
>>>
>>>
>>> On Fri, Aug 3, 2012 at 8:46 AM, Matthew Leibowitz <
>>> mattleibowm...@gmail.com> wrote:
>>>
 Hi,

 That "when I get home" turned into a "tomorrow", but here is some more
 information:

 With just a plain old PostSharp 2.1 install and a simple project I get
 this:

 Unhandled exception (2.1.3.3, 32 bit, CLR 2.0, Release):
> PostSharp.Sdk.CodeModel.BindingException: Cannot find the type
> 'System.Func`2' in assembly 'mscorlib, Version=2.0.0.0, Culture=neutral,
> PublicKeyToken=b77a5c561934e089'.
>at
> PostSharp.Sdk.CodeModel.AssemblyEnvelope.GetTypeDefinition(String 
> typeName,
> BindingOptions bindingOptions)
>at
> PostSharp.Sdk.CodeModel.TypeRefDeclaration.GetTypeDefinition(BindingOptions
> bindingOptions)
>at
> PostSharp.Sdk.CodeModel.TypeSpecDeclaration.GetTypeDefinition(BindingOptions
> bindingOptions)
>at
> PostSharp.Sdk.Extensibility.Tasks.IndexGenericInstancesTask.Execute()
>at PostSharp.Sdk.Extensibility.Project.ExecutePhase(String phase)
>at PostSharp.Sdk.Extensibility.Project.Execute()
>at PostSharp.Hosting.PostSharpObject.ExecuteProjects()
>at
> PostSharp.Hosting.PostSharpObject.InvokeProject(ProjectInvocation
> projectInvocation)


 So following the tips of experts, I added a PostSharp.Custom.targetsfile 
 to my solution folder:

 
> http://schemas.microsoft.

[mono-android] Handle incoming SMS

2012-08-24 Thread Александр
How can i handle and read incoming SMS message? On android.



--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Handle-incoming-SMS-tp5711524.html
Sent from the Mono for Android mailing list archive at Nabble.com.
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


Re: [mono-android] PostSharp 2.1 and Mono for Android

2012-08-24 Thread Miha Markic
Yep, perhaps if enough people requested PS support for M4A we could change 
Gael's mind.

Miha

From: monodroid-boun...@lists.ximian.com 
[mailto:monodroid-boun...@lists.ximian.com] On Behalf Of Matthew Leibowitz
Sent: Friday, August 24, 2012 9:18 AM
To: Discussions related to Mono for Android; monoto...@lists.ximian.com
Subject: Re: [mono-android] PostSharp 2.1 and Mono for Android

Hi all,

Just some new from the PostSharp guys:
Mono is only unofficially supported (you'll see in the support agreement that 
it is not supported). From the next version of PostSharp, we will completely 
stop testing our product with Mono (Mono testing currently is very weak 
anyway), so the support will even be worse.
http://support.sharpcrafters.com/discussions/questions/34-unofficial-mono-for-android-monotouch-support

Bad news for the MonoTouch guys who have to use the Mono compiler.

But, this looks good (you still need the Microsoft.NET):
Portable class libraries are not supported in PostsSharp 2.1. It will be 
supported in PostSharp 3.0.
http://support.sharpcrafters.com/discussions/problems/258-portable-class-libraries-support

I put in a feature request for MonoTouch/Mono for Android here:
http://support.sharpcrafters.com/discussions/suggestions/7-mono-for-android-monotouch-support

So, if you feel that you could use PostSharp in your apps, then just leave some 
incentive for Gael. Remember that there is a free full version for OpenSource 
projects and Students as well as a free Starter Edition:
http://www.sharpcrafters.com/purchase/discounts

So, let's stand together and fill that request with replies and keep support 
for Mono.

My use case is with the MvvmCross framework. It is so good that all code 
virtually goes into a Totally 100% cross-platformable ViewModel, and I just use 
the different Views and Bindings. But we have to implement the 
INotifyPropertyChanged and the horrible RaiseEvent for each property. I have a 
POC that works brilliantly with PostSharp, so there is very little non-bussines 
logic in the VM.


Matthew Leibowitz


On Fri, Aug 3, 2012 at 10:44 AM, Sayed Arian Kooshesh 
mailto:koosh...@gmail.com>> wrote:
which mean (guessing) you are targeting v3? Perhaps you changed it 4?

On Fri, Aug 3, 2012 at 3:43 AM, Sayed Arian Kooshesh 
mailto:koosh...@gmail.com>> wrote:
Look like, from the log, it was looking for 'mscorlib_3' and couldn't find 
(till now)
On Fri, Aug 3, 2012 at 3:04 AM, Matthew Leibowitz 
mailto:mattleibowm...@gmail.com>> wrote:
Well, some weird news, all is now working. I did nothing except:

I first tried updating PostSharp to version 2.1.7.6. This made no changes.
Then, I created the sample in VS 2012:  
http://www.sharpcrafters.com/postsharp/documentation#getting-started. No work...
In utter desperation I created the same project in VS 2012. It worked. Hmm.
So I tried the VS 2012 project again. Still no go.
Then, the brainwave. The VS 2010 project works, so lets open that in VS 2012. 
That worked. The only difference was the project files and the VS version.
I assumed that as the same project file (the one from VS 2010) worked in both 
VS versions, then it must be the project file. Wrong! Both the code and the 
project file were exactly the same. The only difference was the project GUID - 
one line.

Now here comes the crazy part (before I broke down in tears):
I opened the original project (the one with the errors). It now builds fine :)

Don't ask me what happened. I haven't touched that project since yesterday. 
Maybe it was the upgrade slowly kicking in or maybe it was the first build with 
VS 2010. Or maybe it was the incessant building and re-building. (Or the hand 
waving).

Note: you do need the PostSharp.Custom.targets file.

So the sum of the story is: It works. Who knows why.

Hope this helps :)

Matthew


On Fri, Aug 3, 2012 at 8:46 AM, Matthew Leibowitz 
mailto:mattleibowm...@gmail.com>> wrote:
Hi,

That "when I get home" turned into a "tomorrow", but here is some more 
information:

With just a plain old PostSharp 2.1 install and a simple project I get this:

Unhandled exception (2.1.3.3, 32 bit, CLR 2.0, Release): 
PostSharp.Sdk.CodeModel.BindingException: Cannot find the type 'System.Func`2' 
in assembly 'mscorlib, Version=2.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089'.
   at PostSharp.Sdk.CodeModel.AssemblyEnvelope.GetTypeDefinition(String 
typeName, BindingOptions bindingOptions)
   at 
PostSharp.Sdk.CodeModel.TypeRefDeclaration.GetTypeDefinition(BindingOptions 
bindingOptions)
   at 
PostSharp.Sdk.CodeModel.TypeSpecDeclaration.GetTypeDefinition(BindingOptions 
bindingOptions)
   at PostSharp.Sdk.Extensibility.Tasks.IndexGenericInstancesTask.Execute()
   at PostSharp.Sdk.Extensibility.Project.ExecutePhase(String phase)
   at PostSharp.Sdk.Extensibility.Project.Execute()
   at PostSharp.Hosting.PostSharpObject.ExecuteProjects()
   at PostSharp.Hosting.PostSharpObject.InvokeProject(ProjectInvocation 
projectInvocation)

So following the tips of experts

Re: [mono-android] PostSharp 2.1 and Mono for Android

2012-08-24 Thread Matthew Leibowitz
Just remember to use the SharpCrafters forum for your comments:

http://support.sharpcrafters.com/discussions/suggestions/7-mono-for-android-monotouch-support


Gael doesn't use this one :)


On Fri, Aug 24, 2012 at 9:31 AM, Miha Markic  wrote:

>  Yep, perhaps if enough people requested PS support for M4A we could
> change Gael’s mind.
>
> ** **
>
> Miha
>
> ** **
>
> *From:* monodroid-boun...@lists.ximian.com [mailto:
> monodroid-boun...@lists.ximian.com] *On Behalf Of *Matthew Leibowitz
> *Sent:* Friday, August 24, 2012 9:18 AM
> *To:* Discussions related to Mono for Android; monoto...@lists.ximian.com
>
> *Subject:* Re: [mono-android] PostSharp 2.1 and Mono for Android
>
> ** **
>
> Hi all,
>
> ** **
>
> Just some new from the PostSharp guys:
>
> Mono is only unofficially supported (you'll see in the support agreement
> that it is not supported). From the next version of PostSharp, we will
> completely stop testing our product with Mono (Mono testing currently is
> very weak anyway), so the support will even be worse.
>
>
> http://support.sharpcrafters.com/discussions/questions/34-unofficial-mono-for-android-monotouch-support
> 
>
> ** **
>
> Bad news for the MonoTouch guys who have to use the Mono compiler.
>
> ** **
>
> But, this looks good (you still need the Microsoft.NET):
>
> Portable class libraries are not supported in PostsSharp 2.1. It will be
> supported in PostSharp 3.0. 
>
>
> http://support.sharpcrafters.com/discussions/problems/258-portable-class-libraries-support
> 
>
> ** **
>
> I put in a feature request for MonoTouch/Mono for Android here:
>
>
> http://support.sharpcrafters.com/discussions/suggestions/7-mono-for-android-monotouch-support
>  
>
> ** **
>
> So, if you feel that you could use PostSharp in your apps, then just leave
> some incentive for Gael. Remember that there is a free full version for
> OpenSource projects and Students as well as a free Starter Edition:
>
> http://www.sharpcrafters.com/purchase/discounts 
>
> ** **
>
> So, let's stand together and fill that request with replies and keep
> support for Mono.
>
> ** **
>
> My use case is with the MvvmCross framework. It is so good that all code
> virtually goes into a Totally 100% cross-platformable ViewModel, and I just
> use the different Views and Bindings. But we have to implement the
> INotifyPropertyChanged and the horrible RaiseEvent for each property. I
> have a POC that works brilliantly with PostSharp, so there is very little
> non-bussines logic in the VM.
>
> ** **
>
> ** **
>
> Matthew Leibowitz
>
> ** **
>
> ** **
>
> On Fri, Aug 3, 2012 at 10:44 AM, Sayed Arian Kooshesh 
> wrote:
>
> which mean (guessing) you are targeting v3? Perhaps you changed it 4?
>
> ** **
>
> On Fri, Aug 3, 2012 at 3:43 AM, Sayed Arian Kooshesh 
> wrote:
>
> Look like, from the log, it was looking for 'mscorlib_3' and couldn't
> find (till now)
>
> On Fri, Aug 3, 2012 at 3:04 AM, Matthew Leibowitz <
> mattleibowm...@gmail.com> wrote:
>
>  Well, some weird news, all is now working. I did nothing except:
>
> ** **
>
> I first tried updating PostSharp to version 2.1.7.6. This made no changes.
> 
>
> Then, I created the sample in VS 2012:
> http://www.sharpcrafters.com/postsharp/documentation#getting-started. No
> work...
>
> In utter desperation I created the same project in VS 2012. It worked. Hmm.
> 
>
> So I tried the VS 2012 project again. Still no go.
>
> Then, the brainwave. The VS 2010 project works, so lets open that in VS
> 2012. That worked. The only difference was the project files and the VS
> version.
>
> I assumed that as the same project file (the one from VS 2010) worked in
> both VS versions, then it must be the project file. Wrong! Both the code
> and the project file were exactly the same. The only difference was the
> project GUID - one line.
>
> ** **
>
> Now here comes the crazy part (before I broke down in tears):
>
> I opened the original project (the one with the errors). It now builds
> fine :)
>
> ** **
>
> Don't ask me what happened. I haven't touched that project since
> yesterday. Maybe it was the upgrade slowly kicking in or maybe it was the
> first build with VS 2010. Or maybe it was the incessant building and
> re-building. (Or the hand waving).
>
> ** **
>
> Note: you do need the PostSharp.Custom.targets file.
>
>
> So the sum of the story is: It works. Who knows why.
>
> ** **
>
> Hope this helps :)
>
> ** **
>
> Matthew
>
> ** **
>
> ** **
>
> On Fri, Aug 3, 2012 at 8:46 AM, Matthew Leibowitz <
> mattleibowm...@gmail.com> wrote:
>
> Hi,
>
> ** **
>
> That "when I get home" turned into a "tomorrow", but here is some more
> information:
>
> ** **
>
> With just a plain old PostSharp 2.1 install and a simple project I get
> this:
>
> ** **
>
> Unhandled exception (2.1.3.3, 32 bit, CLR 2.0, Release):
> PostSharp.Sdk.CodeModel.BindingException:

Re: [mono-android] Portable rest client

2012-08-24 Thread Matthew Leibowitz
Awesome! Think of no more linked files !

On Fri, Aug 24, 2012 at 1:11 AM, Goncalo Oliveira wrote:

> i think that would be great. I'll try contacting him to see if he's open
> to it.
>
> Goncalo Oliveira
> Sent from my Windows Phone
> --
> From: Matthew Leibowitz
> Sent: 23-08-2012 22:04
> To: Discussions related to Mono for Android
> Subject: Re: [mono-android] Portable rest client
>
> I think that microsoft has bundled the portable class libraries with
> visual studio 2012 shows official-ness? The even have a pclcontrib for all
> those extra types.
>
> We should get that author to do some more looking in this direction :)
> On Aug 23, 2012 6:26 PM, "Goncalo Oliveira"  wrote:
>
>> Some time ago, the author said that he wasn't going to do anything until
>> portable libraries were officially out. And at the moment, that I know of,
>> there is no work in progress.
>>
>> Would be great though...
>>
>> On 23 August 2012 17:21, Matthew Leibowitz wrote:
>>
>>> Is there any work going on to port the restsharp library into a portable
>>> one?
>>> On Aug 23, 2012 6:01 PM, "Goncalo Oliveira"  wrote:
>>>
 Yes, that's what I'm using.

 I guess my question was not correctly formed.
 I am currently using RestSharp yes, it's pretty stable and there are
 side projects for monodroid and monotouch which is great.

 The thing is, we are doing some experiences with portable libraries.
 And it would be great if in this portable library I could use a rest 
 client.
 If there's no viable option, then instead of using one portable library
 I'll have to do what I've been doing so far, that is having multiple
 projects with linked files for all the needed platforms.

 RestSharp isn't available as a portable library yet, unfortunately.

 Cheers


 On 21 August 2012 18:03, Sayed Arian Kooshesh wrote:

> restsharp? Even has a mono-droid fork
>
> On Tue, Aug 21, 2012 at 11:30 AM, Goncalo Oliveira  > wrote:
>
>> Hi everyone,
>>
>> Has anyone found a portable REST library for usage with the client?
>>
>> Cheers
>>
>> --
>> Gonçalo Oliveira
>>
>> ___
>> Monodroid mailing list
>> Monodroid@lists.ximian.com
>>
>> UNSUBSCRIBE INFORMATION:
>> http://lists.ximian.com/mailman/listinfo/monodroid
>>
>>
>
>
> --
> Extreme Knowledge is not something for which he programs a computer
> but for which his computer is programming him.
>
> -Wozniak
>
>
>- if my programming advice has helped you, feel free to donate to
>: 
> 
>
> 
> 
>
> ___
> Monodroid mailing list
> Monodroid@lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
>


 --
 Gonçalo Oliveira

 ___
 Monodroid mailing list
 Monodroid@lists.ximian.com

 UNSUBSCRIBE INFORMATION:
 http://lists.ximian.com/mailman/listinfo/monodroid


>>> ___
>>> Monodroid mailing list
>>> Monodroid@lists.ximian.com
>>>
>>> UNSUBSCRIBE INFORMATION:
>>> http://lists.ximian.com/mailman/listinfo/monodroid
>>>
>>>
>>
>>
>> --
>> Gonçalo Oliveira
>>
>> ___
>> Monodroid mailing list
>> Monodroid@lists.ximian.com
>>
>> UNSUBSCRIBE INFORMATION:
>> http://lists.ximian.com/mailman/listinfo/monodroid
>>
>>
> ___
> Monodroid mailing list
> Monodroid@lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
>
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


Re: [mono-android] Unsafe code support

2012-08-24 Thread Miljenko Cvjetko

Hi

If we look into
https://github.com/mono/mono/blob/master/mcs/class/System/System.Net.Sockets/Socket.cs

method:
public int IOControl (IOControlCode ioControlCode, byte[] 
optionInValue, byte[] optionOutValue)
is on line 1448 not 1446. So it means Socket.cs is a little bit changed 
by Xamarin guys...


This function above calls method on line 1430
public int IOControl (int ioctl_code, byte [] in_value, byte [] 
out_value)

and this method has no NotImplementedException... Odd.
Only

 * ObjectDisposedException
 * SocketException and
 * InvalidOperationException


No we can wonder if that is because MA is superset of 
Silverlight/Moonlight and Silverlight introduced
sockets in v 4 as far as I can remember and probably has some 
restrictions. So the mono team

decided to follow those restrictions what if hard to believe...

Another question: to bypass this method somehow?
probably not?!?

Another thought: how much work is to extract that code to desktop 
profile and then test?


Yeah this reminds me of my darkest nightmares when I'm descending 
through .net types, knowing
that possibility to hit the bug (or some other kind of problem) is 
proportional with:


 int i = typeof(fully-qualified-classname).FullName.Length;

I guess  Jon and Atsushi will have to answer this one...

cheers

mel

On 2012.08.24 03:19, Александр wrote:

When i use the Net.Socket.IOControl(IOControlCode.KeepAliveValues,
tcpKeepAlive.ToArray(), null) , i'm getting an exception. Like this:
http://mono-for-android.1047100.n5.nabble.com/file/n5711520/Error.png




--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Unsafe-code-support-tp5711421p5711520.html
Sent from the Mono for Android mailing list archive at Nabble.com.
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid



--
Miljenko Cvjetko dipl.ing. ET
Direktor/CEO
Projektant rješenja/Solution Architect  
Razvojni programer/Senior developer
Voditelj projekta/Project Manager

IX južna obala 13
Kajzerica Zagreb
T: 385 1 777
M: 385 91 557 447 3
F: 385 1 7779556
e: mcvje...@holisticware.net
w: http://www.holisticware.net

___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


Re: [mono-android] Handle incoming SMS

2012-08-24 Thread Tomasz Cielecki
You have to create a broadcast receiver which does this.

I made a quick sample for you from some of the old threads on the
list. ChrisNTR was so kind to help someone else before with this and
made this gist: https://gist.github.com/cc8eec0c5b35fffc05cb

The full BroadcastReceiver can be seen below:

using System.Text;

using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Util;
using Android.Widget;
using Android.Telephony;
using Environment = System.Environment;

namespace MonoDroid.SMSFun
{
[BroadcastReceiver(Enabled = true, Label = "SMS Receiver")]
[IntentFilter(new[] { "android.provider.Telephony.SMS_RECEIVED" })]
public class SMSBroadcastReceiver : BroadcastReceiver
{
private const string Tag = "SMSBroadcastReceiver";
private const string IntentAction =
"android.provider.Telephony.SMS_RECEIVED";

public override void OnReceive(Context context, Intent intent)
{
Log.Info(Tag, "Intent received: " + intent.Action);

if (intent.Action != IntentAction) return;

var bundle = intent.Extras;

if (bundle == null) return;

var pdus = bundle.Get("pdus");
var castedPdus = JNIEnv.GetArray(pdus.Handle);

var msgs = new SmsMessage[castedPdus.Length];

var sb = new StringBuilder();

for (var i = 0; i < msgs.Length; i++)
{
var bytes = new
byte[JNIEnv.GetArrayLength(castedPdus[i].Handle)];
JNIEnv.CopyArray(castedPdus[i].Handle, bytes);

msgs[i] = SmsMessage.CreateFromPdu(bytes);

sb.Append(string.Format("SMS From: {0}{1}Body:
{2}{1}", msgs[i].OriginatingAddress,
Environment.NewLine,
msgs[i].MessageBody));
}

Toast.MakeText(context, sb.ToString(), ToastLength.Long).Show();
}
}
}

Remember to add the RECEIVE_SMS permission in your AndroidManifest:

  



On Fri, Aug 24, 2012 at 9:21 AM, Александр  wrote:
> How can i handle and read incoming SMS message? On android.
>
>
>
> --
> View this message in context: 
> http://mono-for-android.1047100.n5.nabble.com/Handle-incoming-SMS-tp5711524.html
> Sent from the Mono for Android mailing list archive at Nabble.com.
> ___
> Monodroid mailing list
> Monodroid@lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid



-- 
Med Venlig Hilsen / With Best Regards
Tomasz Cielecki
http://ostebaronen.dk
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


[mono-android] GPS

2012-08-24 Thread Domanet
Hi All,

I’m requesting updates by using .RequestLocationUpdates
(LocationManager.GpsProvider,2, 0, this);

This works perfectly and I get the updates every 20 seconds or so.

My issue is on some devices the accuracy is 64+ feet where as I really need
anything less than 16.

What is the best way to keep the GPS on to get a better fix?

Thanks





--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/GPS-tp5711530.html
Sent from the Mono for Android mailing list archive at Nabble.com.
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


Re: [mono-android] GPS

2012-08-24 Thread Tomasz Cielecki
There is an example here:
http://stackoverflow.com/questions/1993016/android-how-to-keep-gps-active-until-more-accurate-location-is-provided

Otherwise consider using Xamarin.Mobile: http://xamarin.com/mobileapi,
it has a nice GeoLocation implementation where you can set your
Desired Accuracy and have it keep searching until it reaches that
accuracy.

On Fri, Aug 24, 2012 at 1:48 PM, Domanet  wrote:
> Hi All,
>
> I’m requesting updates by using .RequestLocationUpdates
> (LocationManager.GpsProvider,2, 0, this);
>
> This works perfectly and I get the updates every 20 seconds or so.
>
> My issue is on some devices the accuracy is 64+ feet where as I really need
> anything less than 16.
>
> What is the best way to keep the GPS on to get a better fix?
>
> Thanks
>
>
>
>
>
> --
> View this message in context: 
> http://mono-for-android.1047100.n5.nabble.com/GPS-tp5711530.html
> Sent from the Mono for Android mailing list archive at Nabble.com.
> ___
> Monodroid mailing list
> Monodroid@lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid



-- 
Med Venlig Hilsen / With Best Regards
Tomasz Cielecki
http://ostebaronen.dk
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


[mono-android] Object Reference not set... after GC_EXPLICIT on bound object

2012-08-24 Thread James Lavery
Hi all,
I've created a Java Bindings Library, which binds the Sybase Ultralite
Android library so that I can use it in Mono For Android.

This is up and running and has been working well - until now!

What we've found is that as soon as a GC_EXPLICIT is triggered, we're
getting "Object reference not set to an instance of an object" errors and
the system crashes.

The device log shows the following at the same time:


The code for ResultSetConnection.Close is:


and the error is occurring on the /ResultSet.Close()/ call.

/ResultSet/ is an IResultSet as returned from the bound Ultralite library.

As far as I know, I'm cleaning up the ResultSet/PreparedStatement/Connection
in the correct order. 

I've done some reading of the 
http://docs.xamarin.com/android/advanced_topics/garbage_collection
documentation on garbage collection ,  and it's my understanding that the
/ResultSet/ object is a Peer object. 

Is there something I can do - with my binding metadata or C# code - to sort
this out?

Regards,

James



--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Object-Reference-not-set-after-GC-EXPLICIT-on-bound-object-tp5711532.html
Sent from the Mono for Android mailing list archive at Nabble.com.
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


Re: [mono-android] GPS

2012-08-24 Thread Domanet
Thanks.

My problems is that I’m doing that already but with 20 seconds and it keeps
returning about 64 feet.

I guess my only choice is to lower the time and keep the GPS on all the
time.

If a call .RequestLocationUpdates more than once is that a problem?

Can I call .RequestLocationUpdates with 5 seconds and then change to 20 once
I get the accuracy I need and then go back to 5 seconds again if the
accuracy gets higher? 

Once the GPS has a good fix it tends to keep it for a while.

Do you have an example of GPS in a background thread?

I’ve seen examples using a thread and a looper but have been unable to
convert.




--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/GPS-tp5711530p5711533.html
Sent from the Mono for Android mailing list archive at Nabble.com.
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


Re: [mono-android] GPS

2012-08-24 Thread Goncalo Oliveira
I believe that you'll have to lower the time and keep GPS on all time.
There are also great differences in hardware; for example, I am doing a gps
fix every 60 seconds, and having different accuracy values on a Samsung
Galaxy Note and a ZTE china something. Surprisingly, the average values for
the ZTE are under 18m and the Galaxy Note around 30m. If I keep the GPS on
all the time, values improve (ZTE is still better, again, surprisingly).

On 24 August 2012 14:36, Domanet  wrote:

> Thanks.
>
> My problems is that I’m doing that already but with 20 seconds and it keeps
> returning about 64 feet.
>
> I guess my only choice is to lower the time and keep the GPS on all the
> time.
>
> If a call .RequestLocationUpdates more than once is that a problem?
>
> Can I call .RequestLocationUpdates with 5 seconds and then change to 20
> once
> I get the accuracy I need and then go back to 5 seconds again if the
> accuracy gets higher?
>
> Once the GPS has a good fix it tends to keep it for a while.
>
> Do you have an example of GPS in a background thread?
>
> I’ve seen examples using a thread and a looper but have been unable to
> convert.
>
>
>
>
> --
> View this message in context:
> http://mono-for-android.1047100.n5.nabble.com/GPS-tp5711530p5711533.html
> Sent from the Mono for Android mailing list archive at Nabble.com.
> ___
> Monodroid mailing list
> Monodroid@lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>



-- 
Gonçalo Oliveira
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


Re: [mono-android] Object Reference not set... after GC_EXPLICIT on bound object

2012-08-24 Thread Jonathan Pryor
On Aug 24, 2012, at 9:15 AM, James Lavery  wrote:
> What we've found is that as soon as a GC_EXPLICIT is triggered, we're getting 
> "Object reference not set to an instance of an object" errors and the system 
> crashes.

You mention GC_EXPLICIT, then show code that's calling Close(). I'm slightly 
confused. :-)

> The device log shows the following at the same time:

Is there any other output before the stack trace in the `adb logcat` output? 
Perhaps something from Dalvik?

> 08-24 13:58:51.621 I/mono(12463): Stacktrace:
> 08-24 13:58:51.621 I/mono(12463): 
> 08-24 13:58:51.621 I/mono(12463):   at 
> Android.Runtime.JNIEnv.CallVoidMethod (intptr,intptr)
> 08-24 13:58:51.621 I/mono(12463):   at 
> Com.Ianywhere.Ultralitejni12.IResultSetInvoker.Close ()
> 08-24 13:58:51.621 I/mono(12463):   at 
> Autoforms.Universal.Mobile.Droid.DAO.ResultSetConnection.Close ()
> 08-24 13:58:51.621 I/mono(12463):   at 
> Autoforms.Universal.Mobile.Droid.DAO.ResultSetConnection.Finalize ()
> 08-24 13:58:51.621 I/mono(12463):   at (wrapper runtime-invoke) 
> object.runtime_invoke_virtual_void__this__ (object,intptr,intptr,intptr)

This is very interesting; Close() is being called from Finalize().

Does your ResultSetConnection class provide a finalizer? Does it also subclass 
Java.Lang.Object?

Java.Lang.Object subclasses MUST NOT provide a finalizer; override 
Java.Lang.Object.Dispose(bool disposing) instead. Furthermore, as with the 
normal IDisposable pattern, managed objects MUST NOT be referenced when 
`disposing` is false, as those instances may have already been finalized:

partial class ResultSetConnection {

protected override void Dispose (bool disposing)
{
if (disposing) {
ResultSet.Close();
ResultSet.Dispose();

PreparedStatement.Close();
PreparedStatement.Dispose();

Connection.Release();
Connection.Dispose();
}
}

public void Close ()
{
if (Handle == IntPtr.Zero)
return;
base.Dispose ();
}
}

The above makes Close() a synonym for Dispose(), invalidating the instance 
(which may or may not be appropriate for you, but is generally consistent with 
the BCL, e.g. System.IO.Stream [0]).

 - Jon

[0] 
https://github.com/mono/mono/blob/master/mcs/class/corlib/System.IO/Stream.cs#L98

___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


Re: [mono-android] jni error with 4.2.4 on jellybean

2012-08-24 Thread Jonathan Pryor
On Aug 23, 2012, at 5:49 PM, mcleodia  wrote:
> In that case, if the stacktrace in question is the point of failure, then, 
> looking at the error message, something must be disposing of the 
> windowManager object or its DefaultDisplay property.

Right. If you have an easily reproducible test case I'd love to investigate... 
:-)

> it does sound rather like something internal to monodroid is killing a gref 
> out from under my feet :(

Could be a GC bug (lots of things could be a GC bug!), but it doesn't "feel" 
like that to me... I'm not sure.

> Incidentally, I saw another "impossible" stacktrace today whilst trying to 
> recreate the gref issue with logging enabled.

Does this exception kill your app, preventing you from getting a full log?

 - Jon

___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


Re: [mono-android] Object Reference not set... after GC_EXPLICIT on bound object

2012-08-24 Thread James Lavery
Jonathan,
Thanks for the reply. 

Yes, I mention GC_EXPLICIT and then don't show it. Stupid me - copied one
line too low in the output. Here it is properly:


ResultSetConnection does /not/ subclass Java.Lang.Object. It is a plain C#
object. ResultSet, PreparedStatement and Connection are supplied by the
bound library and therefore - I presume /do/ subclass Java.Lang.Object.

Yes, ResultSetConnection does have a finalizer (I presume you mean
destructor):


So my understanding (from your explanation) is that I don't (in fact
can't/shouldn't) override Java.Lang.Object.Dispose().

So there's definitely more I'm missing!

Regards,

James



--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Object-Reference-not-set-after-GC-EXPLICIT-on-bound-object-tp5711532p5711537.html
Sent from the Mono for Android mailing list archive at Nabble.com.
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


Re: [mono-android] Unsafe code support

2012-08-24 Thread Jonathan Pryor
On Aug 24, 2012, at 3:51 AM, Miljenko Cvjetko  wrote:
> If we look into
> https://github.com/mono/mono/blob/master/mcs/class/System/System.Net.Sockets/Socket.cs

Wrong branch; Mono for Android is based on Mono 2.10, not master:


https://github.com/mono/mono/blob/mono-2-10/mcs/class/System/System.Net.Sockets/Socket.cs

I'm still not sure why line 1446 is still wrong, but it does show us what the 
issue is; he's calling:

IOControl(IOControlCode.KeepAliveValues, tcpKeepAlive.ToArray(), null);

Which means he's calling the IOControl(IOControlCode, byte[], byte[]) overload:


https://github.com/mono/mono/blob/mono-2-10/mcs/class/System/System.Net.Sockets/Socket.cs#L1461

This overload does nothing, and simply throws NotImplementedException, which is 
what he's seeing. Oops.

The fix is to do what master does: call the IOControl(int, byte[], byte[]) 
overload, which is implemented:

IOControl ((int) IOControlCode.KeepAliveValues, tcpKeepAlive.ToArray(), 
null);

> No we can wonder if that is because MA is superset of Silverlight/Moonlight 
> and Silverlight introduced sockets in v 4 as far as I can remember and 
> probably has some restrictions. So the mono team decided to follow those 
> restrictions what if hard to believe...

For future "research" purposes, when trying to determine which code is present 
in Mono for Android, you'll need to know:

1. The correct branch, in this case the mono-2-10 branch. (We'll eventually 
rebase atop 2.12, once that's out + ~6 months...)

2. Which files are included for a given assembly, which are listed in the 
mcs/class/ASSEMBLY/monodroid_ASSEMBLY.dll.sources file:


https://github.com/mono/mono/blob/mono-2-10/mcs/class/System/monodroid_System.dll.sources

Note that csc has an extension to #include the contents of other files, so for 
System.dll we also need:


https://github.com/mono/mono/blob/mono-2-10/mcs/class/System/mobile_System.dll.sources

3. Which #defines are set, generally NET_2_0, NET_2_1, MOBILE, and MONODROID. 
Based on that we can see that the Socket(SocketInformation) constructor won't 
be provided:


https://github.com/mono/mono/blob/mono-2-10/mcs/class/System/System.Net.Sockets/Socket.cs#L184

 - Jon

___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


[mono-android] USB Communication, Interpreting Endpoints

2012-08-24 Thread girth
I posted the same question over at StackOverflow (
http://stackoverflow.com/q/12111417/202967
http://stackoverflow.com/q/12111417/202967 ), but I thought this forum might
be a more appropriate audience. 

Basically, I noticed when trying to establish communication to a device as a
USB host that one of the endpoints on the interface of my device was
"DirMask" and the other was "Out". What is "DirMask"? The inline
documentation is incomplete, as well as the online docs: 
http://api.xamarin.com/?link=T%3aAndroid.Hardware.Usb.UsbAddressing
http://api.xamarin.com/?link=T%3aAndroid.Hardware.Usb.UsbAddressing 

I'm assuming that this is my problem with being able to communicate, but at
this point I'm just not sure as I'm a new Android developer.

Thanks.



--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/USB-Communication-Interpreting-Endpoints-tp5711539.html
Sent from the Mono for Android mailing list archive at Nabble.com.
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


Re: [mono-android] Object Reference not set... after GC_EXPLICIT on bound object

2012-08-24 Thread Jonathan Pryor
On Aug 24, 2012, at 11:03 AM, James Lavery  wrote:
> ResultSetConnection does /not/ subclass Java.Lang.Object. It is a plain C# 
> object.

A plain C# object with a finalizer [0]. You must be VERY CAREFUL when 
implementing finalizers:


http://msdn.microsoft.com/en-us/library/b1yfkh5e(VS.100).aspx#sectionToggle1
>   • An object's Finalize method should free any external resources that 
> the object owns. Moreover, a Finalize method should release only resources 
> that the object has held onto. The Finalize method should not reference any 
> other objects.

Emphasis on "external," which you should read as "unmanaged types." ResultSet, 
PreparedStatement, etc. are managed types, and thus their lifetime is 
controlled by the GC. Also note the last sentence, "The Finalize method should 
not reference any other objects."

FINALIZERS MUST NOT USE GC-CONTROLLED INSTANCES.

There is no ordering between finalizer invocation of instances [1]. 
Consequently, there is NO WAY to ensure that your ResultSetConnection instance 
is finalized _before_ the held e.g. ResultSet instance. What's probably 
happening to you is that the ResultSet instance is being finalized before your 
ResultSetConnection instance, and thus has it's Handle cleared out, so when you 
later attempt to call Close(), you're calling it on an invalid instance.

Again, Don't Do That™. In general, you should avoid finalizers, period, unless 
you really, _really_ can't avoid them.

 - Jon

[0] It's a "finalizer", not a "destructor": 
http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-334.pdf 
§17.12:

> [Note: In the previous version of this standard, what is now referred to as a 
> "finalizer" was called a "destructor". Experience has shown that the term 
> "destructor" caused confusion and often resulted to incorrect expectations, 
> especially to programmers knowing C++. In C++, a destructor is called in a 
> determinate manner, whereas, in C#, a finalizer is not. To get determinate 
> behavior from C#, one should use Dispose. end note]

[1] OK, there is _a_ way to ensure some form of finalizer ordering by using 
CriticalFinalizerObject [2]. However, this only provides a loose ordering 
between "normal" finalizable instances and critical finalizable instances -- 
the critical ones are finalized _after_ the normal ones -- but it does nothing 
about ordering between instances within the same "category."

This is still irrelevant, though, as Mono doesn't implement the "delayed" 
finalizer semantics for CriticalFinalizerObject.

[2] 
http://msdn.microsoft.com/en-us/library/system.runtime.constrainedexecution.criticalfinalizerobject.aspx

___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


Re: [mono-android] GPS

2012-08-24 Thread Domanet
Thanks,

Are you requesting the updates in a background thread?

Else what is the effect on the main thread with all those GPS updates?

I'm using a Galaxy and getting 64m normally unless it's kept on the HTC one
x was mostly 8m...

I guess it comes down to the GPS driver on the device.

I was hoping not to have kill the battery.



--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/GPS-tp5711530p5711540.html
Sent from the Mono for Android mailing list archive at Nabble.com.
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


Re: [mono-android] Object Reference not set... after GC_EXPLICIT on bound object

2012-08-24 Thread James Lavery
Jon,
Yes - the problem was the fact that I was using a Finalizer when I didn't
need to at all.

All I needed to do was call ResultSetConnection.Close() in a finally {}
block, and for Close() to just call ResultSet.Close(),
PreparedStatement.Close() and Connection.Release() with no explicit
Dispose() calls.

Having done this, all is working.


James



--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Object-Reference-not-set-after-GC-EXPLICIT-on-bound-object-tp5711532p5711542.html
Sent from the Mono for Android mailing list archive at Nabble.com.
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


Re: [mono-android] GPS

2012-08-24 Thread Goncalo Oliveira
I'm using a service to request the GPS updates, and then broadcasting the
outcome.

On 24 August 2012 16:37, Domanet  wrote:

> Thanks,
>
> Are you requesting the updates in a background thread?
>
> Else what is the effect on the main thread with all those GPS updates?
>
> I'm using a Galaxy and getting 64m normally unless it's kept on the HTC one
> x was mostly 8m...
>
> I guess it comes down to the GPS driver on the device.
>
> I was hoping not to have kill the battery.
>
>
>
> --
> View this message in context:
> http://mono-for-android.1047100.n5.nabble.com/GPS-tp5711530p5711540.html
> Sent from the Mono for Android mailing list archive at Nabble.com.
> ___
> Monodroid mailing list
> Monodroid@lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>



-- 
Gonçalo Oliveira
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


Re: [mono-android] cannot convert from 'lambda expression' to 'System.Action'

2012-08-24 Thread Maximilian Wilson
 On Sat, Aug 18, 2012 at 9:03 PM, Sayed Arian Kooshesh 
 wrote:

> youdon't need to wrap the action
>
> you can just do () => {} ;
>
>
Most of the time, yes. In some cases the implicit conversion fails, though
as I mentioned I don't remember the specific cases where I've hit this. (I
think when the callee is expecting a Delegate object, vs. some specific
Delegate type.)

-Max


-- 
Hahahah!!! That is ME laughing at YOU, cruel world.
-Jordan Rixon

I could not love thee, dear, so much,
Loved I not Honour more.
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


[mono-android] How to keep tabs at the bottom of the screen?

2012-08-24 Thread dickies
Hi -

New to Mono for Android and have been following this tutorial:
http://docs.xamarin.com/android/tutorials/User_Interface/tab_layout

All good, until I added a ListView onto one of the Activities that gets
loaded on a tab. When I added an ItemClick event onto the ListView and used
StartActivity, the tabs disappeared and the UI just showed the new Activity.

private void HandleClick (object sender, AdapterView.ItemClickEventArgs e)
{
var t = _list[e.Position];
var intent = new Intent();
intent.SetClass(this, typeof(DealCategoriesActivity));
StartActivity(intent); // this loads the new activity, but wipes the tabs!
}

This makes sense that it should do this, but I want to keep the tabs at the
bottom because I'm porting from an iOS app which uses a UITabBarController.
I've probably just missed something very obvious.

Can anyone post an example on how I could go about this?



--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/How-to-keep-tabs-at-the-bottom-of-the-screen-tp5711545.html
Sent from the Mono for Android mailing list archive at Nabble.com.
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid