Trying to use jcifs smbFile - java

This is a repeat of a question I posted last month that I still haven't resolved. I'm trying to use jcifs in an Android app to talk to my Windows computer, but the app aborts without an error message when it tries to connect to the network. I don't see a problem my code nor the network parameters, and after a month of digging the only hints I've found are the two ideas below.
Can someone verify if either of these are true:
1. The Java SMB will not work in Android. If that is true then which do I have and how do I get the Android version?
2. Putting the jcifs.jar in the libs folder will not work with jcifs. If my program compiles correctly then does that mean the jar is ok?
Trying to use SmbFileInputStream

It works with Android, I am using jcifs-1.3.17.jar
Putting it into the libs folder works for me
Make sure, that you are executing your network code not in your GUI thread. Android does not like that and your app will crash on runtime. As a workaround for now you can add the following before doing your network stuff in the GUI thread:
ThreadPolicy tp = ThreadPolicy.LAX;
StrictMode.setThreadPolicy(tp);
But I highly recommend using this only for testing purposes.

Related

How to combine a standalone application with an Android application?

How do I combine a standalone Java application with an Android application?
I have a piece of code taken from the Google quick start examples that perform a task that I can't seem to be able to combine with my activity source code.
I'm of course talking about the following Google example: Sheet API, if I just add it as a standalone class and tell Android Studio to run this application, before my Android application, then it will produce what the code is suppose to do.
If I try to copy and paste the exact code into one of my activities it will give a couple of problems. One is that it can not find my keystore, another is a threading issue which I understand, another being that it can not find the credentials (even if the file is present), the newTrustedTransport-method call will be an issue, the setDataStoreFactory-method call will be an issue, file creation even with the correct uses-permissions and so on.
What is going on in the background that would make exactly the same source code work in one instance and not the other? What do I not know about Android Studio, and how an Android project works in the background for me having these issues?
I had an idea that I could just keep this standalone application as it is and store a file with the result that this Sheet example would provide me. But, since I do not have enough experience with Android Studio I have no idea if the result will be available for the actual Android application once it was made into a release. Will it? I can't save the output file generated by the Sheet example, under the res-folder, under the app module for some reason (scope?).
With other words... Can I have a standalone application, that is tasked to run before the Android application, to gather data and it will be doing this EACH time the Android application is run on a client? I feel like it would be stupid if the IDE would present this like this would actually work but then when the application is made into a release then the standalone application will not "follow" and be part of the release...
If I could just combine the source codes, I will not be having this issue at all. No examples online, neither Github or Youtube can provide me with answers on how to do this. Many examples online provide me with source code that is either out of date or just not what I'm looking for, and I really hate Google's way of explaining things. Just look at how they give code examples under this page: Google API Client Library for Java, and not give a full example where they would fit into the a project. Maybe all I need to make everything work is to use the code under "The library runs on Android 4.0 or higher (#Beta)."

Not supported In Simulator for jar file (CodeName One)

I created an application that uses MediaRecorder, it creates a file in my application directory and records into it, it worked fine.
But later i decided to make a desktop version of it without sending it to the build server by following the instructions i found here
My app is working fine, but i don't think it does the recording, infacts it throws a null pointer exception and the file path it shows when i try to show it with a dialog is something like this file://homeaudioSample1410359700375. Which makes me know that it seems to behaving like it is running in simulator. So i decided to run the jar from the command prompt and what i got was an error: not supported in simulator. What is the solution to this as i want the app to also run on non-mobile platform, or is there no other way around this except sending it to the build server.
Media recorder isn't supported in the JavaSE port of Codename One.
You can use a native interface implementation for JavaSE support. Media is just really problematic for desktop Java...

Red5 Screensharing is not working in Ubuntu

I have ubuntu environment. I want to have a screenshare option in my webapplication. I am using red5 for that. I can stream using red5, so thus no problem with installation.
I am using screenshare application from here.
https://code.google.com/p/red5-screenshare/downloads/list
I have followed everything mentioned here
http://devsteps.blogspot.in/2012/02/red5-screenshare.html
I runned it and started screen sharing. But the problem is, its not creating any screen_share.flv file in my streams folder. And, when I access screenviewer.html via
http://localhost:5080/screenshare/screenviewer.html
its giving only blank screen.
What is the problem. Any suggestions?
Edit :
I don't know, whether its true or not. But red5-screenshare application is working with ubuntu-32 bit systems but not with 64-bit.
Now I installed 32-bit os. And, I say, partially this application is running.
But again getting few problems here.
I can able to see my screen but its giving output like this
Its may be because, I am viewing it in my computer (server and viewer is same) so, its coming like this (?).
And I have another problem also, Its not getting accessed in other systems. In other systems, I am only getting a blank screen. No console errors too. Unable to find a way to forward. Can anyone help me here.
To have an flv file created in your streams directory the client application would need to be publishing in "record" mode, it is more than likely that it is publishing "live" instead. If you need it to record, you have to change the publish call in the client source or turn on recording for all streams via the servers red5.properties file.
broadcaststream.auto.record=true
I solved it!
First problem, as I guessed its because I am viewing my own screen so mirror views are generating.
Second problem, Its because of static url declaration. Here is the modification. In screenviewer.html
var tot_url = document.URL; //url: http://192.x.x.x:5080/screenshare/screenviewer.html
var http_removed_url = tot_url.split("//")[1]; //remove http:// from original url
var ip_port = http_removed_url.split(":")[0];//filter only ip and port : 192.x.x.x:5080
var stream = getPageParameter('stream', 'screen_share');
var url = getPageParameter('url', 'rtmp://'+ip_port+'/oflaDemo');
And, it worked for me. A small bug is there, its not working in firefox. I think its different issue now.

Compiling/Building Google App Engine Java Project

Good day everyone!
I am a graduating student doing Google App Engine-Java Web Application.
My problem is I need to compile/build it so it will run upon click. I've been trying exporting it to a jar file however it outputs no main class.... problem.
I've been looking for other method but internet fails me or maybe i'm not pointing on the right track.
Here's my output whenever I'm using the command line:
its working fine when i'm using eclipse.
Any leads? Sorry if my question is quite silly.
Thanks in advance :))
Firstly you should definitely consider updating your GAE SDK as it seems the defaultZoneTL field was removed from JDK 1.6 U31. Updating the GAE SDK should avoid that problem.
If you can't do that then check http://code.google.com/p/googleappengine/issues/detail?id=6928 and try to implement one of the workarounds suggested. (Essentially launching with -Dappengine.user.timezone.impl=UTC OR -Dappengine.user.timezone=UTC)

AppEngine installation problems

I've been wanting to try using AppEngine in conjuction with my android app. My main problem is i can't seem to get the installation to work corrently, or at least that's what i'm assuming is going wrong.
I installed appengine and all the required plugins with eclipse from the instructions here http://code.google.com/eclipse/docs/appeng_android_install_setup.html But even when i just try run the test project it crashes without error (or at least nothing shows on LogCat or console) when i try and get it to send a message to the webserver and crashes about a minute after just adding a google account on the emulator. Is there any way to fix this that anyone knows of? Or perhaps another tutorial to install, it's getting to the point i'm not really sure where to go from here.

Categories