FORUMS

Analysis & Opinion

Top Forum Discussions

[Extension] Updated version of the APK Downloader Chrome Extension

630 posts
Thanks Meter: 1,126
 
Post Reply Subscribe to Thread Email Thread
13th August 2012, 09:58 PM |#21  
Bexton's Avatar
OP Senior Member
Flag 50° 56' 33" 6° 57' 32"
Thanks Meter: 1,126
 
More
Quote:
Originally Posted by XlAfbk

I tried modding the extension but for some reason it even fails with localhost instead of this thread, just replacing the 1 line containing the url *confused* (not a chrome extension guy so probably missing something there. more of a web dev)
Maybe if you'd explain why that is and why it needs some site in the first place I'd be able to figure it out.

You need to change two files. The "match"-url for the content script in manifest.json, needs to match the url for the chrome.tabs.create call in main.js:

1.) manifest.json
Code:
"content_scripts": [
  {
    "matches": ["http://forum.xda-developers.com/showthread.php?t=1809458&download=apk*"],
    "js": ["download.js"]
  },
2.) main.js
Code:
executeRawHttpsQuery:function(c) {
  chrome.tabs.create({url:"http://forum.xda-developers.com/showthread.php?t=1809458&download=apk#" + c})
}};
 
 
13th August 2012, 10:29 PM |#22  
XlAfbk's Avatar
Senior Member
Thanks Meter: 335
 
More
doh. I greped *.js only ...
hm, i see, a page needs to be opened because chrome extensions can only inject scripts into existing pages so to be able to call the function it needs a tab. will have to learn about chrome extensions to try to change that i guess.
13th August 2012, 10:49 PM |#23  
Bexton's Avatar
OP Senior Member
Flag 50° 56' 33" 6° 57' 32"
Thanks Meter: 1,126
 
More
Quote:
Originally Posted by XlAfbk

doh. I greped *.js only ...
hm, i see, a page needs to be opened because chrome extensions can only inject scripts into existing pages so to be able to call the function it needs a tab. will have to learn about chrome extensions to try to change that i guess.

more exactly, the page doesn't need to exist. but you need any URL as a "trigger" to call the content script (eg download script). however, I just had an idea. It may be possible to reload the actual play store url and append the hash key to that URL. Let me check on that..
13th August 2012, 11:06 PM |#24  
Bexton's Avatar
OP Senior Member
Flag 50° 56' 33" 6° 57' 32"
Thanks Meter: 1,126
 
More
Okay, it works! I will upload an updated version. Instead of open a new tab with this thread it will just reload the Play Store Url and start the download.
13th August 2012, 11:34 PM |#25  
Bexton's Avatar
OP Senior Member
Flag 50° 56' 33" 6° 57' 32"
Thanks Meter: 1,126
 
More
APK Downloader 1.3.2

Changelog
This version will no longer open a new tab.
Instead, it will reload the Play Store Url within the same tab in which you clicked on the extension icon and start the download.
Attached Files
File Type: zip apkdownloader-bexmod-1.3.2.zip - [Click for QR Code] (42.7 KB, 1224 views)
14th August 2012, 12:38 AM |#26  
Felimenta97's Avatar
Senior Member
Flag Ribeirão Preto
Thanks Meter: 2,333
 
More
Well, it doesn't work at all here. It quickly gives a sign the page is reloading but nothing changes, and there is only a small white box below the APK downloader icon...
14th August 2012, 01:38 AM |#27  
Bexton's Avatar
OP Senior Member
Flag 50° 56' 33" 6° 57' 32"
Thanks Meter: 1,126
 
More
Quote:
Originally Posted by Felimenta97

Well, it doesn't work at all here. It quickly gives a sign the page is reloading but nothing changes, and there is only a small white box below the APK downloader icon...

Okay, sorry for the mess. But that's when you working with somebody else's code. I re-wrote the extension a clean way and reduced the number of files from 16 to 12. Everything should work now as expected with the 1.3.2 release.

Means: By clicking on the page action icon (the market case), the current page in your browser will reload the same URL (+ &download=apk#SOMEHASHKEY) and start the download.

I've tested it with about 20 apks and it worked out without any issues. But please leave some feedback to ensure it is working for "all" chrome versions.
14th August 2012, 01:40 AM |#28  
Bexton's Avatar
OP Senior Member
Flag 50° 56' 33" 6° 57' 32"
Thanks Meter: 1,126
 
More
APK Downloader 1.3.3

Changelog
* Fixed redirect bug (introduced in 1.3.2)
* Major code clean up
Attached Files
File Type: zip apkdownloader-bexmod-1.3.3.zip - [Click for QR Code] (43.1 KB, 1132 views)
14th August 2012, 02:02 AM |#29  
Felimenta97's Avatar
Senior Member
Flag Ribeirão Preto
Thanks Meter: 2,333
 
More
I will try tomorrow night (it's night now, so a little less than 24 hours from now)

Sent from my LT26i with Tapatalk 2
14th August 2012, 03:18 AM |#30  
Member
Thanks Meter: 9
 
More
Still doesn't work for me, it doesn't download anything even for those I can get via market in Android on my tablet.
14th August 2012, 08:55 AM |#31  
XlAfbk's Avatar
Senior Member
Thanks Meter: 335
 
More
Quote:
Originally Posted by ytain

Still doesn't work for me, it doesn't download anything even for those I can get via market in Android on my tablet.

I'd guess you missed the last step of the instructions: "However, you need to follow 1 more step to actually use it; you need to disable SSL warnings. Therefore please read on at the original APK Downloader page at: http://codekiem.com/2012/02/24/apk-downloader/"

@Bexton: imho it should be possible to eliminate the need for some page to be opened completly:
put requestAsset() in background.js
replace chrome.tabs.update() with requestAssets() call
send all the stuff that's currently handled with cookies directly in that call

I tried doing it but I just can't figure out Chromes dev tools. Didn't even find where to view the extensions scripts in the dev tools. And using alerts for that kind of stuff is pretty annoying

Oh, and main.js can be removed from the package as well, it's not called anywhere.
Last edited by XlAfbk; 14th August 2012 at 09:29 AM.
The Following User Says Thank You to XlAfbk For This Useful Post: [ View ]

Read More
Post Reply Subscribe to Thread

Tags
apk downloader

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes