I'm implementing a screenshot feature for Android 2.3 (I know that ICS has a screenshot feature already). I'm using the Android Screenshot Library (ASL for short) project as a base, and I'm modifying it to suit my needs. I can also freely modify Android's source code for it. The goal is to have something like what the Galaxy Note does: you take a screenshot with a key press combo and then an editor shows up which allows you to change the image however you like. You could take a screenshot anywhere: on the main screen, while using apps, etc.
Right now I have 3 working parts: a native binary that captures the screen buffer, a service that talks to the native binary and retrieves the screenshot, and the editor. But I'm not sure how I could join the 3 things together. The native binary can be added to the Android prebuilt part and init.rc can be modified to execute it as root when booting (I still have to do this though). The editor is a simple app that can be included in Android as well. But I still can't figure out what to do with the service.
Ideally I'd like to capture a key press combo (say power button and volume down, or maybe two of the front buttons), which would trigger the service. The service would then call the binary to take a screenshot and launch an intent to open the editor with the screenshot. However, as far as I know a service cannot catch key presses. Besides, the service has to be bound somewhere in order to know when it has to take a screenshot, so I guess that I should modify Android itself to start the service and bind to it at startup, but the documentation regarding Android source code is lacking and I have no clue where to start looking.
Does anyone know what component of Android is in charge of the key presses, and where I should bind my service? Is my approach even possible at all?
Thank you in advance for any possible help.
Take a look here. It suggest using the camera button, which is certainly better than overloading other system buttons.
Related
Hello Android developers,
Im more or less expierenced in Android programming and now i want to create an app that is allowed to access the display of another app or the activity that is less my app. Both apps should be active, should run. My app shall access the display data of the other app (also can be android system display), change it a bit and then show it again.
Is it possible without root rights?
Is there any Android support class that could help me? Which way i can go?
I hope my problem is clear and you can help me!
Ok now I have a more detailed question: How can open my app and show a transparent RelativeLayout, so that you can see what is below my app?
Thankyou a lot
Martin
If both applications are yours, you can access the other Activity using a connection between them (sockets, pipes, shared files, etc.)
If you'd like to create an overlay and display something on top of the other app, you can do that using a 'system window' popup. For example: Popup window in any app
If the other app is an arbitrary software without any modifications, such thing is not possible as it would lead to security issues. Both applications are Unix processes running in their own sandboxes without any direct communication.
Hello guys (and girls),
I need your help in the matter of how to structure things in an Android app that I'm developing.
So far I have:
a Login activity that shows up right after the app is started
a Main activity that display some options for the user. Among them there is an option to start the device's camera (user taps on an icon that should launch the Camera), take a picture, crop it / rotate it and upload it to a remote server
Now, my question is: how should I organize things in my app logic so that everything will be clear and easy to manage in the future, for the upcoming versions?
I'm thinking like this but I'm not sure if it is the right way:
create a separate activity (eg. PictureCaptureActivity) for the picture capture task
create a separate activity (eg. PictureProcessActivity) for the picture processing tasks (crop and / or rotate - these options will be available via some buttons displayed on screen, in the main menu bar)
create a separate activity (eg. PictureUploadActivity) for the picture upload tasks
Or should I include all these functionality in my MainActivity somehow? Or... ?
Thank you in advance for your guidelines!
Before i start referring you to well written documentation and examples i have one main point i would like to emphasis and convey.
You are referring to Activities where modern Android applications are compartmentalized by Fragments (not that modern, almost 3 years) and the point of that being that the same application can work by utilizing almost 100% of the code on all Android* devices and form factors (mobile, tablet, TV, wear, auto etc.).
Now lets talk business, the best place to start reading on regarding Android is Google:
Design/patterns/application structure - from the android.developers.com documentation site.
Application quality checklist - created by Google following hundreds of case studies and a meticulously planned UX test.
Design guidelines - updated just 2 days ago (16.4.15).
IOSched - Google's display window for Android code where they show how they think an Application should look, feel and behave.
After that i would love to link you to a code lab i co-wrote with a couple of friends and a few blog posts i have written as a follow-up:
AndConLab
My tech blog on Android
Goodluck.
PictureCaptureActivity
Do you want to have a custom interface for taking pictures with the camera, or use an existing application on the phone?
Yes - You will need a PictureCaptureActivity and will have to implement the camera functionality yourself.
No - You can use an Intent to get the user to take a picture using another application and return it to you.
Either way, you will need to look at the Camera documentation.
PictureProcessActivity
You will most likely need to have a PictureProcessActivity to process the pictures in the manner you want.
PictureUploadActivity
The PictureUploadActivity is not really necessary. You could use a Progress Dialog or Progress Bar to show the progress in the PictureProcessActivity.
MainActivity
In my opinion you need at least two activities:
MainActivity / PictureCaptureActivity to take a photo
PictureProcessActivity to process the photo
You could fit it all into one activity by hiding and showing icons in the Action Bar, but I'd rather not because the Activity Documentation states:
An activity is a single, focused thing that the user can do.
Disclaimer: There is no 100% correct way to do this.
I've found this to be very helpful when it comes to code keeping: https://google-styleguide.googlecode.com/svn/trunk/javaguide.html
The one thing I can't stress enough: comment your code
Following the simple instructions for the qr-zbar, I have successfully implemented a native barcode scanner! It works great so far.
qr-zbar-ane Github: https://github.com/saumitrabhave/qr-zbar-ane
Unfortunately, while actively scanning, if the home button is pressed or another activity takes over, upon coming back to the original application the activity is stuck and will not initialize the bar code scanner anytime after that.
I have tried multiple ways of reloading and switching views in the air application to call a new instance of the qr-zbar.
Resetting:
scanner.removeEventListener(ScannerEvent.SCAN, onScan);
scanner.stop();
scanner.reset();
scanner = null;
Creating again:
scanner = new Scanner();
scanner.setTargetArea(targetArea,"0xF53100","0x4BFF33");
scanner.setConfig(Symbology.ALL,Config.ENABLE,1);
scanner.addEventListener(ScannerEvent.SCAN, onScan,false, 0, true);
scanner.launch(true, "back");
loadGroup.visible = false;
trace("Launched: " + ServerRequest.scanner.launched);
Here is the Issue described in the commit notes! Exact problem.
https://github.com/saumitrabhave/qr-zbar-ane/blob/master/NativeAndroid/src/com/sbhave/nativeExtension/ui/CameraActivity.java
Update: I found that this is the case for a newer update to android. Downloading a keylogger for Galaxy S4 and Nexus 5, I'm unable to see the KeyEvent for a home button press.
Firstly apologies for such a long response time. Here is a point-wise update which will also answer your question (hopefully).
The reason you see the code in repository but still issue not being fixed, its because I did not update the .ane which includes this fix. So, if you want to get it running with current APIs, you may need to checkout the project(at the last commit with old API) and re-compile/re-generate the ane on your end. I know, it doesnt sound interesting, read the next point for a good news (maybe).
As you might have seen already the old model wasn't flexible enough, As it spawns its own Activity, Actionscript developer did not have any control over the UI in scanning mode. Hence I have re-designed the whole API in which the Scanner acts similar to a StageWebView(i.e. placed on top of the stage at given position and with given size so that you can have your own UI around it, with the limitation that you can not draw ON THE scanner).
2.1 It also removes the notion of SingleScan or MultiScan and gives the developer flexibility to implement his own nature of scanning using APIs like pause(), resume(), attach and detach scanner while camera preview is in progress etc.
2.2 It will also have other features like Scanning from a given Bitmap instead of Live Camera feed.
Any of the option above should fix your issue,
I would like to get suggessions/feedbacks/bugs as I am in the implementation phase,I can quickly resolve any valid use-cases you may have around the library.
I am relatively new to android and want to create an application that permanently overrides androids basic softkey behaviour and view (for devices with soft keys).
Some functionalities I want to implement are changing the size of the softkeys window at the bottom, change its images, and possibly change its functionality.
For example, the user can set the size to of the softkey to be "large", "medium" or "small". And I can change the functionality of the back button to open say a particular application instead of going "back".
I'm basically looking for a high level answer as to how to do this, a basic direction of what I should read/study in order to be able to accomplish this. I realise this may require root access.
Please note that I want this behaviour to change not only in my application but I want the effect to exist on all applications. If this requires the application to be running atleast at the backend, that is fine.
After doing some decent amount of search, it seems I will have to make changes in the systemUI.apk, or possibly get its source code and modify it. Is this correct?
Thanks in advance.
I don't think even root is going to be enough for the type of changes you are describing. You're going to need to edit the Android source code and build your own system image.
Well you can't override system resources because they are part of the system image.
What you are looking for is called Home Application which can be developed like any other android app no need for root , you can find an example for it in your sdk samples.
Home Sample Application.
your app would be responsible to have UI components to send the user to all of the phone functionalities which includes:
Place for wegits
Place for apps listing (menue)
Access telephony functionality (call, phone history ...)
Access settings.
I need a way to show off concept designs of an android application on an android phone to simulate that it is running. Basically just being able to tap to advance to the next photo/screen would be sufficient with a tap ANYWHERE on the screen. Any tools you know that would be helpful?
Eclipse with Android toolkit.
Write a small program. wont take up much time.
[update]
No coding is required. Create an android project Using Eclipse android project, you can visually create UI prototype (i.e. drag and drop .. no coding). Use main.xml after developing each screen run the project in emulator, you can take screenshot of the same (either using eclipse DDMS plugin's snapshot capability or using Alt+Print screen in windows or something similar in other OS). Use this screenshot in a powerpoint presetation . Repeat the same process for a second screen (overwrite the same main.xml so that you dont have to write code). take screenshot again. Add the required animations in powerpoint.
Is there any other option that does not involve any code?
The easiest way I can think of is:
1. Take screen shots(wireframes, screen prototypes) for every screen flow you wish to demonstrate.
2. add them in proper sequence(regulated by sequence number) to your sdcard.
3. Open Picture gallery and use swipe gesture to transition and cycle between screen, walk through all the screen flows.
Do it photoshop, create images, add it to an activity. Create a layout that fills the parent, add it as a background. Then implement a ontouch method to finish the activity and load the next. Quite simple.