2017년 5월 27일 토요일

How can i keep my app running in the background when the screen goes to sleep?


I am creating an app which plays an audio (Player).
How can i keep my app running in the background when the screen goes to sleep? 
Acording to an advice http://puravidaapps.com/countdown.php the videoplayer (1x1) don't prevent an app from a stop. 
A notifier don't allow to switch off an screen - so a phone quickly looses an energy. 

--
You can use WebViewer + html5 Audio tags.



It play audio streams and mp3 files.
Audio (mp3) files you find in left upper corner :)
Also it can play backround and also "STOP" audio if call come in.
In mobile device Autoplay is disabled, that mean you need press PLAY when app start.

--
I don't understand how to use WebViewer + html5 Audio tags in MitAppInvertor. Can you explain?

--
I made test file for you. It works OK in my LG G2 (KitKat 4.4.2)

It contain simple html file what play audio stream this shoutcast station: http://www.chilloutradio.tk/


--
Thank you for this solution, but it doesn't suit to me, because I want that my app doesn't sleep as I want to have active the GPS and the app should make some work.. not only play audio.

--
you probably can do it with SL4A http://puravidaapps.com/countdown1.php

--
You ask: "I am creating an app which plays an audio (Player).

How can i keep my app running in the background when the screen goes to sleep? "

You can try my solution, if screen go sleep, audio still play. If You push "Home" button Audio still play.

--
@Peep: great solution! other people most probably will find this very useful!

--
how we put those codes to appinventor panel?
can u make a tutorial for this? thanks! :D

--
you can find a lot of examples, which use an embedded HTML/JavaScript file here http://puravidaapps.com/tutorials.php#html

--
Why am I not able to install your app on play store?? It says "This app is incompatible with your device." My phone is Lenevo A369i and android version is 4.2 Jelly Bean.

