Re: [mono-android] How to change the network state of device?

2012-09-13 Thread ukrandruha
Thank you all, I figured out how to do it
on Java
(http://manski.net/2012/03/30/accessing-java-classes-from-mono-for-android-via-jni/)
create library

package com.mayastudios.jnitest;

import android.content.Context;
import android.net.ConnectivityManager;
import java.lang.reflect.Method;

public class JniTest {
  
  public JniTest() { 
// Force the user to create an instance
  }
  
  public String getGreetingText() {
return "Hello, 333 " + android.os.Build.MODEL;
  }
  
  public void setMobileDataEnabled(Context paramContext,boolean on)
  {
  try {

  ConnectivityManager connectivityManager = 
(ConnectivityManager)paramContext.getSystemService("connectivity");

  Method method =
connectivityManager.getClass().getMethod("setMobileDataEnabled",
boolean.class);
  method.invoke(connectivityManager, on);
  } catch (NoSuchMethodException e)
  {
  e.printStackTrace();
  } catch (Exception e)
  {
  e.printStackTrace();
  }
  }
  
  public  boolean getMobileDataEnabled(Context paramContext)
  {
  try {
  ConnectivityManager connectivityManager = 
(ConnectivityManager)paramContext.getSystemService("connectivity");
  Method method =
connectivityManager.getClass().getMethod("getMobileDataEnabled");
  return (Boolean) method.invoke(connectivityManager);
  } catch (Exception e) {
  e.printStackTrace();
  return false;
  }

  }
}

on VS

void EnableGPRS(Context ct)
{
bool on = false;

IntPtr nativeJavaClass =
JNIEnv.FindClass("com/mayastudios/jnitest/JniTest");

IntPtr defaultConstructor = JNIEnv.GetMethodID(nativeJavaClass,
"", "()V");

IntPtr instance = JNIEnv.NewObject(nativeJavaClass,
defaultConstructor);


//IntPtr method1 = JNIEnv.GetMethodID(nativeJavaClass,
"getGreetingText", "()Ljava/lang/String;");
IntPtr method1 =  JNIEnv.GetMethodID(nativeJavaClass,
"getMobileDataEnabled", "(Landroid/content/Context;)Z");
on = JNIEnv.CallBooleanMethod(instance, method1, new JValue(ct));

IntPtr method = JNIEnv.GetMethodID(nativeJavaClass,
"setMobileDataEnabled", "(Landroid/content/Context;Z)V");

JValue[] p = new JValue[] { new JValue(ct), new JValue(!on) }; 
  

IntPtr resultPtr = JNIEnv.CallObjectMethod(instance, method,p);
}



--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/How-to-change-the-network-state-of-device-tp5711776p5711793.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] Installed version

2012-09-13 Thread Miha Markic
Hi Jon,

OK, got that.
I think it might make sense to include this detailed version information 
somewhere in VS as well. Perhaps on Tools/Options/Mono For Android page?
Easier to read it, not a big deal though.

Miha

-Original Message-
From: monodroid-boun...@lists.ximian.com 
[mailto:monodroid-boun...@lists.ximian.com] On Behalf Of Jonathan Pryor
Sent: Wednesday, September 12, 2012 5:42 PM
To: Discussions related to Mono for Android
Subject: Re: [mono-android] Installed version

On Sep 12, 2012, at 9:15 AM, Miha Markic  wrote:
> Is there an About information of MonoForAndroid full version somewhere in 
> Visual Studio? The VS' About dialog shows just 4.2.5.

Assuming you're on a 64-bit Windows...

C:\Program Files (x86)\MSBuild\Novell\mandroid.exe --version > 
version.txt
start version.txt

 - 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] Empy devices running

2012-09-13 Thread zed3
thanks for the reply, but I have not solved the problem. After I click start
the window closes and does not open the emulator. This evening I will try to
install everything on a clean machine.



--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Empy-devices-running-tp5711778p5711795.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


[mono-android] Designer can't load custom controls

2012-09-13 Thread Goncalo Oliveira
Hi,

I have a view named SquareLayout that inherits LinearLayout. When adding
this view in the axml, the designer doesn't know what to do with it and
throws an exception

*The layout could not be loaded: com.android.layoutlib.bridge.MockView
cannot be cast to android.View.ViewGroup*

The same thing happens if I add a PagerTabStrip, which is probably related
to bug 6751
https://bugzilla.xamarin.com/show_bug.cgi?id=6751

Am I missing something?

Cheers,

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

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


Re: [mono-android] Empy devices running

2012-09-13 Thread Jeremy A. Kolb - ARA/NED
Right.  What you HAVE to do is start the emulator BEFORE starting Visual 
Studio.  Otherwise the emulator will never start.

