How to access activity information - android

I am Android beginner so please forgive if the question might sound silly. I had an app idea where a youtube video or a web page open on a smartphone could be transferred to the laptop screen by detecting a particular forward phone motion-gesture. But to program something like that, I realized that I need to have access to the browsers web page or the video URL which the youtube app is playing. With some initial research it seems to me that the Android system doesn't keep that piece of information. Am I correct?
The end solution seems to me to code up my own browser or maybe enhance an existing open source one. I looked into the possibility of accessing the temporary files on the phone through my program but the location /data/data seems accessible only to root I guess. Also I intended my app to run as a background service so that I could later expand the idea to other places like transferring and opening PDF file on a laptop etc in a similar fashion. Is there a way around where I can access similar information from a running application?

for showing a youtube video , check this one out:
http://code.google.com/p/android-youtube-player/
also , isn't it easier to transfer the url alone to the other device instead of sending the entire video?
you could do this in multiple ways : bluetooth , wifi , qr code ,usb , morse , ... the possibilities are countless .
about accessing other apps data , the app must provide it to you in some way , since all apps are protected from each other (using sandboxing) . for youtube , you can "listen" to youtube urls (via intent filter) for allowing the user to choose your app instead of youtube app (or any other app that listens to it) .
about /data/data , this is correct , only rooted devices can reach it , or your own app if all you do is access your own folder (which is /data/data/YOUR_APP_PACKAGE_NAME) .you can also reach this folder on an emulator .
it's also quite easy to root your device . even novice users can do it via a third party app . here's something that worked for me on both galaxy S and galaxy S2 :
http://www.unlockroot.com/

Related

Why do links to PDF documents now require https to work on Android phones?

We have a file server on which we place PDF documents and then embed links to them in a smart device app. Up until recently, using links to the PDF documents starting with http:// worked fine for Android and iPhone users. All could load the PDF file just fine. Then a few months back (approximately) Android phone users started reporting they would get an error when trying to load any PDF. Yet iPhone users had no issues loading the same PDF document. It was verified that these PDF documents (several) were not corrupted and opened fine when placed on another file server.
I have an iPhone so I can't give you the exact error msg received by Android users but to reproduce it, it was along the lines of... click the link to the PDF, a button appears showing View PDF, click that button and several apps appear to choose the app to open the PDF with, click one (like Adobe Reader, or Google Drive) and an error appears stating the file could not be opened and may be corrupted of the wrong syntax.
Tonight I found the solution.
The url to the PDF on all these documents on our server had been like http://...
but when I changed it to https://... it works fine.
I can't find ANYWHERE any mention of a change by Google that this is now a requirement.
My question...
Can someone explain and/or point me to a reference that explains why https must be used in embedded links to PDF documents? It seems like a pretty big deal to make this a requirement and not tell anyone. My searching the internet has so far not turned up anything.

Play a streaming url without save temporary files on device

i've created an Android application that connects to a streaming page. I'd like to know if some data will be stored on my device (like on a temporary folder or similar). This video should be only accessed by the URL so i'd like to prevent any download.
Is there a way to prevent the 'download' of the streaming data on my device? Or if it must be downloaded, can i be sure that no one can use this data if found in a temp file?
Thanks
EDIT
For the web page, i've used this code: http://codesamplez.com/programming/php-html5-video-streaming-tutorial
There is a better way? I was thinking about create an HTML5 video player and use it in my android application as a web view. As i said before, the important thing is to deny any download.

HTML5 Android Phonegap Web app not working offline with cache manifest

