Reputation: 2198
I am going to create application like Google Play Store. I want to retrieve a list of apps like free apps, paid apps, categorized apps (Social, Entertainment, Business, etc.) from the Android Market and process it to be displayed on my application screen.
I don't know how to get the list of app details from the Google Play Store. Please suggest ideas, URLs (to guides), or code snippets to list app details.
Help me. Thank you in advance.
I tried like this
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try {
login = (Button) findViewById(R.id.login);
mailid = (EditText) findViewById(R.id.username);
number = (EditText) findViewById(R.id.password);
login.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { // TODO Auto-generated
email = mailid.getText().toString();
password = number.getText().toString();
try {
Backgroundprocess Task1 = new Backgroundprocess();
try {
Task1.execute();
} catch (Exception e) {
// TODO: handle exception
e.getStackTrace();
}
} catch (Exception e) {
// TODO: handle exception
e.getStackTrace();
Log.d(tag1, e.toString());
}
}
});
} catch (Exception e) {
// TODO: handle exception
e.getStackTrace();
Log.d(tag2, e.toString());
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
private class Backgroundprocess extends AsyncTask<String, Void, Void> {
protected void onPostExecute(final Void unused) {
}
@Override
protected Void doInBackground(String... params) {
// TODO Auto-generated method stub
try {
MarketSession session = new MarketSession();
String android_id = Secure.getString(getBaseContext()
.getContentResolver(), Secure.ANDROID_ID);
session.login(email, password);
session.getContext().setAndroidId(android_id);
String query = "maps";
AppsRequest appsRequest = AppsRequest.newBuilder()
.setQuery(query).setStartIndex(0).setEntriesCount(2)
.setWithExtendedInfo(true).build();
session.append(appsRequest, new Callback<AppsResponse>() {
@Override
public void onResult(ResponseContext context,
AppsResponse response) {
// Your code here
// response.getApp(0).getCreator() ...
// see AppsResponse class definition for more infos
}
});
session.flush();
} catch (Exception e) {
// TODO: handle exception
e.getStackTrace();
Log.d(tag3, e.toString());
}
return null;
}
}
log cat file
01-04 12:00:08.015: D/AndroidRuntime(2668): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
01-04 12:00:08.015: D/AndroidRuntime(2668): CheckJNI is OFF
01-04 12:00:08.645: D/AndroidRuntime(2668): Calling main entry com.android.commands.pm.Pm
01-04 12:00:08.675: D/AndroidRuntime(2668): Shutting down VM
01-04 12:00:08.705: D/dalvikvm(2668): GC_CONCURRENT freed 101K, 78% free 464K/2048K, paused 0ms+1ms
01-04 12:00:08.705: D/dalvikvm(2668): Debugger has detached; object registry had 1 entries
01-04 12:00:08.715: I/AndroidRuntime(2668): NOTE: attach of thread 'Binder Thread #3' failed
01-04 12:00:09.285: D/AndroidRuntime(2681): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
01-04 12:00:09.285: D/AndroidRuntime(2681): CheckJNI is OFF
01-04 12:00:09.915: D/AndroidRuntime(2681): Calling main entry com.android.commands.am.Am
01-04 12:00:09.945: I/ActivityManager(167): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
flg=0x10000000 cmp=com.market/.MainActivity} from pid 2681
01-04 12:00:09.955: D/ViewRootImpl(167): pckname = com.market
01-04 12:00:10.015: D/AndroidRuntime(2681): Shutting down VM
01-04 12:00:10.035: D/dalvikvm(2681): GC_CONCURRENT freed 102K, 77% free 487K/2048K, paused 1ms+10ms
01-04 12:00:10.045: D/jdwp(2681): Got wake-up signal, bailing out of select
01-04 12:00:10.045: D/dalvikvm(2681): Debugger has detached; object registry had 1 entries
01-04 12:00:10.045: I/AndroidRuntime(2681): NOTE: attach of thread 'Binder Thread #3' failed
01-04 12:00:10.105: D/OpenGLRenderer(380): Flushing caches (mode 1)
01-04 12:00:10.115: D/OpenGLRenderer(380): Flushing caches (mode 0)
01-04 12:00:10.155: D/ViewRootImpl(2550): pckname = com.market
01-04 12:00:10.515: I/Process(167): Sending signal. PID: 2550 SIG: 3
01-04 12:00:10.515: I/dalvikvm(2550): threadid=3: reacting to signal 3
01-04 12:00:10.525: I/dalvikvm(2550): Wrote stack traces to '/data/anr/traces.txt'
01-04 12:00:10.555: I/ActivityManager(167): Displayed com.market/.MainActivity: +546ms
01-04 12:00:19.685: I/WindowManager(167): MediaPlayer.is not PlayingVideo
01-04 12:00:19.835: I/WindowManager(167): MediaPlayer.is not PlayingVideo
01-04 12:00:20.335: D/dalvikvm(337): GC_CONCURRENT freed 422K, 8% free 7932K/8583K, paused 2ms+7ms
01-04 12:00:43.885: D/dalvikvm(233): GC_CONCURRENT freed 430K, 9% free 7855K/8583K, paused 2ms+3ms
01-04 12:00:46.945: D/dalvikvm(1486): GC_CONCURRENT freed 459K, 11% free 7308K/8135K, paused 2ms+21ms
01-04 12:00:47.115: D/dalvikvm(167): GC_CONCURRENT freed 799K, 21% free 10373K/13127K, paused 4ms+8ms
01-04 12:00:55.965: D/dalvikvm(337): GC_CONCURRENT freed 544K, 9% free 7842K/8583K, paused 2ms+9ms
01-04 12:00:58.125: D/audio_hw_primary(86): start_output_stream: card:0, port:0, rate:44100
01-04 12:00:59.785: D/(2550): java.lang.RuntimeException: java.lang.RuntimeException: Response code = 400, msg = Bad
Request
01-04 12:01:00.425: I/WindowManager(167): MediaPlayer.is not PlayingVideo
01-04 12:01:00.435: I/InputReader(167): Reconfiguring input devices. changes=0x00000004
01-04 12:01:00.435: I/InputReader(167): Device reconfigured: id=2, name='ft5x_ts', surface size is now 800x480, mode is 1
01-04 12:01:00.445: I/ActivityManager(167): Config changed: {1.0 0mcc0mnc en_US layoutdir=0 sw480dp w800dp h432dp nrml
land finger -keyb/v/h -nav/h s.16}
01-04 12:01:00.515: I/StatusBar.HeightReceiver(233): Resizing status bar plugged=false height=48 old=48
01-04 12:01:00.515: D/OpenGLRenderer(2550): Flushing caches (mode 0)
01-04 12:01:00.595: D/ViewRootImpl(2550): pckname = com.market
01-04 12:01:01.245: I/WindowManager(167): MediaPlayer.is not PlayingVideo
01-04 12:01:01.255: I/InputReader(167): Reconfiguring input devices. changes=0x00000004
01-04 12:01:01.255: I/InputReader(167): Device reconfigured: id=2, name='ft5x_ts', surface size is now 800x480, mode is 1
01-04 12:01:01.835: I/WindowManager(167): MediaPlayer.is not PlayingVideo
01-04 12:01:03.425: D/dalvikvm(167): GC_EXPLICIT freed 256K, 22% free 10342K/13127K, paused 3ms+7ms
01-04 12:01:03.855: I/WindowManager(167): MediaPlayer.is not PlayingVideo
01-04 12:01:03.855: I/InputReader(167): Reconfiguring input devices. changes=0x00000004
01-04 12:01:03.855: I/InputReader(167): Device reconfigured: id=2, name='ft5x_ts', surface size is now 800x480, mode is 1
01-04 12:01:03.875: I/ActivityManager(167): Config changed: {1.0 0mcc0mnc en_US layoutdir=0 sw480dp w480dp h752dp nrml
port finger -keyb/v/h -nav/h s.17}
01-04 12:01:03.895: D/OpenGLRenderer(2550): Flushing caches (mode 0)
01-04 12:01:03.925: I/StatusBar.HeightReceiver(233): Resizing status bar plugged=false height=48 old=48
01-04 12:01:04.025: D/ViewRootImpl(2550): pckname = com.market
01-04 12:01:04.635: I/WindowManager(167): MediaPlayer.is not PlayingVideo
01-04 12:01:06.275: D/dalvikvm(167): GC_EXPLICIT freed 52K, 22% free 10326K/13127K, paused 3ms+7ms
01-04 12:01:14.545: I/WindowManager(167): MediaPlayer.is not PlayingVideo
01-04 12:01:17.315: I/WindowManager(167): MediaPlayer.is not PlayingVideo
01-04 12:01:18.805: I/WindowManager(167): MediaPlayer.is not PlayingVideo
01-04 12:01:41.905: I/WindowManager(167): MediaPlayer.is not PlayingVideo
01-04 12:01:45.685: I/WindowManager(167): MediaPlayer.is not PlayingVideo
01-04 12:01:46.975: D/dalvikvm(2313): GC_CONCURRENT freed 418K, 8% free 7430K/8007K, paused 2ms+2ms
01-04 12:01:49.535: I/WindowManager(167): MediaPlayer.is not PlayingVideo
01-04 12:01:59.605: I/WindowManager(167): MediaPlayer.is not PlayingVideo
01-04 12:02:04.005: I/WindowManager(167): MediaPlayer.is not PlayingVideo
01-04 12:02:07.505: I/WindowManager(167): MediaPlayer.is not PlayingVideo
01-04 12:02:12.595: I/WindowManager(167): MediaPlayer.is not PlayingVideo
01-04 12:02:16.305: I/WindowManager(167): MediaPlayer.is not PlayingVideo
01-04 12:02:20.565: I/WindowManager(167): MediaPlayer.is not PlayingVideo
01-04 12:02:23.825: I/WindowManager(167): MediaPlayer.is not PlayingVideo
Upvotes: 3
Views: 884
Reputation: 128428
Sorry, officially there is no API available to fetch apps or any data from play store.
But here is an unofficial Android Market API.
Update:
Check some existing threads:
Upvotes: 2