Re: [mono-android] JavaScript Interface

2011-09-15 Thread Maik
Jonathan Pryor  writes:

> 
> On Aug 12, 2011, at 8:56 AM, malexandroni wrote:
> > I tried the JS interface in Java and it works fine, but I tried to 
replicate the code in Mono for Android and it
> does not work. What am I doing wrong?
> 
> That won't work at this point in time. 
> 
> The problem is reflection: in order for the JavaScript to invoke the method 
on the provided Java object,
> Android uses Java reflection in order to see if the method exists, and if it 
does to then invoke the method.
> This works in Java because the JavaScriptInterface type has a `showToast` 
method.
> 
> This doesn't work in Mono for Android, because `mandroid` only generates 
Java method declarations for
> methods that override base class methods or implement interface methods. 
Consequently, your C#
> JavaScriptInterface.showToast() method isn't visible to the Java world, and 
things don't work. (To see
> what I mean, look at obj\Debug\android\src\**\JavaScriptInterface.java, and 
see what methods are present.)
> 
> We intent to support this in a future release (timeframe: unspecified), but 
that doesn't help _now_.
> 
> What will help now is a workaround: write your JavaScriptInterface type in 
a .java file, include the .java
> file in your project with a AndroidJavaSource Build action, and in 
Activity1.OnCreate(), do:
> 
>   IntPtr JavaScriptInterface_Class = JNIEnv.FindClass 
("the/package/for/JavaScriptInterface");
>   // TODO: Update "the/package/for" as appropriate for your type.
>   IntPtr JavaScriptInterface_ctor = JNIEnv.GetMethodID 
(JavaScriptInterface_Class, "", "()V");
>   IntPtr instance = JNIEnv.NewObject (JavaScriptInterface_Class, 
JavaScriptInterface_ctor);
> 
>   appView.AddJavascriptInterface (new Java.Lang.Object 
(instance), "Android");
> 
>  - Jon
> 
> ___
> Monodroid mailing list
> Monodroid@...
> 
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
> 
> 


Hi,

I would be interessted in a quick fix for this. Could you please post a sample 
Java file?

Can I write my javascript interface code in the appropriate .net class as it 
has to interact with other stuff within my app. So for my understanding, all 
we need here is a java type for it?

Many thanks
Maik



___
Monodroid mailing list
Monodroid@lists.ximian.com

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


[mono-android] JniEnv problem

2012-03-20 Thread Hänke , Maik
Hi,

 

I try to use a 3rd party library with JNI.

 

I have the following java method header:  

public static native int Msg_UpdateOptions(int lIdentifier, boolean bEnabled, 
boolean bQueue, String functionName, int convention, Object callBackObj);

 

I import the method with this code:

public static int Msg_UpdateOptions(uint lIdentifier, bool bEnabled, bool 
bQueue, String functionName, int convention, Java.Lang.Object callBackObj)

{

   IntPtr methodId = JNIEnv.GetStaticMethodID(mAlkClass, 
"Msg_UpdateOptions", "(IZZLjava/lang/String;ILjava/lang/Object;)I");

   return JNIEnv.CallStaticIntMethod(mAlkClass, methodId, new JValue[] { 

 new JValue(lIdentifier), 

 new JValue(bEnabled),

 new JValue(bQueue),

 new JValue(new Java.Lang.String(functionName)),

 new JValue(convention),

 new JValue(callBackObj)

   });

}

 

In the Java sample the method is used in this way:

Msg_UpdateOptions(AlkMsg.MSG_ID_TurnInstructions, true, false, 
"OnTurnInstructionReceived", 0, this );

 

Where 'this' is an activity and OnTurnInstructionReceived is a method of the 
actvity.

 

public void OnTurnInstructionReceived(int buffer, int len)

{

}

 

When I try this in c#, my app crashes without an error. I think the library try 
to call my OnTurnInstructionReceived method. Does anyone have an idea what is 
wrong?

