Loading Google Earth through application - Android Software Development

Hi,
I am currently trying to open a KML file from my application to view a tour of point locations.
I am creating this KML on a webservice and passing this to the device, then save the string to a file locally with kml extension.
The problem is that when I pass this KML file to Google Earth app it returns a 'Not Found :" error after the google earth app opens.
I am opening the app using the following snippet:
if(file.exists())
{
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), "application/vnd.google-earth.kml+xml");
ntent.putExtra("com.google.earth.EXTRA.tour_feature_id", "flight");
startActivity(intent);
}
If I browse with Astro to the file location and click on it the Google Earth app will load the tour and start playing!
Any ideas or anyone encountered this problem?
Thanks!

Related

3rd party apps that can open EPUB files via Intent?

Say I want to do the following:
Code:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/epub");
At the moment I'm having a tough time finding an app out there that has a filter setup for epub, and was wondering if anyone has any ideas.
My intent is to load an epub file in an external application, which will be initiated from mine. Tried using Aldiko, but it doesn't seem to have any filters setup for this.

[GUIDE] Downloading and displaying a web page in a WebView

Hello everyone,
For a while now, I had been trying to figure out how to download and display a web page's HTML file in a WebView. Why, you ask? Well, because this app is probably going to be used offline. More importantly, it is just another thing that you can learn to do and have in your skillset.
A long time passed from my initial Googling efforts, and I forgot about this for a bit. After a couple of weeks, I picked this up again and got it to work correctly.
Since so many different tutorials and explanations exist, I wanted to give a clear and detailed explanation, as well as try to help anyone who attempts to implement this.
So, here we go!
Step 1:
Of course, you need to have specified a button that executes an action.
I chose to have an ActionBar item that checks whether or not the SD card is accessible to your app. It also calls the ASyncTask that downloads the file.
To do this, I used:
Code:
case R.id.save: // Save item
if (Environment.getExternalStorageState().equals(
Environment.MEDIA_MOUNTED)) {
// execute this when the downloader must be fired
DownloadFile downloadFile = new DownloadFile();
downloadFile.execute(downloadUrl);
} else {
Toast.makeText(this, "Can't write to internal storage",
Toast.LENGTH_LONG).show();
}
This checks whether the internal SD card is mounted. If it is, it starts a new download, and gets the file at the webpage with the URL downloadUrl.
If the SD card cannot be accessed, it will show so in a Toast.
Step 2:
For part 2, we will set up the actual download of the file. This is done by an ASyncTask. You can, should you want to, show a progress indicator. However, since I only download small files, I have chosen not to do so.
To download the file:
Code:
private class DownloadFile extends AsyncTask<String, Integer, String> {
[user=439709]@override[/user]
protected String doInBackground(String... sUrl) {
try {
URL url = new URL(downloadUrl);
URLConnection connection = url.openConnection();
connection.connect();
// download the file
InputStream input = new BufferedInputStream(url.openStream());
OutputStream output = new FileOutputStream(Environment
.getExternalStorageDirectory().getPath()
+ "/data/"
+ getPackageName() + "/webpage.html");
byte data[] = new byte[1024];
int count;
try {
while ((count = input.read(data)) != -1)
output.write(data, 0, count);
} catch (IOException e) {
e.printStackTrace();
}
output.flush();
output.close();
input.close();
Toast.makeText(MyWebView.this, "File downloaded", Toast.LENGTH_SHORT).show();
} catch (IOException ioe) {
ioe.printStackTrace();
}
return null;
}
}
So, what do we see here?
Firstly, make a new ASyncTask class. This has a number of standard methods, including one that executes everything in it in a separate background thread: doInBackground.
Now, you want to open a new connection to the site's server, with the downloadUrl, and connect to it. This is easily done with a standard class called URLConnection.
To download and write the file to a specific location on the SD, open a new InputStream. This will download the file from the downloadURL.
Once you have done that, make a new OutputStream to open a connection to the internal storage. In my case, I am writing to what would be /sdcard/data/<mypackagename>/webpage.html, because every new download overwrites the file that was downloaded last.
To actually write the file to the SD, byte by byte, create a new bit array and a counter. As long as there's still data to be read from the file, write the data.
As the last step here, you want to clean and close your in- and output streams, etc. Just do this with the standard commands.
Then show the user a short Toast, to let them know the file has been downloaded correctly.
Should an IOException occur, I print the stack trace.
It would be good to notify the user of the error, though you shouldn't do it in an obtrusive way.
Step 3:
Now, we're almost done. I know you want to know what else is to be done, since the hard parts have been coded already.
This is true, but placement is very important. You want to have the ASyncTask placed correctly in your code.
So, where does it go? Just put it at the bottom of your original class. Subclasses of ASyncTask are usually inside the main Activity class. This ensures you can still easily modify the UI thread (foreground thread, which we use for the Toasts).
Everything should now work, just code a nice little Button (or something else) that triggers the download.
Step 4:
Now, we want to display this web page in the WebView. You should have the HTML file downloaded locally, after which it is quite easy to get it to show in a WebView. This does not automatically show images and other external files! However, I think that kind of defeats the purpose, which is saving on internet costs.
If anyone wants to know how I would do this, please ask in this thread!
To open and display the downloaded HTML in your WebView:
Code:
mWebView.loadUrl("file://"
+ Environment
.getExternalStorageDirectory()
.getPath() + "/data/"
+ getPackageName()
+ "/webpage.html");
Very easy, as I said. Just add file:// to the front of your downloaded file's location, and the WebView will do all the work.
You should make sure, though, that the app doesn't have an Internet connection available. I check this when the WebView starts, but that's material for another guide.
I hope this tutorial helped you. Should you still have questions or see something wrong, please do tell me!
Regards,
bassie1995
Cool guide.
Thanks.
nikwen said:
Cool guide.
Thanks.
Click to expand...
Click to collapse
I might have killed your 444 thanks count .
Is there any advantage of using an URLConnection instead of HttpGet?
I usually do this using a HttpGet object which I execute using a HttpClient.
nikwen said:
Is there any advantage of using an URLConnection instead of HttpGet?
I usually do this using a HttpGet object which I execute using a HttpClient.
Click to expand...
Click to collapse
Honestly, I wouldn't know right now. I'll go and look it up, but have some things to do for school :-\
Sent from my Nexus 7 using Tapatalk HD
bassie1995 said:
Honestly, I wouldn't know right now. I'll go and look it up, but have some things to do for school :-\
Sent from my Nexus 7 using Tapatalk HD
Click to expand...
Click to collapse
Ok, I will look it up later and tell you.
nikwen said:
Ok, I will look it up later and tell you.
Click to expand...
Click to collapse
Didn't find too much quickly, but this might help?
http://www.tbray.org/ongoing/When/201x/2012/01/17/HttpURLConnection
Sent from my Nexus 7 using Tapatalk HD
bassie1995 said:
Didn't find too much quickly, but this might help?
http://www.tbray.org/ongoing/When/201x/2012/01/17/HttpURLConnection
Sent from my Nexus 7 using Tapatalk HD
Click to expand...
Click to collapse
I will search for it later.
I do not use a HttpURLConnection. I can post my code later. (It is working.)
nikwen said:
I will search for it later.
I do not use a HttpURLConnection. I can post my code later. (It is working.)
Click to expand...
Click to collapse
I'd like to see .
Sent from my GT-I9300 using Tapatalk 4 Beta
bassie1995 said:
I'd like to see .
Sent from my GT-I9300 using Tapatalk 4 Beta
Click to expand...
Click to collapse
That is my code:
Code:
try {
HttpParams params = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(params, 4000);
HttpConnectionParams.setSoTimeout(params, 5000);
HttpClient client = new DefaultHttpClient(params);
HttpGet request = new HttpGet("www.google.com");
HttpResponse response = client.execute(request);
InputStream is = response.getEntity().getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
String line = null;
while((line = reader.readLine()) != null) {
//do something with the line
}
is.close();
} catch (Exception e) {
e.printStackTrace();
}
My sources were http://stackoverflow.com/questions/...-source-of-a-page-from-a-html-link-in-android and http://stackoverflow.com/questions/6503574/how-to-get-html-source-code-from-url-in-android
Sweet guide!
Sent from my GT-S5830M using Tapatalk 2
This thread has evrything i had been looking for ....
Thanks a lot
Sent from my GT-S5360 using xda app-developers app
are you still open for questions ? nice thread btw
Thank you, this helped me so much!
Hello, very nice article provided. I want to open html file from sdcard path like "file:///storage/emulated/0/hensler_bone_press/index.html"
How can we achieve this using webview ?
Just stumbled upon this again...
Pannam said:
are you still open for questions ? nice thread btw
Click to expand...
Click to collapse
Did you get an answer? I assume so, 2 years later?
hardikjoshi8689 said:
Hello, very nice article provided. I want to open html file from sdcard path like "file:///storage/emulated/0/hensler_bone_press/index.html"
How can we achieve this using webview ?
Click to expand...
Click to collapse
Same here, have you got this working?
I'm not working with Android, especially not WebView, right now, but I suspect that you use the line in the last step to normally just load a URL.
Instead of supplying the URL wherever you tell the WebView what page to load, you can probably do what I did in the OP and specify your file path. Be sure to use the correct methods to get the path to your file instead of hard-coding it!