I have a simple web app built with Phonegap and Android that call external ressources (js, css, html) from server instead of storing it in Phonegap assets folder. I prefer using external ressources because my server can deliver html pages taking in charge internationalization.
This web app work fine on my android device when WIFI is on but it fail when stopping WIFI. My index.html file delivered by my server contain a valid manifest file with correct mimetype ('text/cache-manifest') that list every files the app need to work.
My Android Activity class is supposed to have caching enable:
this.appView.getSettings().setDomStorageEnabled(true);
this.appView.getSettings().setAppCacheMaxSize(1024 * 1024 * 15);
String appCachePath = getApplicationContext().getCacheDir().getAbsolutePath();
this.appView.getSettings().setAppCachePath(appCachePath);
this.appView.getSettings().setAllowFileAccess(true);
this.appView.getSettings().setAppCacheEnabled(true);
It may worth mentionning that my app use ajax call with urls like /aaa/bbb/ to call web pages from server and I don't know if that may be the problem (l'm not calling physical pages directly like index.html)... However, this web app work well in desktop browser (Google Chrome) when offline...
Any idea what more can I do to enable this HTML5 cache feature on my Phonegap app?
Thanks a lot
After playing around for a while I get it to work. Here is some points you should verify when stucked with this type of caching problem:
Take care about url parameters passed with GET method... I was passing parameters when navigating between pages of my app and those parameters was making my urls different from the ones in manifest file making cache to fail.
When testing offline mode on my phone, I was only shutting down the WIFI thinking this was enough to trigger cached version of my app but it was not... As I was testing my app published under a local network IP (like 192.168.2.11), it appear that my app was trying to reach that IP trough the 3G network that was still ON... So use airplane mode when testing offline.
Not sure if this one was necessary as I read it on some others threads but I renamed my manifest file to cache.manifest.
Regards
Apparently you need "to fix the Android Shell Native App to enable HTML5 caching".
If you haven't already, please check out: http://tmkmobile.wordpress.com/2012/03/04/html5-offline-solution/
I am developing a similar system. What I did was I created the Phonegap webpages and stored them in the www folder of my WAMP server. Then what I do is I basically super.LoadURL("insert_ip_address_here/insert_name_of_folder_where_webpage_is_located") in the onCreate method and this loads the phonegap application perfectly (yes all you need is just only line of code in the Android app itself). However you still have to make sure that the config.xml, manifest and all configurations needed for phonegap are properly done (for instructions on this see https://www.adobe.com/devnet/archive/html5/articles/getting-started-with-phonegap-in-eclipse-for-android.html).
Let me know if this the path you choose to pursue. I can provide extra support with things like making the ip-address (in the line super.loadurl(...)) dynamic for the local system using multi-casting, etc.

Is there a way to keep video files within my app that will be installed on the sd card?

I am new to Android developing. I have lots of videos around the size of 500MB. I have been testing my app but i always transfered the videos through the usb cable and not directly through my app. Is there a way to embed these videos within my app so that they are automatically transfered to the sdcard? I just need to know if it is possible or not.
i don't think it is possible at all to store all your videos inside your app and make the final APK out of that.
beacuse, Android market has a size limitation of 50MB. see here http://android-developers.blogspot.in/2010/12/android-market-client-update.html
pratcise is, that developer (especially in the games section), let the users download a small basic application which downloads the rest over the network (if WiFi is available), so that the user doesn't have to download a sh*tload of stuff if he wants to install your app, let say while he is outside, using GPRS/UTMS, or roaming...

Phonegap Android App - Display Store MP3 Media

I've been following this blog to help me make a simple music player function with an Android app (http://simonmacdonald.blogspot.com/2011/05/using-media-class-in-phonegap.html).
All works well - but I would like some way to extract a list of all music media stored on the phone so the user can click a file and play it. Does anyone know if this is possible via phone gap? I'd need to access track name/artist etc and a link to the track.
Cheers
Paul
Prognosis is not good.... PhoneGap does not have an API for accessing the media library. So, you would have to fall back to the File API to locate music files, and then... you would have to read the binary data in the actual files to extract out the track/artist metadata. Ouch. Seems pretty impractical.
[EDIT]
By the way, PhoneGap is not the only game in town. Appcelerator seems to solve the same problem, and apparently has a richer API, which includes
access to media metadata

Categories

Resources