I came across a service named "TestFairy", and I am interested in some of it's features, but it's TOS does not agree with my application. So, I wanted to ask if anyone knows how one could implement the In-App recording feature used in TestFairy in an Android application without root. I have already done some Googling to no avail, and I am just starting to make Android apps, so I don't know how this can be done.
You can see what feature I am talking about at testfairy.com by clicking "Demo" at the top or watching their intro video.
Edit: It would appear that it is implemented by screenshots in rapid succession. How could I do this or (better yet) just record a video of just my application without root?
If you only want to record the video on your device, you could use the new screenrecord shell command in KitKat
https://developer.android.com/about/versions/kitkat.html#44-screen-recording
painlessDeath said:
If you only want to record the video on your device, you could use the new screenrecord shell command in KitKat
https://developer.android.com/about/versions/kitkat.html#44-screen-recording
Click to expand...
Click to collapse
Thank you for mentioning it, but this doesn't work without root or without a computer, and I am trying to support devices down to Gingerbread, not just KitKat.
Ohh, I thought you just wanted to create a video demo of your app.
To add support for recording video for your own app, you would take the root view of your app, and add the screenshots of the view periodically to a video.
Example code
Code:
// The root view you want to record.
View rootView = getWindow().getDecorView();
rootView.setDrawingCacheEnabled(true);
// Record the view in a separate thread.
new AsyncTask<View, Void, Void>() {
@Override
protected Void doInBackground(View... params) {
View source = params[0];
long time;
int fps = 30;
long frameDuration = 1000 / fps;
while (!isCancelled()) {
time = System.currentTimeMillis();
addBitmpToVideo(source.getDrawingCache(), frameDuration);
Thread.sleep(frameDuration);
}
return null;
}
}.execute(rootView);
You would have to implement addBitmpToVideo.
You could either user ffmpeg for this or if you only want ICS+ support, you could try using the hidden videoeditor API
http://stackoverflow.com/questions/14197757/android-video-editor-classes
painlessDeath said:
Ohh, I thought you just wanted to create a video demo of your app.
To add support for recording video for your own app, you would take the root view of your app, and add the screenshots of the view periodically to a video.
Example code
Code:
// The root view you want to record.
View rootView = getWindow().getDecorView();
rootView.setDrawingCacheEnabled(true);
// Record the view in a separate thread.
new AsyncTask<View, Void, Void>() {
@Override
protected Void doInBackground(View... params) {
View source = params[0];
long time;
int fps = 30;
long frameDuration = 1000 / fps;
while (!isCancelled()) {
time = System.currentTimeMillis();
addBitmpToVideo(source.getDrawingCache(), frameDuration);
Thread.sleep(frameDuration);
}
return null;
}
}.execute(rootView);
You would have to implement addBitmpToVideo.
You could either user ffmpeg for this or if you only want ICS+ support, you could try using the hidden videoeditor API
http://stackoverflow.com/questions/14197757/android-video-editor-classes
Click to expand...
Click to collapse
Thanks! I will try this out when I get the chance.
Related
Hi.
I've been researching for many days. and i am really out of ideas.
First. I am new to all this.
Okay. my project:
I have:
- 1 Activity
- 1 Widget
So. my app is the widget itself. when you click the widget, it opens up the activity, the activity consists of a + and - button and a textview. the textview is on 0. when you click on +, you add up +1 to the textview and vica versa with the -.
So, what i want, in the activitys "onPause()", i want it to save the value and transfer it to the widget, i tried to send a broadcast, but that didnt work properly (i wanted to save the value in a hidden textview, but appwidget cant read values of TextViews -.-').
Also i tried some sql stuff.. didnt work either (appwidget doesnt support?)
Tried so save as a file on sd, didnt work (appwidget doesnt support?)
I couldnt use the broadcast thing because my app is made like this:
appwidget:
public void onUpdate(Context context,AppWidgetManager mgr,int[] appWidgetIds){
SetUp(context, mgr, appWidgetIds);
}
public void SetUp(Context c, AppWidgetManager mgr, int[] appWidgetIds){
//do stuff.....
}
public void onReceive(Context context, Intent intent) {
//If i get the number here, i cant really do anything with it, because i cant really save my value anywhere?
}
Bump. no one can help ?
I tried with the intent.putextra, but wont work.
If anyone wants to help me at msn, pm me. (eventually lightly paid)
Hi
Have you figured how to do it yet? I'm having the exact same problem and I'm unable to find any kind of solution.
Thank you!
I´v published my first app on the Android Market. However I have little people in my direct suroundings who have Android Phones so hopefully there are a few people here who can help me by telling my what my application misses.
e.g. I think my app uses little battery power. So maybe anyone can confirm this to me?
becouse i am new to the forum (or .. well not new, but little posts) I can not put the link to my app here. Search on Triton Bubble Breaker on Appbrain or Market to download.
It is a bubble breaker game. Why I developed it when there are other alternatives on the market already? Because I missed the feeling I got when playing it on a old phone for the first time. Wanted to make it faster, simpler, free and maybe add some extra features (that should not be disturbing the simplicity of the game)
(when you are a coder.. I have (maybe a simple) question. When the game is finished I like to save the Score. However I can not do this from a DrawView? only from the main activity, so that i have to use menu buttons to call saving the score... is there a way to save data from view/drawview? )
Thanks in advance, and i wander what you think of my first attempt building a android app.
Good work! Very impressive for a first app!
for saving stuff, use these commands:
(put this at the begining of your class)
public static final String PREFERENCE_FILENAME = "AppGamePrefs";
(put this where you need it, usually located where you are doing the saving)
SharedPreferences gameSettings = getSharedPreferences("MyGamePreferences", MODE_PRIVATE);
SharedPreferences.Editor prefEditor = gameSettings.edit();
(get saved data like this)
score=gameSettings.getInt("score", 0); //"score" is the saved variables name, 0 is the default value incase the variable "score" has not been saved yet
(save like this)
prefEditor.putInt("score", points); // saves to variable "score" with value of variable points (you can change the putInt to putString, putBoolean, etc.)
(this finalizes the save VERY IMPORTANT)
prefEditor.commit();
Hope that helps, keep up the good work!
thanx for the reply. Starting writing in Java (?) was getting used to. I did had some experience with coding in Matlab (if that can be labled programming )
I have tried your advice, I have come across the same code on other fora and samples from google. Only problem is that it doesn't work in the class I am programming in, the drawview class.
In essence my program is setup like this:
public class activity extends Activity
...
public void onCreate(Bundle savedInstanceState) {
...
setContentView(drawView);
...
}
.. some other functions for the menu (from which i can do the code for storing data!)
then it goes into the drawView.
Here my program just draws and draws, until there is a touch on the screen, then it will calculate the new situation. But at a given moment, the game is finished. Then i will draw the finish screen (in the same drawview). I can not get out of this drawview. So i can not do setContentView(results_layout) or something like that. And i can not call the code for saving data because that can not be defined in that class (according to Eclipse).
public class DrawView extends View implements OnTouchListener {
...
@Override protected void onDraw(Canvas canvas) {
Draw everything
...
if game_end = true then {
drawResults
save-code here gives error
}
...
}
public boolean onTouch(View view, MotionEvent event) {
calculate everyting
...
game_end = check_game_end(); //return true or false
}
this is my code in essence. Ofcourse it not all, but this i hope you get my idea/problem.
Thanx for the response again
I wrote an app that most (98%) of the work is done by service.
Where is the best place to do a license check?
In your Main activity, the first time it is launched and where the service is initiated. I wouldn't do it too often so don't put the check into the service.
You could also check periodically, let's say, every 15 minutes.
But don't use Timer for that, as it creates a new thread (well, you could use it, but you could do it in a better way). It's better to use a Handler:
Code:
// Fifteen minutes
int checkFrequency = 15 * 60 * 1000;
Handlerhandler = new Handler();
Runnable runnable = new Runnable() {
[user=439709]@override[/user]
public void run() {
if (!checkLicense()) {
// no license, do whatever you need to do
}
handler.postDelayed(this, checkFrequency);
}
};
handler.postDelayed(runnable, checkFrequency);
So I will check every time he open the main window but the main window is a setup window so it won't be opned so ofen.
you can set preference and check weather user has accepted licence or not and if accepted then no need to display it again .
wasim memon said:
you can set preference and check weather user has accepted licence or not and if accepted then no need to display it again .
Click to expand...
Click to collapse
We've been talking about the Play Store licensing, not about an End User License Agreement.
He wanted to check whether the user has bought his app.
Otherwise your solution would be right though.
11alex11 said:
I wrote an app that most (98%) of the work is done by service.
Where is the best place to do a license check?
Click to expand...
Click to collapse
i would (this is how i do that) check it when the app starts (SplashActivity) and write "encrypted" how often the app got started.
Then everytime when (pseudocode)
if (read_and_decrypt(cntAppStart) % 10) == 0) { checklicense(); }
in the splashactivity.
Hi guys,
i've started making an app recently.. and i needed a task to run in the backgound every 2 or 5 minutes.. and i collect the data and i display it when the app is opened.. so am using a sync task.... I'm having a bit of diffculty unerstanding how its used as every example is different..
and FYI am using a seperate .java file to runt he asynctask...
When we go through the android developers page this is the code we see...
They start with
Code:
private class DownloadFilesTask extends AsyncTask<URL, Integer, Long> {
1) whats the deal with the URL Integer Long ????? If i skip it what will happen???
next is this
Code:
protected void onProgressUpdate(Integer... progress) { setProgressPercent(progress[0]);
2) whats the integer doig there?? even if its not used in the function they put it... whats the deal??
3) Also how do we pass values like strings to a class??? i know about functions but the functions used in this class are like a group like so i cant exactly pass values to just one particular function...
Async Task
nvyaniv said:
Hi guys,
i've started making an app recently.. and i needed a task to run in the backgound every 2 or 5 minutes.. and i collect the data and i display it when the app is opened.. so am using a sync task.... I'm having a bit of diffculty unerstanding how its used as every example is different..
and FYI am using a seperate .java file to runt he asynctask...
When we go through the android developers page this is the code we see...
They start with
Code:
private class DownloadFilesTask extends AsyncTask<URL, Integer, Long> {
1) whats the deal with the URL Integer Long ????? If i skip it what will happen???
next is this
Code:
protected void onProgressUpdate(Integer... progress) { setProgressPercent(progress[0]);
2) whats the integer doig there?? even if its not used in the function they put it... whats the deal??
3) Also how do we pass values like strings to a class??? i know about functions but the functions used in this class are like a group like so i cant exactly pass values to just one particular function...
Click to expand...
Click to collapse
Code:
public class async extends AsyncTask<Params , Progress , Result>{
}
here 'params' is the argument that is input to the object of the class...
for eg..
Code:
public class async extends AsyncTask<int , Progress , Result>{
}
then when you will call its object then it will like this.
Code:
public class async extends AsyncTask<int , Progress , Result>{
}
async c;
c.execute(10); // passed int value 10 to execute the async thread in the background...
it has 3 methods that should be implemented
Code:
class load extends AsyncTask<int, Void, Void>{
@Override
protected void onPostExecute(Void result) {
// TODO Auto-generated method stub
// all the ui updation is done here after doing the calculation...
}
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
// before the starting of calculation if ui needs to be adjusted then it is done here
}
@Override
protected Void doInBackground(int... arg0) {
// TODO Auto-generated method stub
// all calculation stuf is done here
}
}
IF U WANT SOME MORE HELP REGARDING ASYNC TASK THEN PLZZZ ASK AGAIN....
nvyaniv said:
Hi guys,
i've started making an app recently.. and i needed a task to run in the backgound every 2 or 5 minutes.. and i collect the data and i display it when the app is opened.. so am using a sync task.... I'm having a bit of diffculty unerstanding how its used as every example is different..
and FYI am using a seperate .java file to runt he asynctask...
When we go through the android developers page this is the code we see...
They start with
Code:
private class DownloadFilesTask extends AsyncTask<URL, Integer, Long> {
1) whats the deal with the URL Integer Long ????? If i skip it what will happen???
next is this
Code:
protected void onProgressUpdate(Integer... progress) { setProgressPercent(progress[0]);
2) whats the integer doig there?? even if its not used in the function they put it... whats the deal??
3) Also how do we pass values like strings to a class??? i know about functions but the functions used in this class are like a group like so i cant exactly pass values to just one particular function...
Click to expand...
Click to collapse
OK, so you're probably using it in a service, aren't you?
First of all, carefully read the tutorials here and here on vogella, to help you understand what it does.
1) these are the type of variables that are passed to the respective methods:
An asynchronous task is defined by 3 generic types, called Params, Progress and Result, and 4 steps, called onPreExecute, doInBackground, onProgressUpdate and onPostExecute
Click to expand...
Click to collapse
The Params get passed to the onPreExecute method, the Progress is the one you need to pass calling publishProgress and which is passed to onProgressUpdate. The result one should be returned by your doInBackground method and gets passed to the onPostExecute.
2) the Integer... Is actually an array of the corresponding object to int. Just ignore it and use the progress[0] as if it was a normal int.
3) set your Params variable to String so
AsyncTask <String, Integer, String> if you want to return a string as well
Ok i think i'm getting it... But when we say "Params , Progress , Result" its still a bit confusing..
we first hit pre execute then do iin BG then post execute... But the order in which the params are stated are not the same ...
when i give string first it always takes it for the during BG process... not for the pre execute...
For ex i say asymctask<int, string,void>
so my pre execute should get a int..
then my bg process should get a string..
the post execute should get nothing..
am i right???
nvyaniv said:
Ok i think i'm getting it... But when we say "Params , Progress , Result" its still a bit confusing..
we first hit pre execute then do iin BG then post execute... But the order in which the params are stated are not the same ...
when i give string first it always takes it for the during BG process... not for the pre execute...
For ex i say asymctask<int, string,void>
so my pre execute should get a int..
then my bg process should get a string..
the post execute should get nothing..
am i right???
Click to expand...
Click to collapse
Almost, the Progress variable is passed to the onProgressUpdate. This is something to indicate progress and publish on the UI Thread (for instance update a progress bar), usually an Integer. You can update the Progress from your doInBackground method by calling publishProgress, passing a Progress variable.
The point of this is that the doInBackground method runs in a seperate thread and all other methods run in the UI Thread! So you can't directly pass data between those, only with these values. Consider using a Bundle if you want to pass more than one variable!
Hello everyone ^_^
Ive been making zooper themes for some time, as well as Themer themes. What i would love to do now is to create an app that can install a zip file to a specific folder on the storage. I wish to make a Material themed app for installing the zip, that can show scereenshots or other shots which i use to display my themes. Also, I wish to include a link for the wallpaper for that specific theme. Ive scoured the internet a bit for this type of thing, and so far, ive been unable to find anything that would suit my requirement.
help would be appreciated a lot
PS, i havent done app developing or coding in a few years so you could say that im kinda noob to this now so guidance from scratch would be very helpful ^_^
You can use below code to create a zip and place it wherever you want.
Code:
private static void zipFolder(String inputFolderPath, String outZipPath) {
try {
FileOutputStream fos = new FileOutputStream(outZipPath);
ZipOutputStream zos = new ZipOutputStream(fos); File srcFile = new File(inputFolderPath);
File[] files = srcFile.listFiles();
Log.d("", "Zip directory: " + srcFile.getName());
for (int i = 0; i < files.length; i++) {
Log.d("", "Adding file: " + files[i].getName());
byte[] buffer = new byte[1024];
FileInputStream fis = new FileInputStream(files[i]); zos.putNextEntry(new ZipEntry(files[i].getName()));
int length;
while ((length = fis.read(buffer)) > 0) {
zos.write(buffer, 0, length); }
zos.closeEntry();
fis.close();
}
zos.close();
}
catch (IOException ioe) { Log.e("", ioe.getMessage());
}
}
And for the second one.
You can simple use intent to open your link in browser.
Intent n = new Intent(Intent.ACTION_VIEW , Uri.parse("link to your wallpaper"));
Sent from my A0001 using Tapatalk 2
Android Application Development Request
I am in need of some help I have a great idea for a new app that may change the face of advanced research. This will allow for the user to search all day and all night. While they are handling everyday life issues and events with family and what not. Yet still, allowing them to locate what they are looking for. Also will allow people with artifacts in there home. That the user may think is not worth anything yet it may be a goldmine. So instead of the user having to do research trying to locate these specific artifacts to see if they are worth money. This app will allow them to do advanced research all day with a touch of a button my idea is revolutionary when it comes to the advanced research that needs to be done. Please, I am looking for somebody to help me develop this app and bring it to life. So that I may present this idea to google for a possible sale. Thank you for your consideration ahead of time on helping me with this application.