Hi I am trying to make an app that opens android market page of selected app & lets user download it.I have used below intent to open market.
Intent intent = new Intent (Intent.ACTION_VIEW);
intent.setData (Uri.parse ("market://details?id=" + PackageName ));
intent.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityForResult (intent, 13);
but I always get resultcode 0 in onActivityResult.StackTrace says:
I/ActivityManager( 79): Starting activity: Intent { act=android.intent.action.VIEW dat=market://details?id=com.google.android.apps.unveil flg=0x10000000 cmp=com.an
droid.vending/.AssetInfoActivity }
W/ActivityManager( 79): Activity is launching as a new task, so cancelling activity result.
What I want is that market returns me some response that user downloaded the app or just cancelled.
EDIT:@CommonsWare I am trying to access added package here But cant figure what should be key to get packagename from extras of ACTION_PACKAGE_ADDED
public class ServiceReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
//Do this when the system sends the intent
Bundle b = intent.getExtras();
String packagename = b.get(?); //cant figure what should be key to get packagename //from extras
}
}