Phone gap camera - is there a more powerful option? - java

I'm looking to build a companion photo capture app for my photo capture website. I was planning to do this with phone gap.
Upon triggering the camera I want to grab a frame (a still, really) up to five times a second and send it to the server (barring any surprises, The sending part should already be dealt with in code I have). I suppose the realtime video from the camera itself should be displayed to the user as well, though I could just use the stop motion frames for that part.
Unfortunately, according to the phone gap docs, one can only launch the phone's cam app, manually take a picture, then return the user to the app.
I am looking into plugins, but I don't see any massive phonegap plugin repository out there, so I am not sure where to begin. I am just rambling now, so here is a list of bulleted questions:
Is there a plugin out there that does something like this already?
Is there a giant repository of phone gap plugins that I am too foolish to find?
If I try to roll my own java plugin (this is for an android app), what am I really getting myself into? Will I need to know enough to just make the damned thing native? I am pretty exclusively in the JS world at the moment, and am trying to get this out the door asap.
Am I missing something and there is a way to to this with vanilla phone gap?
Any other suggestions?
Thanks!

The phonegap plugins are here:
https://github.com/phonegap/phonegap-plugins

Related

How to check if images in an android app are current?

I am in the middle of writing an android app while teaching myself java all at the same time and my project is a bit cumbersome for a first time app. NOTE:
I am not a newbie to programming, I know several languages with the exception of java and writing code for mobile devices. With this all said and done, I don't want to have to force my users to have to update the app every time there is a new image.
Is there a way, I am assuming there is, to check on startup if all the images are up to date and if not download the new ones to the drawable resource folder for use in the app?
I have searched and found ways to remotely fetch items but nothing specifically for updating app images. For example: Splash Screen Image, or background image etc.
Thanks for your time and apologize if this does not conform to stackoverflow form of asking a question.
Shawn Mulligan
Based on my knowledges, there is no way to do why you're asking for. Resources are static contents and there no way to modify or update them programatically.
To achieve a kind of feature that you describe, it should be through a distant server, eventually with a local cache of your images on disc, associate to a download date.
But you won't be able to use them in the exact same way that you can use drawable resources.
Also depends of what you really mean by "if images are up to date".

Send System Wide Key-press Android

I'm trying to learn more about Android development, and I think I have hit a tough patch. Basically, I want to be able to send a "fake" key-press to the entire android system. For example, lets say I have my music player going and I want to pause the music. I should be able to send:
KeyEvent eventPause = new KeyEvent(KeyEvent.KEYCODE_MEDIA_PAUSE, KeyEvent.KEYCODE_BACK);
System wide so it will stop/pause what ever media event is playing. The problem is, I keep finding things online about an instrumentation class, and some other weird classes that I either will have trouble compiling or has been taken out of the android API.
Does anyone know a way I can do this? I have a rooted phone, so a solution that requires root is perfectly fine for me.
Thanks!

Building a music player for both android and Desktop at the same time

I'm going to build a music player working on both Android and Desktops. It won't be anything special, I'm doing it more to training myself and know more or less what problems I might encounter if I want to do a real app/program one day. Therefore, since I'm already rather decent at web technologies, I'll try to use something else: Java.
My app / program with have to
be able to read music files and play them (I'm planning on reading the files myself, meaning that I only need to be able to read "raw" sound, WAV or such)
be able to write to music files (to change tags)
be able to communicate with another instance of the program on another device that's on the same network (I want to be able to use my phone as a remote control and my pc as a remote control for my phone)
If possible, show some play/pause buttons on the screen even if it's locked (probably just on android)
And this is where I need your help: What you I do to write as little "device specific" code as possible?
It's obvious I can reuse classes used to encode/decode some music types. Finding the files, reading them, writing them, playing raw sound and connection to the network will be easy to abstract if needed.
But then there is the UI and it looks like if I don't plan carefully, I'll have to do it twice... I've seen libGDX but they kinda insist a lot on the fact it's for games...
All I need is some way to build a simple UI (a few buttons, the cover of the albums) that'd work for both the desktop and the phone.
Should I use libGDX, the "normal" libs (*WT, Swing, neither of which seem to be "compatible" with Android) or something else?
I'd also like to request as few permissions as possible. Meaning that I'd like to have a base music player that only request access to the sd card, and then features requiring additional permissions would be added as other apps/programs or addons.
From what I understood, the only way to achieve this is to create a second app and make the user install it. I think I'll manage to make the two apps communicate (with Intent?) but is it really the only solution?
Thank you in advance for your answers.
Maybe you could consider building the app with something such as Phonegap: http://phonegap.com/ This would let you use your web technologies strength and write a very slim layer of device specific code if any at all!
As for getting a phonegap app to run on the desktop....you could use something like :http://ripple.incubator.apache.org/ to have it run on the desktop. I know this is slightly different and you wanted to tackle writing something in Java - however this is the way mobile development is moving so you may want to get started like this!

Is it possible to remotely view a user's device?

I want to make an app where it allows the user to give remote access to viewing their phone (first-person view of user using the phone). Kind of like how tech support can sometimes see what you're doing on your computer to help you with problems. Think "remote desktop for phone" is what I'd like to do.
Does anyone know if this would be possible?
My current idea to do this is screen scraping - somehow take a screenshot of the user's phone (like how DDMS does) every millisecond or something. This seems terribly inefficient though, and again I don't know if it's possible.
Note - the "receiver" of this first-person phone view can be a computer or website or whatever, along as they connect remotely.
It would be possible: extremely difficult, but possible, to implement an Android activity that uses a FrameLayout and hosts another Activity. You could then fetch the image buffer of the FrameLayout as shown here and you'd then have to feed that into a video encoder and stream the output of the encoder to a remote server, but that might work.
I actually wanted to create something like that as well...
First of all, it will only work on rooted devices, since access to the "screenshot" (framebuffer) is allowed only to rooted devices.
Now as to reading events from the controlling device - that's easy... The hard part would be to generate these events on the controlled device. But I'm absolutely sure it's possible for rooted devices, as I saw some similar program for Windows which controls the connected device (can't remember its name).
Anyway, the reason I stopped thinking about this app is its complexity and the fact only Rooted devices could be controlled.
Hope this helps

Possible to 'layer' Android applications?

I know this in general is beyond the scope of SO, but I am looking for some basic yes/no info to see if it is even feasible to proceed... I am thinking about building and Android 'note-taking/annotation' app that runs 'over' other installed Android apps, such as the web browser for example.
Essentially, while the user is browsing, my app would be running in the bg as a service, and then they could activate it which would then essentially intercept user inputs and translate those on a transparent canvas over the web browser into lines, shapes, etc. The user could then take a screen-cap of their marking with the underlying web page, which would be stored to the sd card.
This is a very good idea and a great question, but sadly, I do not believe it is possible.
The way Android is designed only one Activity can have focus at a time, while a Service could run in the background, the user would not be able to interact with it. The user can only interact with the currently active Activity.
Again, love the idea, but it is sadly not supported.
You might be able to achieve this with the WindowManager service. You can then use that to call addView() with a view of type TYPE_SYSTEM_ALERT, or possibly TYPE_SYSTEM_OVERLAY (but see the notes in the documentation about taking input focus).
I haven't tried it myself, but I've seen several apps (often dictionary apps that translate whatever words you tap on) that do overlays, and they always seem to require the SYSTEM_ALERT_WINDOW permission.

Categories

Resources