Writing Global Overlay Help - Java for Android App Development

So the end goal in this project is to view an RTMP stream and interact with the server at the same time.
This is a little hard, because obviously VLC or Mx Player or whatever I'm viewing the RTMP stream with doesn't know how to communicate with the custom server. So I'm trying to make an overlay that will sit on top of the player which has buttons, the buttons can then communicate with the server which will alter the stream and you'll see the result streamed to the player. This is sort of like an interactive HUD if you will.
Problem is that it's difficult to make an overlay which will take actions if they're clicked, but can also pass those actions to the background app (in this case the player) if it opts not to process them. Right now my app creates a service and the service catches the input and displays whatever. This WORKS, but the problem is no matter what I return from "onTouchEvent(MotionEvent)" in the view of the service (true or false) the home screen is frozen. It catches the press but it won't pass it on, even if the function returns "false" - to say it's not handled.
I'm not sure if I'm not passing the touch event on correctly, or is this not even possible? I read somewhere that it's not possible for app A to provide input to app B, but I'm not sure if that is correct (frankly I don't believe it). Basically I want to handle some presses in the overlay and allow some others to go to the active app beneath it.
Does anybody have any input for making this work as expected? I'm creating a view to pass to the window manager with the following flags:
Code:
LayoutParams params = new LayoutParams(LayoutParams.TYPE_SYSTEM_ALERT,
LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT);
I've tried playing with the flags but to no avail, I cannot get the touches to go through, even if all the onTouchEvent(MotionEvent) function does is return false.
Anybody have any ideas?
I'd be open to alternative implementation ideas too, the point is I need to basically have two communication channels open, one is a player (ie. VLC) for viewing the RTMP stream, which likely would not change, the other would be the command stream, which will control said server, which I am open to change. I considered trying to use the accelerometer in the service instead of an overlay, but I think that would create a bad proof of concept UI (because there's some latency in the video stream), any alternative ways to communicate with the server would be up for discussion! Maybe I can plug an IO device into the USB port or something, like a keyboard? Extra buttons could be of use. It's only a POC, so some clunkyness IS okay.
EDIT:
As you can see above, I used an alert type instead of an overlay type, I guess this is because overlays won't accept focus after a certain Android version number. I'm using 4.0.4 ICS.

Related

Shortcut to Execute commands on Computer