How to handle data between activities

I am trying to pass data from activity 1 to activity 5 without using Intent. How can I do that? The data type is string.. Is there anyway I can make a class between them which handles the data?
Not a really nice way, no. The simplest to do is with intents and if you want to pass something back with the startActivityForResult(intent) and then overriding onActivityResult.
Another possibility is to save the string in a text file and then open it from the other activity.
And Google is our friend: you can do this
using a class with a lot of static variables (so you can call them without an instance of the class and without using getter/setter)
Click to expand...
Click to collapse
Which means you create your class just with static variables and methods and access them without creating an object. But I don't think that's a good way to do it, if you have a simple String, do it with an Intent.
I agree that you should not do this.
If you still want to do this, use SharedPreferences.
nikwen said:
I agree that you should not do this.
If you still want to do this, use SharedPreferences.
Click to expand...
Click to collapse
Well, read this, see if EventBus could solve your problems:
http://xenoamp.info/index.php/capta...-eventbus-a-k-a-intents-you-shall-not-paaasss
I think that using eventbus is the cleaner method
Sent from my SK17i using xda app-developers app
ssuukk said:
Well, read this, see if EventBus could solve your problems:
http://xenoamp.info/index.php/capta...-eventbus-a-k-a-intents-you-shall-not-paaasss
Click to expand...
Click to collapse
Skektox said:
I think that using eventbus is the cleaner method
Sent from my SK17i using xda app-developers app
Click to expand...
Click to collapse
Makes sense.
ssuukk said:
Well, read this, see if EventBus could solve your problems:
http://xenoamp.info/index.php/capta...-eventbus-a-k-a-intents-you-shall-not-paaasss
Click to expand...
Click to collapse
way too nerdy for me.. I haven't started with broadcasts yet..
SimplicityApks said:
Not a really nice way, no. The simplest to do is with intents and if you want to pass something back with the startActivityForResult(intent) and then overriding onActivityResult.
Another possibility is to save the string in a text file and then open it from the other activity.
And Google is our friend: you can do this
Which means you create your class just with static variables and methods and access them without creating an object. But I don't think that's a good way to do it, if you have a simple String, do it with an Intent.
Click to expand...
Click to collapse
See here's the structure of my app:
activity 1: take input
activity 2 : choose game
activity 3: choose difficulty
activity 4 : start game
activity 5: scores displayed with the name entered in activity 1
If I use:
Code:
name=edittext.getText().toString();
Intent i= new Intent( activity1.this, activity5.class);
Bundle user = new Bundle();
user.putString("key", name);
i.putExtras(user);
startActivity(i);
It would immediately start activity 5 which I dont want...So what should I DO?
For récords you need persistence. Use XML files stored in application Folder (search for getexternalfiledirectory or something similar). Instead, you can use sqlite database, I think it's the best option.
Cheers
Sent from my SK17i using xda app-developers app
First of all, I wouldnt use so many activities, that's why dialogs were invented... They are a lot simpler to use because u can pass the values back. If the name the user enters is always the same (I guess so) you should save it in the SharedPreferences. This way you can also edit it in your SettingsActivity.
If you really want to do it with five activities you could still put everything in a Bundle and pass the Bundle through all the activities with intents if every activity gets the bundle from the last one and puts it to the intent to start the next one.
SimplicityApks said:
If you really want to do it with five activities you could still put everything in a Bundle and pass the Bundle through all the activities with intents if every activity gets the bundle from the last one and puts it to the intent to start the next one.
Click to expand...
Click to collapse
Yes I thought of it. Would be really tiring.
I am tryin to fix an app created by someone else so I need to follow the main framework of his app
prototype-U said:
way too nerdy for me.. I haven't started with broadcasts yet..
Click to expand...
Click to collapse
Don't start with them, they're not worth it!
Sent by automatic reply bot from my Galaxy S2
prototype-U said:
See here's the structure of my app:
activity 1: take input
activity 2 : choose game
activity 3: choose difficulty
activity 4 : start game
activity 5: scores displayed with the name entered in activity 1
If I use:
Code:
name=edittext.getText().toString();
Intent i= new Intent( activity1.this, activity5.class);
Bundle user = new Bundle();
user.putString("key", name);
i.putExtras(user);
startActivity(i);
It would immediately start activity 5 which I dont want...So what should I DO?
Click to expand...
Click to collapse
If you really want the full screen display without using dialogs, then fragments with a viewpager would be your go-to.
A pager with multiple fragments using the fragment manager to replace each fragment into your content view is ideal.
That way, you're contained within 1 activity and don't need to pass data between fragments if you tie it back to the activity.
prototype-U said:
See here's the structure of my app:
activity 1: take input
activity 2 : choose game
activity 3: choose difficulty
activity 4 : start game
activity 5: scores displayed with the name entered in activity 1
If I use:
Code:
name=edittext.getText().toString();
Intent i= new Intent( activity1.this, activity5.class);
Bundle user = new Bundle();
user.putString("key", name);
i.putExtras(user);
startActivity(i);
It would immediately start activity 5 which I dont want...So what should I DO?
Click to expand...
Click to collapse
Well I'm not sure if you want the app to be like this, but you could try to pass the string along every activity. Like this:
Activity1 starts activity 2 while passing the string.
Activity 2 starts activity 3 while passing the string, etc until you reach activity 5.
The only problem is that you would need to go through every activity.
Sent from my awesome fridge
prototype-U said:
See here's the structure of my app:
activity 1: take input
activity 2 : choose game
activity 3: choose difficulty
activity 4 : start game
activity 5: scores displayed with the name entered in activity 1
If I use:
Code:
name=edittext.getText().toString();
Intent i= new Intent( activity1.this, activity5.class);
Bundle user = new Bundle();
user.putString("key", name);
i.putExtras(user);
startActivity(i);
It would immediately start activity 5 which I dont want...So what should I DO?
Click to expand...
Click to collapse
I know this isn't the best option or a reliable one but try a static field declared as public in the class where you take inputs and access them when you need it
Sent from my GT-S5302 using Tapatalk 2
I am not sure about ur Problem, But here is guide
One more best way to send data from one activity to other as well as Send data to main thread from other thread
is Handler U can send messages to Static handler of a activity from any of ur application...
Its so far best way i followed to alter my UI as well send data from Background service to my Main activity
CoolMonster said:
One more best way to send data from one activity to other as well as Send data to main thread from other thread
is Handler U can send messages to Static handler of a activity from any of ur application...
Its so far best way i followed to alter my UI as well send data from Background service to my Main activity
Click to expand...
Click to collapse
However, that is bad practice. What if you need two Activities like this at the same time?
Additionally, the Handler will be running in the background, even after the Activity is destroyed.

