0

Is there a way to add my application to homescreen through Android Studio on "Run" action? Maybe with adb?

I don't want to code it to add the icon on normal installation, only when it happens through Android Studio "Run" option - as I only need it for developing reasons.


I already checked this question and consequently this one too, but I don't want it to happen every single time (as in from any installation of my app), but only when developing.

Is it possible?

FirstOne
  • 6,033
  • 7
  • 26
  • 45

1 Answers1

0

I dont think its possible to see if app runned by android studio it self ?

  • if its for debugging reasons cant you remove code after release ?

Possible answer:

  • when you run by android studio RUN its default Debug mode
  • when you publish your app you must set into Release mode

How to Detect if I am in release or debug mode in android ?

if (BuildConfig.DEBUG) {
  // do something for a debug build
}

based on Detect if I am in release or debug mode in android

UPDATE

if you think its hard to remove all dev only stuff from your code put them in

boolean devmode=true;
//----
if(devmode){
 //my dev only stuff
}
//----

So you can easily switch between dev and release

i use this way always maybe you can use too

Azrideus
  • 85
  • 2
  • 13
  • It's not really about checking if run by AS, but maybe a configuration to auto-execute something at run command. Anyways, I'll be able to explore your suggestion more in depth later. Thanks for now ^^ – FirstOne Feb 21 '18 at 12:10
  • Btw, removing code pre-release seems like a way to mess things up. Maybe not in this case, but I'm not sure I would personally advise it. – FirstOne Feb 21 '18 at 12:11
  • when i wanted to debug my app with Logs i made a function named LOG with string input there was a if in it to see if devmode bool is true or false then log the data if that was true – Azrideus Feb 21 '18 at 12:41