how to execute touch/click in various apps - java

I'm new to Android, but not new to Java, and want for a small project run and click automatically some apps and click around in them.
I don't want to use some screen recording apps, but I'm looking for the method how they emulate touching.
Suddenly I couldn't find anything that sounds right through google, but I may be wrong. Just as a note, my device is already rooted, it is a device just for testing :)

Related

libGDX as a "launcher" app

I have made a light weight java web-server serving html files and static content (made with pure java library nanohttpd), i have successfully made a javaFX launcher window that has a single button, clicking button simply runs the server in the background and opens the localhost URL in Android/PC browser (I was unsuccessful in making an IOS version using javaFX)
I am thinking of using libGDX as "launcher window" because of IOS support and access to mobile specific hardware like SMS/GPS which javaFX don't have.
I am targeting IOS/Android/PC, I'd like to ask libGDX developers how possible is this given my target platforms?
Yes you can
There's a catch though, you may have to build the UI the game dev way
I've made a game or two using it and had rather steep learning curve in the beginning to get a hold on to how it worked. For example you'll have to provide the images for button, background and also, the pressed view of the button... like that. But your app is not a game. So you won't have to worry that much.
Once you learned how to place them in the screen successfully, there is not much to worry about because the API provides everything you need to carry on from there.
Also I found enough resources/tutorials online enough to make a game from ground up. So you'll definitely can.
And there's very little to worry about your multi-platform problem.

Android / Java: Show GUI on "off-screen" (Always-On Display...)

I saw new Android devices coming out, that show things (clock etc.) once the display "turns off". That feature is called an Always-On Display, and since my Samsung Galaxy S6 edge already features an AMOLED screen, and a night-clock, I believe there is a way, to make it show something, when the display is "turned off". Is there a way using Java on Android, to display something, once display is meant to turn off? (Like just a normal GUI, I could do the rest then.)
Like, to tell your app, to show something, when the screen turns off, that is still visible somehow? (without root permissions)
That would be useful, thanks in advance.
UPDATE:
I found some apps on the Google Play Store, which seem do to, what I want (not that specialized though):
https://play.google.com/store/apps/details?id=com.thsoft.glance&hl=de
https://play.google.com/store/apps/details?id=com.orthur.always_on_display&hl=de
So it is definetely possible, I just need to know, how.
If you are not using root, then you can only use the Android APIs. Here is a list for example for the display: http://developer.android.com/reference/android/view/Display.html
I don't see anything there for the Ambient Display mode or Always-On.
Samsung provides APIs also for the features of it's phones here: http://developer.samsung.com/galaxy Here I can find the Look API that has something close to what you want, but for Edge.

Java ME on Siemens CX70

I have very old Siemens CX70 in working state and just don't want to throw it out. My idea is to use its math power and peripherals (GSM module, USB, Camera and screen) to build some simple applications for home use (multichannel termometer, timer and cheap security system - for examples).
I know I should use Java ME and IDE (I love Netbeans, for example). Can you tell me what I need more to start developing? I know Java well, I just need to make an environment to developing, debug and deploy. Mobile library documentation will be very helpful too.
Thanks.
There are so many online tutorials about this topic that the only right thing to do is to refer you to google.com
Search after "getting started with j2me".
However, there's something else you should know upfront before getting too excited.
The security model in JavaME will prevent you from doing much useful stuff, in relation to some of the things you mention.
Every time you try to access certain things in the phone, like e.g. the camera, or send SMS, or read/write a file on SD card, etc etc - the phone will show a popup "This app is trying to access camera. Allow this?". And the app will only continue after a manual click on Yes.
As you can imagine, this of course renders a lot of ideas useless.
In order to prevent these popups, you can sign your app with a certificate you buy from Thawte or Verisign. But as that'll cost you $300 a year, it's not the way most sparetime hobby developers chooses.
Personally, I found another way, but it requires you to use a phone from Sony Ericsson.
Because the old Sony Ericsson phones can be patched in order to remove the Java security. After doing this on one of my old phones, I've been having fun making apps like the ones you mention. For example, an app that keeps an eye on my home when we're out, by taking a picture every second. If it detects a difference in the picture, it sends me an MMS with the picture. :-)
I have searched a long time for patching options for other brands, but I just can't find anything useful. Nokia should supposedly also be patchable, but I just can't find anything useful about it.
So in short: If you'd like to make some sparetime hobby apps on a phone like that, you should either find a Sony Ericsson phone and patch it - or go dig up an old used Android device.
Good luck.

Developing a Java app that runs both on the web and as an Android app?

I'm working on a game which would work both on the web, as an applet, and on the Android phone, as an app.
Is that possible to do, and if so, what do I need to be aware of to make that work (i.e if there are any settings that I shouldn't hard code and instead determine them based on the user's device when the game is run, or any java libraries that I shouldn't use?).
Also, the game needs to accept touchscreen as input for the Android app. Is that possible to build into the same game which will also be run as an applet? May be so at run time, the applet decides whether to use Mouse or Touchscreen for the input when it is run?
Although Android apps are written in Java, the framework around the app is extremely different of the framework wrapped around an applet. You won't be able to have one .jar file that you can include as an applet and throw at an Android device because that's just not how it works.
You will however probably be able to create all the game logic and objects and have them in be shared with the applet code and android app. You can probably even get away with having them in one repository and project (although it's probably going to have to be an Android project that you then wedge in your app build scripts).
In order to tackle the different controls for your game you are probably going to have to abstract away the input, and have your game/level object have a call back like userHasPoked(int x, int y) and then have the applet call that method on click of the mouse and the android app calls it on touch (which is oddly still called onClick).
I think it'll be a long road, but much easier than rewriting the whole thing. It'll probably seem like a lot more work up front, but once you are done wedging your code into an applet and an Android app, you'll probably "never" have to touch that code again and can just keep adding to the game.
I wouldn't underestimate the task, but that sounds like a very fun programming exercise. Good luck!
What kind of game do you develop? It may be the better approach to develop an Javascript game.
That can be installed with phonegap (cordova) onto an android device.
Let me break this for you....
Model - The Business Logic and Data
View - The Display of the Output of the Model
Controller - On which the action is done.
The advantage of using this MVC architecture is that, you can keep the same model and keep changing the Views.
So keeping this idea in mind, you can have the same model for both the Web App and the Android App, and then implement each others Views to it respectively.

Start video chat without user interaction - Android

I am a total noob on this site so please be patient. I am trying to initiate a Video Chat/Call without any user interaction or confirmation.
I found this:
Uri imUri = new Uri.Builder().scheme("xmpp").authority("gtalk").query("call;type=video").appendPath(email).build();
Intent IM = new Intent(Intent.ACTION_SENDTO);
IM.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
IM.setData(imUri);
startActivity(IM);
from here: https://stackoverflow.com/a/8024626/1184256
This gets me very close, but I then have to click an "Invite" button to continue. Is there a way I can emulate a KeyEvent to click this button or skip the popup window entirely with root access?
I don't even necessarily need to use Google Video Chat if someone has found a different way to initiate a Video call to a certain contact via Skype, Vtok,Fringe, ooVoo or whatever without user interaction.
I have also found OpenTok which after building a sample server and client on my site I have found that it works on desktop browsers but not in Android browsers. Please don't steal/use my apiKey or sessionId.
I have also found libjingle which will allow me to use Google Talk's peer-to-peer voice and video chat. I am thinking this will be the way to go, but it means building a video chat app from the ground up and wrapping it around these libraries... yeah. Anybody done this already?
I know this is essentially a duplicate thread, but I have searched for days and days for an answer and this is the closest I have come to getting this done.
BTW the reason I need this without user interaction is for a Telepresence robot, thus there won't be anybody actually holding/using the phone when I initiate this call.
Please HELP!
You'd have to actually change the built in android app (Talk?) that receives this intent to automatically accept these types of intents. There's no way to do it from a standalone app for security reasons.
I don't think that live video streaming will work natively in Android Browsers, since they dont support WebRTC (Yet) and do not support flash. With that said, OpenTok has an Android SDK in beta that lets you stream live video from android phone to browser, another android phone, or even an iOS phone as long as everyone is connected to the same session. Like you said, this does not work over the browser and you would have to build a native app.

Categories