android - Force an activity to remain in memory -


i have implemented in app billing in game. using unity3d our game development engine . in app billing work wrote java native plugin handles in app billing jobs , send messages unity application when purchase done. way implemented start activity handle billing tasks , finish activity after tasks done return unity app. problem in devices(specially low ram) unity app closed when billing activity started . when user purchase item our listeners in unity app no longer valid , unity app restarted. can't give them item bought (it's consumed).

so question is there way force unity app remain untouched while billing activity running ?

my code fires billing activity:

public static void buy(string sku,string developerpayload,boolean consumable) {     intent buyintent = new intent(gameactivity,myketactivity.class);     buyintent.putextra("operation", "purchase");     buyintent.putextra("sku", sku);     buyintent.putextra("payload", developerpayload);     buyintent.putextra("consumable", consumable);      gameactivity.startactivityforresult(buyintent, 8586);  }   //the billing activity's oncreate protected void oncreate(bundle bundle) {     string operation = getintent().getstringextra("operation");     super.oncreate(bundle);      if(!firsttime)     {         mykethelper.log("not first time");         finish();         return;     }      if(operation.equals("purchase"))     {         if(mykethelper.helper==null)         {             finish();             return;         }          mykethelper.log("purchase flow launched");         sku = getintent().getstringextra("sku");         payload = getintent().getstringextra("payload");         consumeable = getintent().getbooleanextra("consumable", true);          mykethelper.helper.launchpurchaseflow(this, sku, 8585, onpurchase);      }   } 


Comments