___
Monodroid mailing list
Monodroid@lists.ximian.com

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


[mono-android] Wrong time in Callback

2012-05-10 Thread Hänke , Maik
Hello,

 

I tried to react to time changes, but in the callback I got the old time.

In my test, the DateTime.Now changed 35 seconds  after the callback was called.

 

What I'm doing wrong?

 

moTimeChangedReceiver = new TimeBroadcastReceiver();

IntentFilter intentFilter = new IntentFilter();

intentFilter.AddAction(Intent.ActionTimeChanged);

intentFilter.AddAction(Intent.ActionTimezoneChanged);

RegisterReceiver(moTimeChangedReceiver, intentFilter);

 

 

private class TimeBroadcastReceiver : BroadcastReceiver

{

public override void OnReceive(Context context, Intent intent)

{

String action = intent.Action;

 

if (action.Equals(Intent.ActionTimeChanged) ||

action.Equals(Intent.ActionTimezoneChanged))

{

   DateTime.Now; // returns old time

TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); // returns old time zone

 

}

}

}

___
Monodroid mailing list
Monodroid@lists.ximian.com

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


[mono-android] Exception while loading assembly

2012-05-15 Thread Hänke , Maik
Hello,

 

I updated monodroid from 4.0.6 to 4.2.1 and can't build the solution anymore.

 

I've got the following error:

Exception while loading assemblies: System.IO.FileNotFoundException: Could not 
load assembly 'ICSharpCode.SharpZLibMobile, Version=0.85.5.452, 
Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for 
Android profile?

File name: 'ICSharpCode.SharpZLibMobile.dll'

   at Monodroid.Tuner.MonoDroidResolver.Resolve(AssemblyNameReference 
reference, ReaderParameters parameters)

   at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1 
assemblies, AssemblyDefinition assembly)

   at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1 
assemblies, AssemblyDefinition assembly)

   at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1 
assemblies, AssemblyDefinition assembly)

   at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1 
assemblies, AssemblyDefinition assembly)

   at Xamarin.Android.Tasks.ResolveAssemblies.Execute()

 

What I have to do?

___
Monodroid mailing list
Monodroid@lists.ximian.com

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


Re: [mono-android] Exception while loading assembly

2012-05-15 Thread Hänke , Maik
What do you mean with Mono for Android profile?

I tried a rebuild and I tried to create a new Android Library Project and 
copied all sources to the project, but I got the same error, too.

-Ursprüngliche Nachricht-
Von: monodroid-boun...@lists.ximian.com 
[mailto:monodroid-boun...@lists.ximian.com] Im Auftrag von Tomasz Cielecki
Gesendet: Dienstag, 15. Mai 2012 14:11
An: Discussions related to Mono for Android
Betreff: Re: [mono-android] Exception while loading assembly

Have you tried rebuilding SharpZLib with the new Mono for Android profile?

On Tue, May 15, 2012 at 1:41 PM, Saeid Yazdani  wrote:
> Exact same problem here...
>
> --
> View this message in context: 
> http://mono-for-android.1047100.n5.nabble.com/Exception-while-loading-
> assembly-tp5709731p5709739.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



___
Monodroid mailing list
Monodroid@lists.ximian.com

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


Re: [mono-android] Exception while loading assembly

2012-05-16 Thread Hänke , Maik
I'm using project references. In my project file the reference looks like this:


  {65BB08BD-4525-473C-BAC3-F1796175528A}
  ICSharpCode.SharpZLibMobile




-Ursprüngliche Nachricht-
Von: monodroid-boun...@lists.ximian.com 
[mailto:monodroid-boun...@lists.ximian.com] Im Auftrag von Jonathan Pryor
Gesendet: Dienstag, 15. Mai 2012 19:11
An: Discussions related to Mono for Android
Betreff: Re: [mono-android] Exception while loading assembly

