O
O
Oleg Sheshin2011-02-15 23:04:53
Android
Oleg Sheshin, 2011-02-15 23:04:53

How to get apk link in android market

Hello!

Can you please tell me how to get a similar link market://search?q=pname:com.songbirdnest.mediaplayer?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
destel, 2011-02-16
@destel

I understand that you need to programmatically download the apk file. It's difficult, but possible.
The download itself is done using a simple http request , here asset_id is the internal identifier of the program in the market. Variables market_da, user_id, device_id, as you might guess, identify the user and the phone. The only way I know of to get them is to tcpdump the real phone when it downloads an apk and see what it sends. You can get asset_id using various unofficial APIs like code.google.com/p/android-market-api/ or code.google.com/p/android-market-api-php/
$user_id = '0000000000000000';
$market_da = '0000000000000000000';
$device_id = '000000000000000000';
$asset_id = '1234567';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://android.clients.google.com/market/download/Download?assetId=$asset_id&userId=$user_id&deviceId=$device_id");
curl_setopt($ch, CURLOPT_COOKIE, "MarketDA=$market_da");
curl_setopt($ch, CURLOPT_USERAGENT, "AndroidDownloadManager");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Keep-Alive'));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 250);
$data = curl_exec($ch);

using the API, we do a search by package_name, we get information about the program, including assetId (if I'm not mistaken, this variable is simply called id in the objects returned via the API).
This method does not work for copy-protected programs (their phone downloads via https and it is not clear what it sends) and for programs that are not available in the phone market. Those. if the phone is Ukrainian, then part of the prog in the market is not visible and for them the script will return an error.

S
ShaDaL, 2011-02-15
@ShaDaL

Find the program in the market, for example market.android.com/details?id=com.songbirdnest.mediaplayer and copy the package name com.songbirdnest.mediaplayer. Well, then substitute in your link after the pname parameter:

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question