I'm having some problems to figure out how to run my add after a specific amount of time, let's say 5 minutes.
I have a basic app and the only possibility to add vunglePub.playAd(); would be after I handle the new answer of my app. Is there any possibility you could add in a timer set to 5 minutes each time and run vunglePub.playAd(); and then repeat it again?
Thanks in advance
Delighted to hear that you're using Vungle!
There are a couple of ways that you could achieve this:
1) Use any number of patterns in Java to keep a timer, and only call VunglePub.playAd() after certain amounts of time.
2) Use Vungle's built-in feature designed for this exact use-case! If you go to your app on the Vungle dashboard, click 'edit' and then hit 'advanced settings'. One of the options in there is the 'frequency' cap, which allows you set a minimum time, in seconds, between ad plays. If you set it to 300 seconds, then once you've called VunglePub.playAd() once, we'll ignore and attempts to playAd() until 300 seconds is up.
Option 1 may be more useful in some instances, especially if you want to action any other behaviour at the same time, but option 2 is probably the simplest to implement!
And if you run into any issues - hit us up at 'tech hyphen support at vungle dot com'.
David#Vungle.
Related
I'm trying to return time in milliseconds between both iOS and Android devices. I was hoping that since most devices sync their time with a networked server, they would be the same. However, I'm noticing they are not precisely the same.
I'm using this method for iOS:
[[NSDate date] timeIntervalSince1970]
and this for Android:
System.currentTimeMillis()
Is there a better way to try to return the same exact time across devices? I'm noticing these values can be off from each other by up to 2 seconds depending upon the Android device.
The use-case for needing this synchronized time is to display a looping animation that is also synced across the devices. So the animation would need to start at the same time, perform its animation for a set duration, and then loop again.
Thanks for any help.
You'll never get exactly the same time. The problem is that clocks aren't perfect, and that they aren't always synched to exactly the same time source at the same rate. Even if you synch to the same time source, the latency between when they process update messages will make a difference between them. 2 seconds is actually pretty good.
Time is tricky. Take 2 devices in perfect synchronimity. Fly from the US to Europe with one of them. They're no no longer in synch, and both are right- the general relativistic effects of traveling at high speed means one is now several milliseconds older than the other.
Basically what you want isn't going to happen. You'll have to settle for close enough. Although if you post why you need them so synchronized maybe we can give you some ideas.
I am trying to build an app that makes a video of your screen and only keeps the last X mintues of the video, i have found a code for running an adb shell commands from app:
Process process = Runtime.getRuntime().exec("your command");
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
But i have looked for a lead of how i can keep the last X mintues with no luck, any ideas of how i can do that? or maybe its not possible without rooting?
tnx
I am trying not to build but just to find an android app that when I press "record" the previous (2-3-10 or choose from etc) minutes already saved, in RAM I imagine.
You may know when minidisk created (let's say about millenium or before) a few MD players had that function, where you can turn on & off this feature: If you had it on, when you push the record button it was the last 6 seconds already saved.
The logic of that was really simple: When you record a song from the radio and you may miss the start etc for a few seconds and press "record", the MD had the last 6 seconds already saved!
So, if you had it on and want to record it, you already had a few seconds written and then with just a simple edit you can delete them and set the start time (and delete the previous seconds) and the endting time (with deleting the last seconds).
Simple really.. But the point is that apart it's not something new, is 100% workable & easy to develop and I am amazed that I have not seen EVEN ONE so far...
Is it this hard to develop such a thing for a camera and a mobile?
I am asking about the driving of course, to not make videos everytime I drive (and I drive all day every day..) just with the mobile in it's stand in the car.
So, IF someone makes this application I have two things to say to him to add -> 1st to let the user decide how many minutes before he's like to have already saved and if possible, to work as long as the screen is even locked.
Why don't give it a try? I know I will not use it but nobody knows that for sure, but maybe the one time I'll need it, at last I will know that with the "recorde" or "capture" or whatever, that it's capturing but in the beginnings of it I already have the XX minutes recorded already.
USEFUL very indeed for drivers like me that don't want to put cameras in the car & with my phone holder IF I had that application with that feature it would be perfect.
If I am missing something, if there's somewhere an app like this and didn't check it, I don't know.
But for the developers ....just thing about it.
It's very practical, simple and you can have video proof in a ..let's say crash event without putting 2-3 cameras but only with mobile.
No idea is a bad idead for a smart developer I thing, then whoever wants sits and writes it.
Thanks, take care guys
I'm looking to create a drum machine in ActionScript 3 (as an Adobe AIR Android app), which will keep to a user defined tempo (BPM).
I am struggling to find a way to keep the project in time, I have, at the moment, made it so that 5 different sounds are represented in rows of 8 squares, and the user can click each square to choose when to play that sound (hope this makes sense).
At the moment I am using Timer to keep the project in time, which is very laggy and inconsistent.
using timer is a bad idea for this, there I said it...
The issue is that the timer has a drift and fires several milliseconds later.
Try a simple test where you have a timer that executes every 500ms, and then compare the getTimer() count. What I have found in my experiments that the timer is continually off and it looks like it doesn't self correct. I've tried using a self-correcting timer, that changes the firing time based on the getTimer() difference since last run, but it's still not reliable. and anytime your processor's load picks up, the timer will be off anyway.
The correct way of dealing with this is to use byteArray data as a source for the sound. Based on the calculation of sampling resolution you can populate the stream with the data in advance, and the sound will play on time, pretty much guaranteed. I haven't gone as far as to create something that does this myself. But there are several libraries that you can utilize that can help you with this.
My top two decremented libraries are SiON and tonfall
you can see a sample of SiON here http://wonderfl.net/c/qf4b
and tonfall example at http://tonematrix.audiotool.com/
While I haven't tried them on android, I think either should work
my project is growing large, and I am facing the following problem: the compile/transform-to-dalvik/install cycle takes too long.
It takes around 2 minutes since I press F11 (or ^F11) until the dialog to choose the device is shown, and around another minute from there until the application is shown on the phone.
3 minutes may not seem like a waste of time, but it breaks the concentration (actually, I am writing this post during those 3 minutes).
Do you have any trick to avoid this? Any way to avoid the full dalvik conversion when only a couple of classes have been modified? Any way to live-copy the classes to the phone without the need of the .class-dalvik-.apk-copy-install cycle?
Any other hint?
In the app I'm writing I have a bunch of stats which I want to display for the user.
The stats include when a specific module was last run, when it will be run next, when the last communication with the server was made and then the next one is going to be.
As well as this there are stuff like memory usage (simple memory usage, not measuring the actual usage).
The memory usage etc can be updated every few seconds so that not a problem the but the times needs to be updated every second at least (for counters).
Since running every second (or even with 500ms period) results in irregular updates/skipped seconds I now run it at 300ms period.
I did notice however that my app began to lag when starting.
After some profiling it turns out it's the views that need to resize that is taking 70% of the time and the string formatter (for formatting the counter) takes pretty much the rest.
Apart from the CPU being used I see a lot of allocations, every few seconds I see a GC_CONCURRENT in the logcat.
Any tips on solving this efficiently?
Can you restructure it in a way so that the fiews require less resizing? Eg: set the width of your element to fill_screen or a DP size that is bigger than the longest string size
I solved the problem by writing my own timer that sleeps in short increments and only updates the view when a full second has passed.
This way the fire interval will be [period, period+sleepTime) which is acceptable when you choose a short sleepTime.
I've also changed so it says "5 minutes ago" and I have two timers, one that fires every minute and one that fires every second.