--
I`m not see Lenovo A369i Google Play supported phone list. There is with similar Lenovo`s A360, A360t, A360e and A366t.
Sorry, I can`t add you phone if google not support this :(

--
This is great solution. Peep, Installed your app as well, Looks great. 5*****

How did you auto start playing after loading - in your app. 
Is it possible to add external buttons for Play,Pause,volume. 

Do I need to create 1 html file each station or is there way to make list of audio source and somehow modify html file. 

--
.

Radio


Can i set a (FM)radio in my app?

--
Here are two video tutorials that will show you how with mp3 Web stations:



and also go here:   http://seblogapps.blogspot.com/    for additional mp3  advice

--
I have create a web radio, but my issue is:

1) when I change to another screen (screen2 for example) it pause the radio
2) when the screensaver activate it pause again

I am not sure how I can fix them

--
Taifun has several suggestions to keep the device from 'sleeping'
http://puravidaapps.com/countdown.php
countdown.aia

They might help with issue 2, regarding issue 1  the simple solution is to code the app using a single screen.

Sleeping is an issue with AI2.  If you want to encourage the development team to work on this issue, star this issue:
https://code.google.com/p/app-inventor-for-android/issues/detail?id=2746

Visit here frequently, someone may have a solution other than work-arounds.

--
meanwhile you can use Peep's solution, which uses HTML5 audio tags, see here How can i keep my app running in the background when the screen goes to sleep?
See here for more discussion about this
Background music

--
Here is the code how I create a live streaming (mp3) radio.

The sleep issue I fix it with timer. For the other issue I have tried almost everything and still nothing.

--
you other issue is simple to fix: use only 1 screen instead of multiple screens
to simulate multiple screens, use vertical screen arrangements and set them to visible true/false as needed

--
Tnx for you help! But i want an FM radio, that on every channel can.


Is that possible?

--
Yes. But...
Although you could fix 88.7 to be 'The Rock'. That number represents a different channel in different cities since radio signals are limited in range - so using a number scheme does not seem to apply unless your app allows the user to select a city first.
Also, why ask the user to scroll to a number on a dial when they could just pick the station by name or description from a list?
See > this < demo.

--

Web radio


Hello, I have a web radio, created an apk to listeners, I wonder if you are like me create an apk where I can see the statistics of my radio, use sam broadcaster to vocalize and receive statistics (as pictured) is to receive these Statistics in a apk?
another question
put the codes of apks layout, an admin (so I have) the other pros listeners.
admin in the first tab has a text box to which I want to put my ads from sponsors. looking in version admin vera q has color butons tried to change the text at the time of posting paw appear on the first screen each different color ad, is?

--
What stream backend you have, Soutcast or Icecas?
I have made so many radio apps, please send me e-mail in English please.

--
Hello, I have a web radio, created an apk to listeners, I wonder if you are like me create an apk where I can see the statistics of my radio, use sam broadcaster to vocalize and receive statistics (as pictured) is to receive these Statistics in a apk?
another question
put the codes of apks layout, an admin (so I have) the other pros listeners.
admin in the first tab has a text box to which you would like to place ads of my sponsors. looking in version admin vera q has color butons tried changing the text at the time of posting paw appear on the first screen each different color ad, is?

 Soutcast 

my site, ahhh and the title of the song as the site is?

--

How to Automatically Launch Android Auto with NFC


By Cameron Summerson on December 9th, 2016
IMG_9991
Android Auto recently made its way to phones, eliminating the need for a $1000+ head unit to get its road-friendly features. And while you can set Auto to automatically launch when a specific Bluetooth device (like your car) is connected, what about those who may not have a Bluetooth-enabled car stereo? NFC is the answer.
NFC—or Near Field Communication— is a simple but relatively modern technology that allows phones to communicate wirelessly with just with a tap. Two NFC-equipped phones can send data to each other this way, but it’s more commonly used with NFC “tags”: small programmable chips that make it incredibly easy to share data or launch activities. NFC is also used for Android Pay (and Apple Pay for iOS users). NFC chips are incredibly inexpensive, with bundles of 10-12 usually going for around $8 to $10. That’s a lot of utility for not a lot of money.

One very cool, yet very simple thing you can do to make your life easier is write Android Auto to an NFC tag—an NFC key chain would be great for this—so you can instantly launch it as soon as you get in the car. If you have a dock for your phone, you could even write this data to a tag and stick it to the dock—this way, as soon as you drop your phone in the dock, boom: Auto pops up on the screen.
Once you have your tags in-hand, you’ll need to install an app that can write to the tag. We’ll be using NFC Tools for this tutorial, as it’s easy to use and full-featured.
With the app installed, go ahead and launch it. A tutorial explaining NFC will start—if you’re curious about NFC, read it. It’s helpful! After the tutorial, you’re going to need to erase your tag. Tap the “Other” tab in NFC Tools, then tap the “Erase Tag” option.
Screenshot_20161110-092527
It will start looking for a tag here—just rub the tag around on the back of your phone till it gives some sort of audible notification. The NFC chip is located in different places on different phones, so you may have to fiddle with it a bit before you find yours. Once the tag has been erased, the app will give a notification.
Screenshot_20161110-092601 Screenshot_20161110-092608
Now that the tag is clean and ready for data, move over to the “Write” tab. This is where you’ll set everything up to add Android Auto to the tag. Tap the “Add record” button to get started. There are a slew of different options here (all things you can do with NFC!), but you’re looking for one in particular: Application. Find that option (it’s closer to the bottom of the list) and tap it.
Screenshot_20161110-092821 Screenshot_20161110-092826
The next screen will prompt you to “Enter your package name,” but I can’t imagine most users know the exact name of what they’re looking for, so instead tap the icon next to the text box. This will launch a list of all the installed applications. Find Android Auto and tap it.
Screenshot_20161110-092913 Screenshot_20161110-093039
With Auto selected, tap the “OK” button at the bottom.
Now, you can add more functions here if you’d like. For example, you can have the tag automatically disable Wi-Fi and enable Bluetooth alongside launching Android Auto. Just tap the “Add a record” button to add more functionality. For the sake of this tutorial, however, we’re going to stick with just launching Auto.
With everything set and ready to go, tap the “Write” button. The same dialog from earlier (when you were erasing the tag) will appear. Tap the tag on the phone again. Once again, a notification will show up once it’s finished writing—this will only take a split-second.
Screenshot_20161110-093250 Screenshot_20161110-093319
That’s it! Now all you have to do is tap your phone on the tag (with the display on, of course), and Android Auto will launch instantly. Handy!

ot - tags nfc


We have some blue NFC tags? I took on the amazon patacchelle concerned, I see the play store that there are several apps to program them but they seem a bit cumbersome ... so what is the best app for configurale? 

--
> We have some blue NFC tags? I took on the amazon patacchelle concerned, I see the play store that there are several apps to program them but they seem a bit cumbersome ... so what is the best app for configurale? 

I downloaded NFC Pro Tools, including some of the things I want implemntare company 

--
> I have downloaded NFC Pro Tools, including some of the things I want implemntare company 

With these tags http://www.amazon.it/dp/B00CE3IC74 I used the free version NFC tools and already can do discrete things but the limitation is the limited capacity of these tags with NTAG213 chip with 5 tasks are already full , 144bytes are just a few: the NTAG216 advice from 888bytes, much better. 

--

Front door PC


Does anyone have the current configuration details for the door PC with the pi in it?

I've got a couple quick and simple ideas for it. I'm thinking a power and network usage monitor using our fancy new router software's graphs and the fancy new power monitor's web interface. 

Do those sorts of LCD's suffer from burn-in? If so, maybe it could be made to switch on only if it detects motion on the camera?

Quick and easy, no?

--
Linux defaults to a screen blank on idle, I think, though I don't know if that's true for the door PC...

--
Yar, so triggering something on motion to get out of screensaver would be clever. PIR sensor on a minimus emulating the shift key or something maybe?

--
Pir off the gpio?

--
Yep, then something to make the Gpio trigger the screensaver!

--
Anyone know login creds for the pi?

--
Do those sorts of LCD's suffer from burn-in? If so, maybe it could be made to switch on only if it detects motion on the camera?

Quick and easy, no?

get the door opener to issue a gnome-screensaver-command --deactivate or whatever the command is for that enviroment


--
Trivial for the Pi doing the door's card reader to wake a PC with no
extra hardware. 


--
Cool, so all we need is another card reader for the back of the door to activate it before people leave.
Actually... Let's lock the last person in if the power is above a threshold!

--

Doesn't help on the way out :) 
signature.asc

--

See above, it does if ppl need to use their card to leave :)

--

That would be a massive PITA on Wednesdays, not to mention against fire rgs if the door doesn't open on it's own in a fire.

signature.asc

--

not really the most practical solution given that we are all leaving with boxes and there are cleverer ways than having to physically beep out.

--

The red button will still be there, no shit, and Gary, have you found your card yet or are you still tailgating b?

--

+1 

signature.asc

--

Also, we should be keeping a register of visitors on Wednesdays, in order to keep with fire regs best practice

--

Well if the red button is there, who would use their card?!

signature.asc

--

lol and YES!

I am working on some occupancy sensors that would work for this application. I hope to send them off tomorrow to dirty.


--

Sort your f#&%ing card out then and kwitcherdambellyaching !!!
:)
Cool, that too, but I still think some sort of last man out enforcement is needed, too many times recently I've seen lights left on (at least twice in the past week) and they take a lot more power than I thought they would.
--
totally agree but beeping out isn't the right deal.

even if you looked at power consumption on a pir would be better, maybe with an audible notice.


and no, I refuse to come to the space without barn lmao


--

Hmm... How do we know who is in the space then?
I'll provide the facility to beep out, whether or not people use it i suppose may be dictated by how useful it is, forcing people to do anything isn't a thing we can do...
B, is it as simple as hooking up a usb to serial to the door pi with an RFID dangling off it? From what I can tell, it looks like there's at least bits of the support required already in the code...

--

Fairly sure it wouldn't be useful; but as you say the software supports
it (though doesn't yet track if you are last etc.) I fairly sure the
hardware has a spare serial for this purpose too; so just plug and play. 


--
Yeah, seems it probably won't be, but let's see if it's possible to make it useful enough that it's used...maybe?

I'm just keen to know who's in the space and when, it's kind of important for safety and security in my mind.  I think it's one of those fundamental things access control should be able to do. 

--
Facial recognition - like this but cheaper and rLab produced?
http://www.windowscentral.com/netatmo-camera-will-tell-your-windows-phone-whos-home
Just on back of door perhaps?

OR possible to use a massive antenna/more power to read the cards without then being physically presented to a reader?

OR barcodes tattoo'ed on foreheads 


--
Why don't we just inject everyone with an RFID chip?

--
Yessssssss

--
Perhaps a limited trial on people who have a tendency to lose their card....

--
Gary, hold yer ankles... Guess we'll need another set of readers at hip-height

--
Perhaps a limited trial on people who have a tendency to lose their card....
Reading Uni was where Dr Warwick's RFID chip was developed.  You might get interest from the Uni if you're serious... :)

--
Was it?
--
Or you could just go to the vets.

--
Don't think you need a qualified vet, at a push you may want to go to a

tattooist but DIY is possible:
Seriously, don't tempt me. I really want to do that.

--
....shall we?!

--
I think I may be about to have an impulse control failure.

--
Full disclosure; it is the xM1 tag that is 100% compatible with our
systems off the shelf. However given the commitment involved I would
recommend the superior xNTi tag. It is hardware compatible and I am
happy to guarantee software support it if anyone is insane! 

--
If anyone orders one, let me know and add one to the order for me. Will pay cashey money

--
Fuck fuck fuck have you seen the size of that fucking needle?!

--
Yeah. There is a body mod guy in southampton who will implant it for you........

--
Just rang the place in Soton, he said £100 for the kit and it implanted. I'm very tempted to take a trip to arrange it and take a trip to soton now. Could do an ikea shop at the same time.

--
I know a tattoo artist who does implants as well, I'm certain he'd be game. Lives in Tadley, studio in Basingstoke.

--
Are there airport security issues? You don't want to be imprisoned abroad because they mistake you for James Bond / Jason Bourne

--
I'm just thinking of how easy you will all be to troll with an rfid that you can't easily hold back. :)

--
Fairly sure injection Xylocaine is prescription only in the UK; I
wouldn't try importing without being very sure! Think you can get smiler
dose creams and sprays if you can convince a pharmacist. 

--
Ryan. It is the standard login, I havent read all this thread yet, but it was on 178.x.x.229 and I have added some scripts to take pics and keep the screenalive. - Mike

--
Ok, read the thread, mostly bodmod stuff it seems. Motion can do the movement sense directly with the picam, and face reconignition is a possibilty too. 

--
So who's in? If y'all wimp out I might just go to Soton and get it done anyway.

--