-Original Message-
From: monodroid-boun...@lists.ximian.com 
[mailto:monodroid-boun...@lists.ximian.com] On Behalf Of zed3
Sent: Thursday, September 13, 2012 4:53 AM
To: monodroid@lists.ximian.com
Subject: Re: [mono-android] Empy devices running

thanks for the reply, but I have not solved the problem. After I click start 
the window closes and does not open the emulator. This evening I will try to 
install everything on a clean machine.



--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Empy-devices-running-tp5711778p5711795.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
___
Monodroid mailing list
Monodroid@lists.ximian.com

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


Re: [mono-android] Silent App crash

2012-09-13 Thread Igor Russkih
Hrr, no ideas/suggestions?

  Igor


On Sun, Sep 9, 2012 at 11:16 PM, Igor Russkih  wrote:

> Hello.
>
> Our user reported a silent permanent app crash on LG gt 540 (android 2.1)
>
> logcat shows no exceptions at all. Immediately after activity showup, at
> some moment (current undestanding - as soon as user taps on the main
> acitvity screen elements) the process just dies silently:
>
> I/APPLICATION ( 2776): HostView Dispose 09-07 15:33:26.728
> D/WindowManager( 1278): interceptKeyTq 
> event=android.view.RawInputEvent@2f8cf368 keycode=0 screenIsOn=true 
> keyguardActive=false 09-07 15:33:27.898
> D/WindowManager( 1278): interceptKeyTq 
> event=android.view.RawInputEvent@2f8cf368 keycode=0 screenIsOn=true 
> keyguardActive=false 09-07 15:33:29.548
> D/WindowManager( 1278): interceptKeyTq 
> event=android.view.RawInputEvent@2f8cf368 keycode=0 screenIsOn=true 
> keyguardActive=false 09-07 15:33:29.638
> D/WindowManager( 1278): interceptKeyTq 
> event=android.view.RawInputEvent@2f8cf368 keycode=0 screenIsOn=true 
> keyguardActive=false 09-07 15:33:30.113
> D/WindowManager( 1278): interceptKeyTq 
> event=android.view.RawInputEvent@2f8cf368 keycode=0 screenIsOn=true 
> keyguardActive=false 09-07 15:33:30.238
> D/WindowManager( 1278): interceptKeyTq 
> event=android.view.RawInputEvent@2f8cf368 keycode=0 screenIsOn=true 
> keyguardActive=false 09-07 15:33:31.108 *I/ActivityManager( 1278): Process 
> APPLICATION.android (pid 2776) has died. 09-07 15:33:31.108
> *W/ActivityManager( 1278): Scheduling restart of crashed service 
> APPLICATION.android/APPLICATION.APPLICATIONService in 2ms 09-07 
> 15:33:31.118
> W/GpsLocationProvider( 1278): Unneeded remove listener for uid 1000 09-07 
> 15:33:31.118
> D/GpsLocationProvider( 1278): GPS status listener died 09-07 15:33:31.158 
> *D/Zygote ( 1136): Process 2776 terminated by signal (11) 09-07 15:33:31.632 *
>
> There probably could be issue in the app (but on many other platforms and
> android versions it works fine).
>
> Just courious - are there any conditions where mono can silently die?
> Because all time in my environment I see at least "unhandled exception"
> stacktrace. But here is nothing!
>
> Is there any mono extra debug/logging which could be enabled to understand
> the problem?
>
>   Igor
>
___
Monodroid mailing list
Monodroid@lists.ximian.com

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


[mono-android] Designer locks

2012-09-13 Thread Goncalo Oliveira
Hi,

What's up with the visual studio designer locks in 4.2.5?
I used to be able to select a screen and lock by screen size (normal,
large, extra large) but now that possibility is gone.
Also, if I fiddle a little bit, some of the locks disappear or get behind
text or behind the gray bar...

Cheers

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

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


[mono-android] Upload to device - device not listed

2012-09-13 Thread dickies
Using the latest builds...

Given that I've connected my andriod device to my mac and have MonoDevelop
open, when I click Run > Upload to Device, the Select Device dialog opens,
but my device is not listed.

I have killed and restarted the adb server, but still no luck.

How can I upload my app to my device?



--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Upload-to-device-device-not-listed-tp5711801.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] Upload to device - device not listed

2012-09-13 Thread dickies
Panic over, I had to go onto my device Settings > Applications > Development
and make sure you tap USB debugging so the tick goes green.

I stupidly thought that because it was already ticked it was active, but no
the tick must be green...



--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Upload-to-device-device-not-listed-tp5711801p5711802.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