[android-developers] VpnService and simple packet capture mechanism?

2012-02-06 Thread mellery451
I'm considering the possibility of using the new android (4.0)
VpnService interface to implement a non-root-required packet capture
utility.

Would it be possible to implement a VpnService such that each packet
it received from the device could be written to a file for subsequent
analysis and then simply sent on to the active network device for
proper delivery?

A normal VPN implementation would have a finite number of connections
to a vpn server to which all packets should be written. In my case,
I'd just want to send the packets along without the server to talk to.
Is this feasible or would OS permissions prevent writing the packet to
the active network? If it is possible, what APIs could I use to write
to the network device(s)?

Advice appreciated.

-Mike Ellery

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Questions about VpnService

2012-02-01 Thread mellery451


On Dec 20 2011, 1:13 pm, Lysandus imbroke...@gmail.com wrote:
 I have a couple questions aboutVpnService.
 Is theVpnServiceadded in 4.0 only for creating a vpn connection for
 your app, or does it make the vpn for all traffic on the device?  If
 it's all device traffic does that mean your app can analyze things
 like what websites the user is visiting?

 Can it be used to just add a new vpn to the device and not have the
 traffic go through your app?

 Thanks.

A VpnService implementation should receive all network traffic from
the device, not just your application traffic. For this reason, there
can only be ONE vpn active at a given time (either a custom impl using
VpnService OR one of the stock android legacy VPNs). The
ParcelFileDescriptor that you get in VpnService allows you to read/
write packets to/from the device. In theory you should be able to
inspect these packets and analyze.

As far as I know, custom VPN implementations using VpnService DO NOT
show-up in the standard VPN configuration settings on the device...and
you actually have to create the client UI code to activate your custom
VPN as well.

-Mike

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: verizon galaxy nexus as dev phone?

2011-12-19 Thread mellery451


On Dec 19, 1:18 pm, Romain Guy romain...@android.com wrote:

 You don't need to have an unlocked phone to install and debug apps. A
 bootloader unlocked phone is only useful if you plan on modifying the
 system itself.

 --
 Romain Guy
 Android framework engineer
 romain...@android.com

There's another case that comes immediately to mind: tcpdump.
Sometimes I find it incredibly useful to tcpdump on my phone and
capture something for later analysis. The Sharkdump tools let you do
this quite easily, but require root because of the device-level access
requirements. In any event, that's a case where I don't so much want
to modify my system as *observe* it.

-Mike Ellery

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Docs: TestSuite - createTest

2011-11-29 Thread mellery451
Can anyone else make sense of this description for the createTest
method?

http://developer.android.com/reference/junit/framework/TestSuite.html#createTest(java.lang.Class,%20java.lang.String)

I was trying to figure out how to dynamically create test suites and
cases at runtime (data driven tests), and this documentation threw me
for a loop.

-Mike Ellery

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to read data off a website into an Android app

2011-11-15 Thread mellery451

well, I think you'd want to start with an HttpClient (http://
developer.android.com/reference/android/net/http/
AndroidHttpClient.html) to make the request and download the
resource(s). Then you would need to extract the information you need
from the content. This is commonly called scraping since you are
trying to extract data from presentation views. It's hairy, and likely
to involve any number of parsers or (gads!) regular expressions to
accomplish the task. I'd avoid this route if at all possible.

If the service you are accessing actually intends for other
applications to consume it, perhaps there is already a public API
(e.g. twitter, facebook, etc. all have http APIs you can use). At the
very least, perhaps the site supports alternative formats for the
content - like xml or json. If requesting a different format is an
option, you'll have a much easier time extracting the data since you
can use a standard parser.

-Mike

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to read data off a website into an Android app

2011-11-15 Thread mellery451
well, you're not going to be able to (easily) read Excel files on
android (xls, or whatever they are called these days), but csv will
probably work - perhaps that's what you were thinking of anyhow. Have
a look at 
http://groups.google.com/group/android-developers/browse_thread/thread/cec5eb668e3293fe
for discussion about loading csv. Once you've fetched the file using
the http client, opencsv should be able to parse/load it.

