Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get main applicationId inside code in the library module?

Tags:

android

gradle

I have library module where I'd like to starService through Intent(String). When I set:

Intent intent1 = new Intent(BuildConfig.APPLICATION_ID + ".REFRESH_DATA");

My BuildConfig.APPLICATION_ID is a library package. I need a variable in my code which will be populated with the main app package.

like image 803
AppiDevo Avatar asked Feb 04 '23 21:02

AppiDevo


1 Answers

Just use context.getPackageName().

https://developer.android.com/studio/build/application-id#change_the_package_name

like image 138
GB Lam Avatar answered Apr 30 '23 11:04

GB Lam