On May 15, 2012, at 4:06 AM, Hänke, Maik wrote:
> I updated monodroid from 4.0.6 to 4.2.1 and can't build the solution anymore.
>  
> I've got the following error:
> Exception while loading assemblies: System.IO.FileNotFoundException: Could 
> not load assembly 'ICSharpCode.SharpZLibMobile, Version=0.85.5.452, 
> Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for 
> Android profile?

I'm guessing that your .csproj has:



We don't know how to resolve that assembly reference. Instead, use something 
like:


Path\To\ICSharpCode.SharpZLibMobile.dll


or use a Project reference if the ICSharpCode.SharpZLibMobile project is in the 
same solution.

 - Jon

___
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


[mono-android] Bluetooth Discovery Events

2012-05-21 Thread Hänke , Maik
Hello,

 

can someone confirm that it is not possible to receive the 
BluetoothAdapter.ActionDiscoveryStarted or 
BluetoothAdapter.ActionDiscoveryFinished event when searching for Bluetooth 
devices? I implemented a BroadcastReceiver that is registered to 3 events, 
those two from above and BluetoothDevice.DeviceFound. However, it seems that 
only the DeviceFound event is being sent.

 

___
Monodroid mailing list
Monodroid@lists.ximian.com

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


Re: [mono-android] Exception while loading assembly

2012-05-25 Thread Hänke , Maik
I found a solution for my problem. I only added the SharpZLib as project 
reference to the main project. This was not necessary with MonoDroid 4.0

-Ursprüngliche Nachricht-
Von: monodroid-boun...@lists.ximian.com 
[mailto:monodroid-boun...@lists.ximian.com] Im Auftrag von Jonathan Pryor
Gesendet: Mittwoch, 16. Mai 2012 17:32
An: Discussions related to Mono for Android
Betreff: Re: [mono-android] Exception while loading assembly

On May 16, 2012, at 3:28 AM, Hänke, Maik wrote:
> I'm using project references. In my project file the reference looks like 
> this:

If the path to the .csproj is correct (as Tomasz Cielecki suggested checking), 
please file a bug at bugzilla.xamarin.com so that we can investigate. Project 
references certainly should work, though the referenced project needs to be in 
the same project solution (.sln). Is the ICSharpCode.SharpZLibMobile project in 
your .sln?

Thanks,
 - Jon

___
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] Bluetooth Discovery Events

2012-05-25 Thread Hänke , Maik
Thank you for your answer.

The thread does not exactly match our case. It concerns not receiving any 
Bluetooth events at all. In our case, we do receive the ActionFound event but 
not  ActionDiscoveryStarted or ActionDiscoveryFinished. 

This is what we do:

Register:
IntentFilter filter = new IntentFilter(); 
filter.AddAction(BluetoothAdapter.ActionDiscoveryStarted);
filter.AddAction(BluetoothAdapter.ActionDiscoveryFinished);
filter.AddAction(BluetoothDevice.ActionFound);
RegisterReceiver(moReceiver, filter);

Receiver:
private class DiscoveryReceiver : BroadcastReceiver
{
private String msDeviceName = String.Empty;

public event BluetoothDeviceFound DeviceFound;

public override void OnReceive(Context context, Intent intent)
{
String action = intent.Action;
// When discovery finds a device
if (action == BluetoothDevice.ActionFound)
{
// called several times

// Get the BluetoothDevice object from the Intent
BluetoothDevice device = 
intent.GetParcelableExtra(BluetoothDevice.ExtraDevice) as BluetoothDevice;

if (device.Name.ToLower().Contains(msDeviceName.ToLower()))
{
if (DeviceFound != null)
{
DeviceFound(device);
}
BluetoothAdapter.DefaultAdapter.CancelDiscovery();
}
}
else if (action == BluetoothAdapter.ActionDiscoveryStarted)
{
// never called
}
else if (action == BluetoothAdapter.ActionDiscoveryFinished)
{
// never called
}
}
}

Any idea what might be wrong here?

