getPackageName() in Fragment
Here's to get package name for Kotlin in a Fragment
context!!.packageName
Try this instead of getPackageName()
getActivity().getPackageName()
BuildConfig.APPLICATION_ID
The easiest way is probably:
String PkgName = BuildConfig.APPLICATION_ID
Notes:
- You can access
BuildConfig
from anywhere on your code. - Doesn't work on libraries