There are all of these app's out there that allow you to control your computer from your phone (using VNC and others). This is all well and good....but there are no shortcuts to do anything on these apps. Whatever you are trying to do on your computer takes way too many screens/clicks to be truly efficient by using your phone. You most certainly are able to do it with your phone.....but hell...it was way more complicated than it had to be.
**DOES BELOW APP EXIST?**
I would LOVE to just touch a shortcut on my home screen that would send a couple of keystrokes to my computer. Or telling my computer to open a particular program from a shortcut created on my android phones Home screen. This would be amazing. I could tell my computer to run whatever task from my phone QUICKLY...without having to jump hoops through screenshots/mouseclicks/keyboard on VNC app's......
Using this, you would no longer need all these separate video/music player control apps...you could just wire hotkeys/scripts to be run to control ANYTHING. I could send a keystroke to minimize/maximize a window....pause iTunes....Give a song 3 star rating....open a particular site...
I'm just trying to turn my phone into a much better remote for my computer.....all current apps seem to fail horribly.
Hi,
I was looking for the same thing and came a cross a neat application to run on computer, AutoHotKey ( http://www.autohotkey.com/ ). Then I use MultiRemote to send keystrokes (like a hotkey, CTRL+P), programmed as one button in that program. Then on the computer side I have a script that knows what to do when that button is pushed Really powerful application with tons of features to program in the scripts...
BR
jmelhus

Help making android application into service

Hey guys, I'm fairly new to android applications. I am specifically working on an android application that runs for the Notion Ink Adam. A guy by the name of Mr.Guy actually wrote the app nearly perfectly and provided the source to me but there is a small issue I want to work out, hopefully with some help.
Basically the app runs from a search button long press, runs a native linux command (which toggles the backlight on and off) and closes.
The problem with the current application is that if you have somethings open in a current window they are closed by this application running. An example is opening the app drawer on the homescreen. Running the application closes the app drawer. In some cases th interruption makes a greater difference like when viewing media.
Anyway heres the source, ftp://eto.homeip.net/Shared/NotionInkHacks/PQiToggle.zip
I think I need the application to run a service instead of an activity but this didn't seem to matter. I'm pritty sure I need it to not call a UI and just run the service.
An ideal fix for this is to skip the application and just rely on keycodes run from init.rc but trying to do this I had zero success. I'm not sure if the version of init in my rom supports keycodes.
If you could help me either with making it a service or allowing a native linux command run from keycodes I would greatly appreciate it. Thanks!!!
You can call a service directly from a broadcast receiver which can listen for the "on search long press" intent
http://developer.android.com/guide/topics/fundamentals.html#ActivatingComponents
http://developer.android.com/reference/android/content/BroadcastReceiver.html

[APP][CONCEPT][WIP] WiMi - Basic Wireless Mirroring

WiMi
Basic Wireless Mirroring for Android​
Intro
There have been times when it would have been useful to output an email, website and other file on my phone to a public monitor or display. There have been various ways of doing this over the years, the TV Out function on the old Touch Pro devices, DLNA streaming, and HDMI ports. But, so far I have not found a way to directly replicate the screen, (mirroring) without the use of wires.
I have seen many threads from people who have asked this same question, and each time they have been told it's not possible, for various reasons. This project is to explore ways in which, however crudely to begin with, we can make this happen, and I have written a short brief below of why I believe it may now be possible. I am asking for help from anybody who thinks this may be achievable, or has something to offer that may help us in any way.
Theory
To create basic DLNA mirroring of your Android device for low frame-rate applications such as mail, browsing, and others. It is important to realize that it is highly unlikely to be able to create full DLNA mirroring for applications such as games using the proposed method, but who knows what can happen?
The basic mechanism would be to take continuous screen captures, between 1 and 30 per second, compress the screen captures into a suitable file format that can then be transmitted via DLNA.
I believe this should be possible - I have read that the new Sensation Camera App can record natively in MP4, in HD, in real time, which is fantastic, because as I understand it, MP4 works perfectly with DLNA. I have also noticed that in recent versions of Android, (I think FoYo+) there are parameters for ScreenCapture.
There may be a large lag using this method, but it is a start, and for showing a web page, text conversation, book, or text message, wirelessly on another display, it shouldn't be too much of a problem.
From what I understand, not all Kernels would be able to do this but I am unsure, so if anybody has any theories, let me know!
Suggested Basic Features
These are features that I think should be included as standard
1) Be able to predefine video bit-rate and frame rate via user controlled variable integers.
2) View the temp folder
3) Disable auto-orientation settings to prevent screen tearing.
Suggested Advanced Features
These suggested features are a kind of wish-list once we can get a basic app running well enough.
1) Direct camera monitoring - sending the image directly from the camera to the external display. (Probably resulting in BIG lag!)
2) Custom external screen resolution, possibly by upscaling to 720/1080 equivalent via screen density.
3) Ability to kill screen backlight, but keep capacitive control for scrolling web pages etc.
4) Output file to SD card for archiving.
5) Switch audio between device and external screen.
6) A "Start / Stop" widget.
7) Enable notification bar settings access.
If you want this concept to work, think you can help in any way, have an opinion or have anything to contribute at all, get involved!
News
I have made a blank app with the essential UI components.
IT DOES NOT HAVE ANY FUNCTIONALITY YET, IT IS JUST A DUMMY!!!!!!
Download it HERE and tell me what you think so far.
If anybody thinks they can help with the core of the app, please get in touch!
I love the idea
Sent from my HTC Vision using XDA App
Same here.

[Q] Nook Simple Touch disable screensaver & full screen browser