Automatically downloads a file called "st"?

Hey,
Happened 3 times so far, I've noticed my phone would download a file named "st" and then reboot all by itself. I think it happens on or after I'm on a yahoo answers page.
I pasted the code below of the contents of such file. Can anybody tell me wtf this is?
Code:
<html><head></head><body><script type="text/javascript">/* All portions of this software are copyright (c) 2003-2006 Right Media*/var rm_ban_flash=0;var rm_url="";var rm_pop_frequency=0;var rm_pop_id=0;var rm_pop_times=0;var rm_pop_nofreqcap=0;var rm_passback=0;var rm_tag_type="";var rm_enable_supply_transparency=0;var rm_st_referrer="";var rm_md_purl_det_top=0;var rm_md_purl_det_if=0;var rm_md_purl_det_nif=0;var rm_enable_ck_mp=0;var rm_ck_mp_cu="";rm_enable_supply_transparency = 0; rm_st_referrer = "http://answers.yahoo.com/question/index?qid=20121015092323AAaicj9"; rm_md_purl_det_top = "1"; rm_md_purl_det_if = "2"; rm_md_purl_det_nif = "3"; rm_enable_ck_mp = 0; rm_tag_type = "iframe"; rm_url = "http://ad.yieldmanager.com/imp?Z=300x50&cb=1378955811.398703&x=http%3A%2F%2Fclicks%2Ebeap%2Ebc%2Eyahoo%2Ecom%2Fyc%2FYnY9MS4wLjAmYnM9KDE1djVmZ29ubihnaWQkMFo3M1FqazRMakU4Rk1wdlVpejhPZ0I4TmpZdU1sSXhNaVBfampXSSxzdCQxMzc4OTU1ODExMzcxOTY3LHNpJDQ5MDI1NTEsc3AkOTU0MDA2NzY2LGNyJDM2NjU5MzUwNTEsdiQyLjAsYWlkJHNJNFUuV0tMNEhVLSxjdCQyNSx5YngkRXR2aVhSWE00N3MyRUl0Q3hyWWt3USxiaSQxNzk0MzE4NTUxLHIkMSxyZCQxNmllMTV0YWIpKQ%2F2%2F%2Ahttp%3A%2F%2Fglobal%2Eard%2Eyahoo%2Ecom%2FSIG%3D15j408i6d%2FM%3D999999%2E999999%2E999999%2E999999%2FD%3Dmobile%2FS%3D954006766%3AWP%2FY%3DYAHOO%2FEXP%3D1378963011%2FL%3D0Z73Qjk4LjE8FMpvUiz8OgB8NjYuMlIxMiP%5FjjWI%2FB%3DsI4U%2EWKL4HU%2D%2FJ%3D1378955811398703%2FK%3DGM4UO%5FjkBYEW4EvomQxI8Q%2FA%3D7540457405187064449%2FR%3D1%2FX%3D6%2F%2A%24&u=&P=pri%3ayahoo_mobile_us_web%3bsec%3ayahoo%3bcrr%3aUS-UNKNOWN%3b%7C0Z73Qjk4LjE8FMpvUiz8OgB8NjYuMlIxMiP_jjWI%7C954006766%7CWP%7C1378955811.398703&S=2658015051&i=1542970&D=smpv%3D3%26ed%3DzAomdEK4k1NDvJ5__oyLCdlumPoxa3FYwZ0cRfRJq0aHrw--&T=3&_salt=2529253075";var RM_POP_COOKIE_NAME='ym_pop_freq';var RM_INT_COOKIE_NAME='ym_int_freq';if(!window.rm_crex_data){rm_crex_data=new Array();}if(rm_passback==0){rm_pb_data=new Array();if(rm_crex_data.length>0){rm_url+="&X=";for(var i=0;i<rm_crex_data.length;i++){rm_url+=rm_crex_data[i];if(i!=rm_crex_data.length-1){rm_url+=",";}}}}else{rm_pb_data.push(rm_crex_data.pop());rm_url+="&X=";for(var i=0;i<rm_pb_data.length;i++){rm_url+=rm_pb_data[i];if(i!=rm_pb_data.length-1){rm_url+=",";}}rm_url+="&Y=pb";}var flash=new Object();flash=flashDetection();if(cookiesEnabled()){rm_url+=(flash.installed?"&B=10":"&B=12");}else{rm_url+=(flash.installed?"&B=11":"&B=13");}if(!flash.installed||rm_ban_flash==1){rm_url+="&m=2";}if(rm_url.indexOf("&u=")==-1){var url='';try{if(rm_tag_type=="ad"){if(top==self){url=encodeURIComponent(top.location.href);url=url.substr(0,256);rm_url+="&u="+url;}}else if(rm_tag_type=="iframe"){url=encodeURIComponent(document.referrer);url=url.substr(0,256);rm_url+="&u="+url;}}catch(e){}}if(top==self){rm_url+="&r=1";}else{rm_url+="&r=0";}if(rm_enable_supply_transparency==true){var durl='';if(top==window){durl=encodeURIComponent(top.location.href);durl=durl.substr(0,256);rm_url+="&H="+durl;rm_url+="&M="+rm_md_purl_det_top;}else if(top==window.parent){durl=encodeURIComponent(rm_st_referrer);durl=durl.substr(0,256);rm_url+="&H="+durl;rm_url+="&M="+rm_md_purl_det_if;}else{durl=encodeURIComponent(rm_st_referrer);durl=durl.substr(0,256);rm_url+="&H="+durl;rm_url+="&M="+rm_md_purl_det_nif;}}var rm_tag_src="";if(rm_enable_ck_mp==true){rm_tag_src+='<SCRIPT TYPE="text/javascript" SRC="'+rm_url+'"><\/SCRIPT><SCRIPT TYPE="text/javascript" SRC="'+rm_ck_mp_cu+'" ><\/SCRIPT>';}else{rm_tag_src+='<SCRIPT TYPE="text/javascript" SRC="'+rm_url+'"><\/SCRIPT>';}if(rm_pop_frequency){if(rmCanShowPop(rm_pop_id,rm_pop_times,rm_pop_frequency)||rm_pop_nofreqcap){document.write(rm_tag_src);}}else{document.write(rm_tag_src);}function cookiesEnabled(){var cookieEnabled=(navigator.cookieEnabled)?true:false;if(typeof navigator.cookieEnabled=="undefined"&&!cookieEnabled){document.cookie="testcookie";cookieEnabled=(document.cookie.indexOf("testcookie")!=-1)?true:false;}return cookieEnabled;}function rmGetCookie(Name){var search=Name+"=";var CookieString=document.cookie;var result=null;if(CookieString.length>0){offset=CookieString.indexOf(search);if(offset!=-1){offset+=search.length;end=CookieString.indexOf(";",offset);if(end==-1){end=CookieString.length;}result=unescape(CookieString.substring(offset,end));}}return result;}function flashDetection(){var flash=new Object();flash.installed=false;flash.version='0.0';if(navigator.plugins&&navigator.plugins.length){for(x=0;x<navigator.plugins.length;x++){if(navigator.plugins[x].name.indexOf('Shockwave Flash')!=-1){flash.version=navigator.plugins[x].description.split('Shockwave Flash ')[1];flash.installed=true;break;}}}else if(window.ActiveXObject){for(x=2;x<10;x++){try{oFlash=eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+x+"');");if(oFlash){flash.installed=true;flash.version=x+'.0';}}catch(e){}}}return flash;}function rmReplace(myString,toReplace,replaceBy){return(myString.replace(new RegExp(toReplace,'gi'),replaceBy));}function writeCookie(ckName,ckVal){var numdays=14;var today=new Date();var expires=new Date();expires.setTime(today.getTime()+(1000*60*60*24*numdays));var cookieText=ckName+"="+ckVal+";expires="+expires.toGMTString()+";path=/;";document.cookie=cookieText;return null;}function rmCanShowPop(rm_pop_id,pop_times,pop_frequency){var countCookieName=RM_POP_COOKIE_NAME+rm_pop_id;var expireCookieName=RM_POP_COOKIE_NAME+"_expiration"+rm_pop_id;var shownTimes=rmGetCookie(countCookieName);if(shownTimes==null){rmWriteExpirationCookie(expireCookieName,pop_frequency);shownTimes=0;}else{shownTimes=Number(shownTimes);}if(shownTimes<pop_times){shownTimes=1+shownTimes;var expiration=rmGetCookie(expireCookieName);rmWritePopFrequencyCookie(rm_pop_id,shownTimes,expiration);return_value=true;}else{return_value=false;}return return_value;}function rmWritePopFrequencyCookie(rm_pop_id,shownTimes,expiration){var cookieName=RM_POP_COOKIE_NAME+rm_pop_id;var cookieText=cookieName+"="+shownTimes+";"+"expires="+expiration+";path=/;";document.cookie=cookieText;}function rmWriteExpirationCookie(cookieName,frequency){var today=new Date();var expires=new Date();expires.setTime(today.getTime()+(1000*frequency));var cookieText=cookieName+"="+expires.toGMTString()+";"+"expires="+expires.toGMTString()+";path=/;";document.cookie=cookieText;}</script><noscript><img border="0" src="http://ad.yieldmanager.com/imp?Z=300x50&cb=1378955811.398703&x=http%3A%2F%2Fclicks%2Ebeap%2Ebc%2Eyahoo%2Ecom%2Fyc%2FYnY9MS4wLjAmYnM9KDE1djVmZ29ubihnaWQkMFo3M1FqazRMakU4Rk1wdlVpejhPZ0I4TmpZdU1sSXhNaVBfampXSSxzdCQxMzc4OTU1ODExMzcxOTY3LHNpJDQ5MDI1NTEsc3AkOTU0MDA2NzY2LGNyJDM2NjU5MzUwNTEsdiQyLjAsYWlkJHNJNFUuV0tMNEhVLSxjdCQyNSx5YngkRXR2aVhSWE00N3MyRUl0Q3hyWWt3USxiaSQxNzk0MzE4NTUxLHIkMSxyZCQxNmllMTV0YWIpKQ%2F2%2F%2Ahttp%3A%2F%2Fglobal%2Eard%2Eyahoo%2Ecom%2FSIG%3D15j408i6d%2FM%3D999999%2E999999%2E999999%2E999999%2FD%3Dmobile%2FS%3D954006766%3AWP%2FY%3DYAHOO%2FEXP%3D1378963011%2FL%3D0Z73Qjk4LjE8FMpvUiz8OgB8NjYuMlIxMiP%5FjjWI%2FB%3DsI4U%2EWKL4HU%2D%2FJ%3D1378955811398703%2FK%3DGM4UO%5FjkBYEW4EvomQxI8Q%2FA%3D7540457405187064449%2FR%3D1%2FX%3D6%2F%2A%24&u=&P=pri%3ayahoo_mobile_us_web%3bsec%3ayahoo%3bcrr%3aUS-UNKNOWN%3b%7C0Z73Qjk4LjE8FMpvUiz8OgB8NjYuMlIxMiP_jjWI%7C954006766%7CWP%7C1378955811.398703&S=2658015051&i=1542970&D=smpv%3D3%26ed%3DzAomdEK4k1NDvJ5__oyLCdlumPoxa3FYwZ0cRfRJq0aHrw--&T=3&_salt=2529253075&t=2"></img></noscript></body></html>
Me too
Exact same thing keeps happening to me. I'm on the s3 though but the file is called st. It's only 8kb but it's really annoying and I have no idea what it is. The file had no extensions or anything on it either. This only started when I installed chrome beta. It downloads even if I don't have any tabs or anything open
iTzGavin96 said:
Exact same thing keeps happening to me. I'm on the s3 though but the file is called st. It's only 8kb but it's really annoying and I have no idea what it is. The file had no extensions or anything on it either. This only started when I installed chrome beta. It downloads even if I don't have any tabs or anything open
Click to expand...
Click to collapse
Yeah same here. No extension, I just opening it with the text tool to see it's contents.
Similar thing happens when you are on a download page and restart your phone or reopen chrome, it will start downloading the same file. Do you have a tab open that is downloading something? There's a url to a Yahoo answers page in your code and a url to an ad, did you click on an ad, and have that tab still open somewhere?
RichySamui said:
Similar thing happens when you are on a download page and restart your phone or reopen chrome, it will start downloading the same file. Do you have a tab open that is downloading something? There's a url to a Yahoo answers page in your code and a url to an ad, did you click on an ad, and have that tab still open somewhere?
Click to expand...
Click to collapse
nope, I do use Chrome Beta, and have (well, now had) only 1 tab open both instances.
ad.yieldmanager.com is some sort of tracking cookies, it probably came from programs you downloaded.
Recommendation is to install adsblocking app or uninstall ads ridden program. Or use AFWall+ and completely deny internet access to programs you don't trust.
sent from xda premium app