-Mike

On Nov 15, 3:50 pm, Jungle Jim jjjungle...@gmail.com wrote:

 One more question: I also want to be able to put some data (perhaps in
 Excel spreadsheet format, but not restricted to that) somewhere on the
 web and have my app read that data. This way I can periodically revise
 the data that shows on the apps that my customers have installed on
 their phones.

 Any ideas on the best way to do that?

 On Nov 15, 3:44 pm, mellery451 mellery...@gmail.com wrote:







  well, I think you'd want to start with an HttpClient (http://
  developer.android.com/reference/android/net/http/
  AndroidHttpClient.html) to make the request and download the
  resource(s). Then you would need to extract the information you need
  from the content. This is commonly called scraping since you are
  trying to extract data from presentation views. It's hairy, and likely
  to involve any number of parsers or (gads!) regular expressions to
  accomplish the task. I'd avoid this route if at all possible.

  If the service you are accessing actually intends for other
  applications to consume it, perhaps there is already a public API
  (e.g. twitter, facebook, etc. all have http APIs you can use). At the
  very least, perhaps the site supports alternative formats for the
  content - like xml or json. If requesting a different format is an
  option, you'll have a much easier time extracting the data since you
  can use a standard parser.

  -Mike

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Dynamic test cases / data driven testing in android unit test

2011-11-03 Thread mellery451
I'm trying to get starting with unit testing my android application
and I'm having trouble figuring out how to do data driven testing.

For my particular case, I have a file that I'm storing as an asset and
this file has input and expected output for a particular API under
test. I can read the file and make the calls just fine. I would like
to create a test case for each item (line) in the file - this is where
I'm stuck. I have no idea how to accomplish with the classes I have in
the android framework. I'm using the InstrumentationTestCase class and
the InstrumentationTestRunner (the default) to run my tests.

I've seen some reference to a JUnit-3 pattern for doing this that
involves creating a static suite() method in your test class. The
suite() method then creates a suite and adds test cases to it at
runtime. I tried adding such a method to my test class, but it never
seems to get called. Has anyone out there successfully implemented
data driven tests in android? Any advice appreciated.

-Mike Ellery

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] How to call native (JNI) code from test application

2011-10-28 Thread mellery451
I'm building an app and I have a corresponding test application for
it. One of the first items I have added is some native code for a well-
encapsulated computation (hashing). I now want to test this native
code from my test application. I've imported the JNI wrapper class
into my InstrumentationTestCase based test class - and with that, I'm
able to compile the application. However, at runtime (running the
tests) I get an UnsatisfiedLinkError thrown when the test tries to
invoke the native method.

Does anyone know to call native code from a test app? Do I need to
somehow force the native library to be part of the test application so
that it can be loaded?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to call native (JNI) code from test application

2011-10-28 Thread mellery451

argh - you are correct. I just checked the LogCat output and I now see
that the library is in-fact being loaded, but the method call itself
is failing to resolve. Upon further inspection, it turns out I renamed
my method but forgot to rename it in the native implementation file.
Fixed that and now it's working. Thanks for your help.

-Mike

On Oct 28, 10:57 am, Studio LFP studio@gmail.com wrote:
 The static initializer of your Java wrapper should be loading the library.
 Do you have a System.loadLibrary() call in there? If you do, make sure you
 have copied the .so file into the proper location in the libs directory of
 your project.

 Steven
 Studio LFPhttp://www.studio-lfp.com







 On Friday, October 28, 2011 12:46:58 PM UTC-5, mellery451 wrote:

  I'm building an app and I have a corresponding test application for
  it. One of the first items I have added is some native code for a well-
  encapsulated computation (hashing). I now want to test this native
  code from my test application. I've imported the JNI wrapper class
  into my InstrumentationTestCase based test class - and with that, I'm
  able to compile the application. However, at runtime (running the
  tests) I get an UnsatisfiedLinkError thrown when the test tries to
  invoke the native method.

  Does anyone know to call native code from a test app? Do I need to
  somehow force the native library to be part of the test application so
  that it can be loaded?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: how to transfer file from android device to another android device using WIFI