Hi,
First of all, thanks for great set of resources! I was rooted an up and running with market in no time.
I am planning to use the Nook as a home automation controller, where the interface is presented through a webpage. For that, I am going to have it mounted and constantly powered-up.
So, my question is - how can I disable screensaver to have the Nook show the browser 24/7?
Also, is there any simple way to show contexts of the browser window without the navigation buttons? (If not, no worries - I can put something together quickly in PhoneGap or similar).
Thanks!
Bumping for interest - has OP/anyone found a solution to this? I'm going to have a tinker with the sys files in the next few days to see if I can manipulate those, will post any positive results.
I'm looking for always-on functionality as part of a live bus timetable / weather station project I'm 75% through.
For those interested, I'm running a simple PHP server pulling data from London's TFL API and the UK MetOffice's Datapoint API and displaying the page in Dolphin.
julianfox said:
Bumping for interest - has OP/anyone found a solution to this? I'm going to have a tinker with the sys files in the next few days to see if I can manipulate those, will post any positive results.
I'm looking for always-on functionality as part of a live bus timetable / weather station project I'm 75% through.
For those interested, I'm running a simple PHP server pulling data from London's TFL API and the UK MetOffice's Datapoint API and displaying the page in Dolphin.
Click to expand...
Click to collapse
http://forum.xda-developers.com/showthread.php?p=29113425 (found by googling "nook screensaver disable sqlite3").
julianfox said:
Bumping for interest - has OP/anyone found a solution to this? I'm going to have a tinker with the sys files in the next few days to see if I can manipulate those, will post any positive results.
I'm looking for always-on functionality as part of a live bus timetable / weather station project I'm 75% through.
For those interested, I'm running a simple PHP server pulling data from London's TFL API and the UK MetOffice's Datapoint API and displaying the page in Dolphin.
Click to expand...
Click to collapse
Hi, I am quite interested in your project and was wondering how you got on with this.
Basically I am looking to have a calendar + weather page up constantly on in my rooted Nook Simple Touch. I have managed to get rid of the screensaver but it still goes into sleep mode after a while. Also would like to get some direction on how I could do my own PHP based page because most of the calendar apps out there dont seem to report weather
Jayyzee said:
Hi, I am quite interested in your project and was wondering how you got on with this.
Basically I am looking to have a calendar + weather page up constantly on in my rooted Nook Simple Touch. I have managed to get rid of the screensaver but it still goes into sleep mode after a while. Also would like to get some direction on how I could do my own PHP based page because most of the calendar apps out there dont seem to report weather
Click to expand...
Click to collapse
I implemented the server side part of this weather app
http://www.mpetroff.net/archives/2012/09/14/kindle-weather-display/
also made the following changes
http://www.shatteredhaven.com/2012/11/1347365-kindle-weather-display.html
Getting the image on the nook is a different story. I tried using crond to wget or curl the image from the server to the screensaver folder so I could have other info graphics rotated throughout the day. I was unable to get the image via wget and unable to get cron working. Any suggestions... (besides having a browser open 247)
here is another example
http://origami.phys.rpi.edu/~jimenc/public/pjs/weather_kindle/server2/weather.php
Refresh?
larryflynt said:
Getting the image on the nook is a different story. I tried using crond to wget or curl the image from the server to the screensaver folder so I could have other info graphics rotated throughout the day. I was unable to get the image via wget and unable to get cron working. Any suggestions... (besides having a browser open 247)
Click to expand...
Click to collapse
Hi, kudos for the progress so far.
I take it you couldn't just use another device to FTP the file to the nook every so often?
I was hoping to do a very similar thing with my spare NST but unfortunately my coding skills are not up to that level. You mention that you were trying to populate the screensaver folder with the image to be displayed, would there be any way to automatically make the NST wake up every few hours to refresh this image (assuming you can get the image there in the first place)?
I think that the better way to do this all is to write an app.
The app could use either an ImageView or a WebView.
You could easily make this work directly without a proxy or a server.
You wouldn't have to play around with screen timeout/wakeup,
This is going to be hard wired powered?
Renate NST said:
I think that the better way to do this all is to write an app.
The app could use either an ImageView or a WebView.
You could easily make this work directly without a proxy or a server.
You wouldn't have to play around with screen timeout/wakeup,
This is going to be hard wired powered?
Click to expand...
Click to collapse
The more I think about this, the nook simple touch might have to be charging.
I've done something very similar with my nook showing a custom weather listing in a fullscreen Dolphin browser. Though I have a problem with it not running for more than a day or so before the browser stops refreshing anymore. Have you experienced this? I'm currently looking into some way to kill/restart the browser on schedule perhaps.
Also, how did you get the browser in landscape mode? I can't find that anywhere.
neonpolaris said:
Also, how did you get the browser in landscape mode? I can't find that anywhere.
Click to expand...
Click to collapse
I use this to set the orientation: https://play.google.com/store/apps/details?id=com.mah.screenrotationlock
OB
Sent from my HTCEVOV4G using Tapatalk 2
Another way to set orientation is if you have an application that only does landscape.
Switch to the landscape app, home out of that, go to the application that does both.
It should stay in landscape mode.
I have an assortment of apps, some portrait only, some landscape only, some both orientations.
By jumping briefly to a landscape only or portrait only app you can set the orientation for subsequent apps.
Thanks for the help guys!
I've got a web server running on my NAS serving a custom page for me. The browser launches fullscreen on boot up via some auto start app. After 5 min, the page redirects to an all black page for a second, then an all white page for a second (to clean up the display), then back to the original page with any new information on it.
This works well except for two issues.
1. On boot up, there's no way to avoid the first lock screen. After unlocked, it doesn't come back, but it's always there on startup. This wouldn't really be an issue except...
2. The browser stops loading the page after a while. I can hit refresh and it goes through the motions, but the page isn't updated. It can take a couple of days for this to happen. Restarting the nook solves this. I confirmed that the page is still served normally to other devices (not a web server problem). I would just have the device auto restart at 3am or something, but then the lock screen would always be there.
Do you guys have any ideas about how to correct this or at least work around it?
I can't even try other browsers because this is the only one I've found that displays full screen.
Any updates on this?
I wonder if there's a way to have a cron job kill and relaunch the browser every once in a while to get past the freezing issue you'd mentioned. Or just have the cron job kill the browser every once in a while and relaunch it, pointed at a new information display page.
Even better would be if there was way to bypass the need for a web browser and interact directly with the e-ink screen buffer as can be done on rooted kindle devices. (I can't post a link, but google search "Tools Eink Framebuffer Update Trigger" to find the kindle framebuffer commands)
Yeah, I worked directly with the screen output on my kobo, which worked well, but it was more of a pain to make changes. That might be because I'm more familiar with php and css than python and screen blit-ing. Having android to work with makes it much easier to expand functionality by just downloading an app and using my fingers, instead compiling software and ssh-ing in for everything.
Speaking of which, it looks like my problem is solved. I installed tasker and set it to kill the browser at 3am and start the browser at 3:01am. Thanks all.
What about google play apps for weather? Most of the apps I have used so far have had contrast issues since they are designed for color screens. Does anybody know of good apps that display the current weather info and forcast data in an eink friendly color scheme?
As far as the going to sleep issue, the apk listed in the second comment here: http://forum.xda-developers.com/nook-touch/general/fridge-calendar-t3057759
worked without issue for me, so that problem has mostly been solved.
Try this: electricsign app
Apologies for the resurrection, but for those looking for a digital low power / e-ink info display this might just do it.
This app will do the trick if a static jpg of a web page updated at an interval will do (set to output a jpeg in the custom screensaver folder on rooted nook)
Electricsign android app: (search electricsign on the play store - I can't post a URL here yet).
Leave the WiFi on and set the screensaver timeout.
The source code is on github also (google.it ).
I can never find the app because I always think it's called electricsheep.
Hope this helps someone...or me in the future.
Hi future me, the app is called electricsign, not electricsheep. You'll thank me next time you forget. From your past self bored at a ceildh BC your gf doesn't want to dance.
electricsign looks like the ticket!

Help!! Adding TV shows and Movies to Channels

I was wondering if it was possible to add Movies and TV shows to the Nvidia shield home screen Channels? Or using a different launcher. Like Movies from Tvzion? Thanks
You can add TVzion to the home screen by using an app called "TV app repo". It will essentially make an icon shortcut that works.
If however you are wanting to add movies from within the Tvzion app in a similar way to how google music or video works and displays them on the home screen then it needs to be a supported app by google I think ( I may be wrong) Good luck with it being supported in future if it is some sort of stream......... /cough
You only have to look at how spotify was working in this way and now is not. And seems to be unofficially unsupported in this way now (due to a falling out by both parties about fairness/competition with music apps and their own service i think) You cannot have it on its own row on the homescreen by using the customize homescreen settings anymore it simply is not available just the icon to set it running.
You have to understand that TVzion displays the streams and not google, so getting it to then run TVzion from a button click on the home screen and then any individual stream that may or may not have possibly moved in the meantime also is virtually un-doable in my eyes, unless someone knows of some workaround that achieves a similar thing?
HawthorneDruid said:
You can add TVzion to the home screen by using an app called "TV app repo". It will essentially make an icon shortcut that works.
If however you are wanting to add movies from within the Tvzion app in a similar way to how google music or video works and displays them on the home screen then it needs to be a supported app by google I think ( I may be wrong) Good luck with it being supported in future if it is some sort of stream......... /cough
You only have to look at how spotify was working in this way and now is not. And seems to be unofficially unsupported in this way now (due to a falling out by both parties about fairness/competition with music apps and their own service i think) You cannot have it on its own row on the homescreen by using the customize homescreen settings anymore it simply is not available just the icon to set it running.
You have to understand that TVzion displays the streams and not google, so getting it to then run TVzion from a button click on the home screen and then any individual stream that may or may not have possibly moved in the meantime also is virtually un-doable in my eyes, unless someone knows of some workaround that achieves a similar thing?
Click to expand...
Click to collapse
Thank you for the reply. I actually messaged the DEV of the TV zion app. And he Ă© stated that he will support adding movies to the home screen. He just hasn't updated the app to be compatible with 8.0 and 9.0 Android, as of yet.

Categories

Resources