Apk mirror websites prevention

Hello everyone! I have a somewhat broad question(s) that I have some concerns about.
A recent search on the web revealed that many, if not all, of my apps published on Google Play are also being hosted on many, many apk mirror websites (such as ApkMania.com, or something like that along with PAGES of others). I like to stictly stick to Google Play for the distribution of my apps, and have not opted-in to distributing with 3rd parties, nor sharing my apps with anyone other than Google Play.
So my concerns/questions begin:
1) all of my apps are free, but have ads included in them so I can make a tiny bit of money from my hard work. Is it possible, or even more specifically, likely that my apps are being "hacked" or reverse-engineered to change the developer advertisement ID in which someone else would be getting revenue for my work? My apps are obfuscated so I'm sure it wouldn't be easy, but definitely not impossible.
2) I will begin checking the installer package name of my apps to make sure it is downloaded from Google Play. If it hasn't been, then the app(s) will show a dialog informing the user to download from Google Play, and close the app. Is there anything more that I can do to prevent this unwanted hosting?
3) Besides the above-mentioned, is there anything else I should be worried about?
I apologize if this is in the wrong section or is something I shouldn't be too concerned about, but I want my apps to ONLY be distributed through Google Play and was pretty frustrated when I found out that there were so many websites hosting my app. They would let you download directly from their website. If they redirected to Google Play, sure no problem. This is not the case :/
I would be much more concerned it these apps weren't free. I know this kind of stuff is bound to happen, but I would like to prevent/minimize it as much as possible.
Thank you for reading and your time. Any and all insight is appreciated. Cheers!
I haven't published an app yet and hopefully will publish one next month..
It is scary to read your experience.. do share anything you come across to minimize these things you have mentioned.. ( I would too if I see any article on this)
I will begin checking the installer package name of my apps to make sure it is downloaded from Google Play. If it hasn't been, then the app(s) will show a dialog informing the user to download from Google Play, and close the app
Click to expand...
Click to collapse
can you give a code example to do this?
ASIC SP said:
I haven't published an app yet and hopefully will publish one next month..
It is scary to read your experience.. do share anything you come across to minimize these things you have mentioned.. ( I would too if I see any article on this)
can you give a code example to do this?
Click to expand...
Click to collapse
I currently have 5 apps on the market (1st one was published in 2012) and have been learning on my own for about 4-5 years now, and just realized this unwanted hosting. It is a bit frightening in a way, but others have told me its "free hosting/marketing". I disagree since I opted out of 3rd party distribution. I know this stuff happens as with any other kind of digital goods though.
I am about to make a dialog class that will be easily put into any application that will do the above-mentioned (instruct the user to download from Google Play and close application) and will provide it here when it is complete It should be done in an hour or so, or at latest, tomorrow about the same time if I run into problems for some reason.
I wouldn't worry too much, just make sure you use proguard to obfuscate your code. There is documentation on the android developer website if you have questions about that. When/if you publish your app on Google Play, also opt-out of 3rd party marketing/distribution (if you so desire, it is with Google affiliates).
I'll post here again soon. Until then, happy coding!
Alright, it took a little longer than I anticipated, but this is satisfactory for my needs, simple yet effective.
@ASIC SP in your main activity, or Launcher activity (the one that starts when the application is opened)
Code:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final PackageManager pckManager = getPackageManager();
ApplicationInfo appInfo = null;
try {
appInfo = pckManager.getApplicationInfo(getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
// Check if your app was installed by Google Play
if (!"com.android.vending".equals(pckManager.getInstallerPackageName(appInfo.packageName))) {
//App was not installed by Google Play
// Create TextView with link
final TextView tvMessage = new TextView(this);
tvMessage.setText(R.string.dialog_message);
tvMessage.setMovementMethod(LinkMovementMethod.getInstance());
tvMessage.setGravity(Gravity.CENTER);
final AlertDialog alertDialog = new AlertDialog.Builder(this)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//Finish/close the activity when dialog is closed
finish();
}
})
.setTitle(getResources().getString(R.string.dialog_title))
.setView(tvMessage)
.create();
alertDialog.show();
} else {
//Do your normal stuff...
}
So this shows a dialog when the app is opened if the app was NOT installed by Google Play. I set the view of the dialog to a TextView because I have a link in the string resource that directs the user to the google play download page. The string resources i threw in there are as such:
Code:
<!-- Illegal download dialog -->
<string name="dialog_title">Illegal Download...</string>
<string name="dialog_message">This app was not downloaded from the Developer\'s desired distributor. Please download the correct application here</string>
Not really illegal, but at least it will get the user's attention
You will of course need to change this to your application's package name "https://play.google.com/store/apps/details?id=<your package name here>"
There are prettier ways of doing this, but this is a quick fix for me. Hope you can get some use of this, and anyone else are free to use this if they desire.
Happy Coding!
thanks
I suppose you can share it on github (that is what I see everyone doing when they have code stuff to share)
ASIC SP said:
thanks
I suppose you can share it on github (that is what I see everyone doing when they have code stuff to share)
Click to expand...
Click to collapse
Yeah but that's usually for entire projects though, this is only a few lines of code
I plan on making a dialog class out of it so it is easier to import to my other projects later on, so I may do it then.
Until I figure out why this happened and if its potentially harmful, I'm adding this to every app I publish. Good luck on your apps!
MattMatt0240 said:
Yeah but that's usually for entire projects though, this is only a few lines of code
I plan on making a dialog class out of it so it is easier to import to my other projects later on, so I may do it then.
Until I figure out why this happened and if its potentially harmful, I'm adding this to every app I publish. Good luck on your apps!
Click to expand...
Click to collapse
Thanks and good luck to you too

Categories

Resources