2011-10-20 Thread mellery451

On Oct 20, 5:46 am, Kristopher Micinski krismicin...@gmail.com
wrote:


 (It seems like people ask about this a lot, maybe somebody could make
 money off of creating a web service and then charging a modest
 licensing fee?)



I think bump (http://bu.mp/) provides this. There are probably other
options as well.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: I want to know how can I make the cell take input from the soft keypad ?

2011-10-13 Thread mellery451
hmm - seems like you might want to just add a TableLayout (http://
developer.android.com/guide/topics/ui/layout-objects.html#tablelayout)
to your main view at runtime and then create EditText controls in each
TableRow. Of course, if your layout can be static (fixed number of
rows/cols), then you can just do all this in the layout XML file.

-Mike

On Oct 13, 10:01 am, sunny ash.b...@gmail.com wrote:
 Hi,

 I am a newbie to Android development.

 I have created a grid of rows x columns by creating a class which
 extends a View and then painting the grid lines on the canvas. Then I
 was able to pop up the soft keypad when a user touches any cell on the
 grid.

 1) I want to know how can I make the cell take input from the
 displayed soft keypad. eg :- I type 'A' on the soft keypad, then the
 alphabet 'A' should be shown in the selected cell. I am unable to
 achieve this.

 2) How can I achieve horizontal fling on the grid so that I can scroll
 horizontally ?

 Thanks,

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Help Understanding Security Exception

2011-09-09 Thread mellery451
I'm seeking some help in understanding the possible reasons of the
following error :

 Caused by: java.lang.SecurityException
 at android.os.BinderProxy.transact(Native Method)
 at
android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:
146)
 at android.os.ServiceManager.addService(ServiceManager.java:72)
 at android.net.vpn.VpnManager.startVpnService(VpnManager.java:
102)

I'm getting and exception in my code when I try to start the VPN
service on a 3.2 tablet device. Oddly, I don't get this error on a 2.2
device. Is this indicative of insufficient permissions for my
application? Or perhaps some other system level restriction on
starting the VPN service?

Advice appreciated.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Help Understanding Security Exception

2011-09-09 Thread mellery451
Hello,

I'm looking for some advice understanding the cause of the following
exception in my app:

Caused by: java.lang.SecurityException
 at android.os.BinderProxy.transact(Native Method)
 at
android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:
146)
 at android.os.ServiceManager.addService(ServiceManager.java:72)
 at android.net.vpn.VpnManager.startVpnService(VpnManager.java:
102)

This is happening on a 3.2 tablet when I attempt to start the VPN
service, whereas the same code/app runs fine on a 2.2 device (phone).
What is the root cause of such an exception? Does anyone know if 3.x
has added restrictions to prevent apps from starting the VPN system
service? Advice appreciated.

-Mike Ellery

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: ADB could see Samsung Galaxy Tab 10.1 but now it can't!

2011-09-09 Thread mellery451

I have often had to restart the adb daemon on my ubuntu box with root
privs. - so often, in fact, that I have a little shell script with the
following commands:

/opt/android/android-sdk-linux_86/platform-tools/adb kill-server
/opt/android/android-sdk-linux_86/platform-tools/adb start-server

...which I run as root. If the adb server was started with a user
other than root (often happens under eclipse, for instance), then you
will typically not be able to connect to the device. Maybe give those
commands a shot if/when this happens again.

-Mike

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: can you switch screen orientation via an app?

2011-09-09 Thread mellery451

On Sep 8, 1:42 pm, Jim Graham spooky1...@gmail.com wrote:


 Does anyone know if this is possible?  And if so, can you point me to
 the right terms to search for in the dev guide?  I've only got a few
 days to write this before I have to go into the hospital for cancer
 surgery, and I'd like to have it working before then


well, there appears to be a manifest permission for that:

http://developer.android.com/reference/android/Manifest.permission.html#SET_ORIENTATION

I'm not sure how to take advantage of this in the code, however.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en