-Ursprüngliche Nachricht-
Von: monodroid-boun...@lists.ximian.com 
[mailto:monodroid-boun...@lists.ximian.com] Im Auftrag von Jonathan Pryor
Gesendet: Donnerstag, 24. Mai 2012 19:32
An: Discussions related to Mono for Android
Betreff: Re: [mono-android] Bluetooth Discovery Events

On May 21, 2012, at 8:42 AM, Hänke, Maik wrote:
> can someone confirm that it is not possible to receive the 
> BluetoothAdapter.ActionDiscoveryStarted 
> orBluetoothAdapter.ActionDiscoveryFinished event when searching for Bluetooth 
> devices? I implemented a BroadcastReceiver that is registered to 3 events, 
> those two from above and BluetoothDevice.DeviceFound. However, it seems that 
> only the DeviceFound event is being sent.

I would guess that you're hitting:

http://stackoverflow.com/a/9430115/83444

 - Jon

___
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


[mono-android] Touch events in view

2012-06-21 Thread Hänke , Maik
Hi,

 

I try to get touch events in my view but only the MotionEventActions.Down 
appears. There are no Up and Down events.

 

I tried override OnTouchEvent in my activity and it works. What is wrong in my 
view?

 

public class TestView : View

{

   public TestView(Context c)

 : base(c)

   {

   }

 

   public override bool OnTouchEvent(MotionEvent e)

   {

  base.OnTouchEvent(e);



  switch (e.Action)

  {

 case MotionEventActions.Down:

   Log.Debug("Test", "DOWN");

   break;

 case MotionEventActions.Up:

   Log.Debug("Test", "UP");

   break;

 case MotionEventActions.Move:

   Log.Debug("Test", "MOVE");

   break;

  }

   }

}

 

[Activity(Label = "TouchTest", MainLauncher = true)]

public class Activity1 : Activity

{

   protected override void OnCreate(Bundle bundle)

   {

 base.OnCreate(bundle);

 

 SetContentView(new TestView(this));

   }

}

 

 

 

 

 

___
Monodroid mailing list
Monodroid@lists.ximian.com

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


[mono-android] Problem with building after debugging

2012-07-13 Thread Hänke , Maik
Hi,

 

when I debugged my app and try to rebuild my application I always got following 
error:

Unable to copy file "C:\devlop\Test\bin\Debug\x.dll.mdb" to 
"bin\Debug\x.dll.mdb". The process cannot access the file 'bin\Debug\x.dll.mdb' 
because it is being used by another process.

 

Anyone have an idea what is wrong?

 

___
Monodroid mailing list
Monodroid@lists.ximian.com

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


Re: [mono-android] Problem with building after debugging

2012-07-13 Thread Hänke , Maik
I used the latest release Version. I updated to  4.2.4 beta and it works now.

 

Von: monodroid-boun...@lists.ximian.com 
[mailto:monodroid-boun...@lists.ximian.com] Im Auftrag von Miha Markic
Gesendet: Freitag, 13. Juli 2012 09:56
An: Discussions related to Mono for Android
Betreff: Re: [mono-android] Problem with building after debugging

 

It is supposed to be fixed in 4.2.4 beta. Which version do you have?

 

Miha

 

From: monodroid-boun...@lists.ximian.com 
[mailto:monodroid-boun...@lists.ximian.com] On Behalf Of Hänke, Maik
Sent: Friday, July 13, 2012 9:30 AM
To: Discussions related to Mono for Android
Subject: [mono-android] Problem with building after debugging

 

Hi,

 

when I debugged my app and try to rebuild my application I always got following 
error:

Unable to copy file "C:\devlop\Test\bin\Debug\x.dll.mdb" to 
"bin\Debug\x.dll.mdb". The process cannot access the file 'bin\Debug\x.dll.mdb' 
because it is being used by another process.

 

Anyone have an idea what is wrong?

 

___
Monodroid mailing list
Monodroid@lists.ximian.com

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


[mono-android] Builderror

