简体   繁体   中英

Add Icon to homescreen only when run by Android Studio

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM