How to get Image Uri which is displayed on full screen? - java

Okay so I searched a lot but couldn't find any solution for my problem.
I am trying to develop an android application which will have some background running service. Suppose I opened Gallery and I am seeing some photo and I want my service to store that image's Uri. The problem is how to get image Uri which is being displayed on the screen. Also I want to extend it to Gallery Grid View where I can select multiple photos and ask my service to store their Uris.
I tried using reflection to get object of ViewImage.java class and invoke getCurrentUri() method. But I am getting ClassNotFoundException.
I am looking for a solution even if it requires my app to be system app, rooted device or using reflection to access android gallery code.
I want to get the Uris for Currently played videos or currently selected videos and music files along with documents like pdf, word.

The problem is how to get image Uri which is being displayed on the screen.
Fortunately, this is not possible, for blindingly obvious privacy and security reasons. The interaction between the image-viewing app and the user is between the app and the user; others cannot spy on that information, barring security flaws in the app.
I want to get the Uris for Currently played videos or currently selected videos and music files along with documents like pdf, word.
Fortunately, that too is not possible, barring security flaws.
I tried using reflection to get object of ViewImage.java class and invoke getCurrentUri() method. But I am getting ClassNotFoundException.
Other apps are running in other processes; you cannot use reflection to access them.
I am looking for a solution even if it requires my app to be system app, rooted device or using reflection to access android gallery code.
A custom ROM could probably spy on the communications enough to achieve your ends.

Related

Android security for images

I am developing an app which is a graphical book. Every week, a new chapter is being released and the app will be updated. There are basically images that are going to be shown to the user as slides. The user can subscribe and all chapters will be visible to the user (the image sources are offline and embedded inside the APK file). The images are not saved into the internal SD card (like they are not shown in the phone gallery after installing the app).
I am afraid that it is not a safe way to show the content to the users. What if someone just extracts all the images? I am thinking of the solutions below. Please give me the best option to keep my image files secured.
Obfuscating the app (I'm not sure if this works in this case. I know obfuscating helps to change the codes but I'm not sure if it helps to encrypt the images)
Using an online server and let subscribed users download the images (I think this way it might be saved inside the external storage. Anyway after the download the images must be available offline)
Should I encrypt the images by an encryption method?
Let's explore your options one by one
If you obfuscate the app, it can be deobfuscated
If you use an online server, the images will be downloaded, you can manage to store the downloaded images into the memory instead of the disk and then show directly from memory.
If you encrypt the images, you need to have some decryption method/key implemented in the app, which can be retrieved and bingo,
the user can have decrypted images.
So if downloading the images from an online service will not break your business requirement, then go ahead with that.
Remember that, in any of the cases, if one is determined to save the images, he/she can.
You may need to have multiple methods in place to make it harder for those, seeking to save it.

How to create a loopback camera through Android HAL?

1\ Regarding to Android Source Project hosted by source.android.com, Android supports multi-camera functionality. Also we have some information about how a camera driver really works in Android.
2\ As you know there is an old project called v4l2loopback that you can install and run on your Linux (it's simple if you have root access). For example you can also have fun with ffmpeg to stream a video as a dummy webcam device. (v4l2virtualdevice_android)
Qust\ What I'm really watching for is simple in logic and hard to develop. I want a solution that my Android application (that is provided as an APK) will be able to create a dummy camera and I can feed that from another source (not really important; maybe a video file). So user will be able to use original camera app, Instagram app (Live), etc ... to record the video.
I don't really know if it's necessary for device to be root or not. And if it's possible how can it be done using java or NDK?
You can do that if you replace the system camera HAL. It's quite possible if you build a custom ROM. Having root access on a known device is essentially same as having your custom ROM. But this doesn't help if your APK is installed (with root access) on a different device, even if the changes are minimal. Sure you can prepare logic that will work on many devices, but each will require separate consideration and testing.

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".

Retrieve multiple images from web source with one http request for android app

I am attempting to build an android app and in that app I have a list view, which I would like to have thumbnail images in. The images are stored on a server, and they are all in the same folder (e.g. http://myserverlocation.com/images/dining/myImage1.jpg,myImage2.jpg, etc). What I want to know, is if there is an easy way to get all the images (approx 25) using ONE http request, or connection. What I want to avoid is making 25 http requests, one for each image, to get all the thumbnails. I'm familiar with AsyncTask, and BitMap, but I haven't seen anything on this site (or the internet) that talks about getting multiple images with one call. I was hoping someone here would have an answer for me, as to whether or not this is possible. I'm open to any suggestions on how I might be able to accomplish this task, without using all the phones resources and/or memory.
Thank you!
If you are controlling the web service, I would highly recommended storing a zip file and retrieving that. I believe that Android likes to play with bzip, but that may be wrong.
Either way, I remember reading on the Android Dev site or watching a Google IO talk and they suggested to zip it before you ship it.

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