2013-01-30 Thread Hänke , Maik
Hi,

 

we encounter a problem building a Monodroid solution with Team Build / TFS2010.

 

The error message appearing in the build log is "!! 
tis.truckbox.muxer.lib.jar" (10 exclamation marks, no further information...)

 

-  The file "tis.truckbox.muxer.lib.jar" is a 3rd party 
AndroidJavaLibrary included in one of our solutions projects.

 

-  Build via Visual Studio 2010 works fine on the same machine with the 
same sources, the error only appears in the automated build.

 

-  Monodroid-Version on the buildserver is the latest 4.4.55.104956787. 
Error occurred with the previous version as well.

 

-  We found out that the error is thrown within the build-target 
"_CheckDuplicateJavaLibraries" in C:\Program Files 
(x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets. We removed the 
CheckDuplicateJavaLibraries-task from the local 
Novell.MonoDroid.Common.targets-file and the error disappeared.

 

Part of the MSBuild output (verbosity=Diagnostics):



 

_ExtractLibraryProjectImports:

Assemblies:

  C:\Program Files (x86)\Reference 
Assemblies\Microsoft\Framework\MonoAndroid\v2.3\Mono.Android.dll

  C:\Program Files (x86)\Reference 
Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Mono.Data.Sqlite.dll

  C:\Program Files (x86)\Reference 
Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll

  C:\Program Files (x86)\Reference 
Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll

  C:\Program Files (x86)\Reference 
Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Data.dll

  C:\Program Files (x86)\Reference 
Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll

  C:\Program Files (x86)\Reference 
Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll

  C:\Program Files (x86)\Reference 
Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.Linq.dll

  
C:\Builds\1\initions\Build\Binaries\Android\initions.OPHEOMOBILE.A\initions.om.app.dll

  
C:\Builds\1\initions\Build\Binaries\Android\initions.OPHEOMOBILE.A\initions.om.bl.dl

  
C:\Builds\1\initions\Build\Binaries\Android\initions.OPHEOMOBILE.A\initions.om.common.dll

  
C:\Builds\1\initions\Build\Binaries\Android\initions.OPHEOMOBILE.A\initions.om.ui.dll

Jars:

ResolvedResourceDirectories:

_CheckDuplicateJavaLibraries:

JavaSourceFiles:

  Java\AlkMsg.java

  Java\AlkMessageReceiver.java

  Java\OpheoTBJavaInterface.java

  Java\OpheoTruckBoxWrapper.java

JavaLibraries:

  Java\tis.truckbox.muxer.lib.jar

!! tis.truckbox.muxer.lib.jar

_UpdateAndroidResgen:

Skipping target "_UpdateAndroidResgen" because all output files are up-to-date 
with respect to the input files.

 



 

Any ideas?

 

Thanks.

 

___
Monodroid mailing list
Monodroid@lists.ximian.com

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


Re: [mono-android] Builderror

2013-02-01 Thread Hänke , Maik
Hi Jon,

thanks for your quick reply.

The problem is that TFS interprets outputs to stderr in the MSBuild task as 
unexpected errors and cancels the whole build process at that point. So we 
can't just ignore that error. Is there any other way to suppress it?

-Ursprüngliche Nachricht-
Von: monodroid-boun...@lists.ximian.com 
[mailto:monodroid-boun...@lists.ximian.com] Im Auftrag von Jonathan Pryor
Gesendet: Freitag, 1. Februar 2013 05:56
An: Discussions related to Mono for Android
Betreff: Re: [mono-android] Builderror

On Jan 30, 2013, at 10:35 AM, "Hänke, Maik"  wrote:
> The error message appearing in the build log is "!! 
> tis.truckbox.muxer.lib.jar" (10 exclamation marks, no further information...)

That's not an error message. That's a message written to stderr. (It's debug 
spew that we probably should have removed ages ago, and unfortunately haven't 
yet.)

It's ignorable.

 - Jon

___
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