I'm writing an android application.
It has some packages under src
.
how can I figure out which of them is my application package?
I want to add C@DM permissions:
<permission android:name="YOUR_PACKAGE_NAME.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="YOUR_PACKAGE_NAME.permission.C2D_MESSAGE" />
how will my YOUR_PACKAGE_NAME
change if I create a custom MyApplication extends Application
class?
One method to look up an app's package name is to find the app in the Google Play app store using a web browser. The package name will be listed at the end of the URL after the '? id='.
A simple solution would be Open Android Studio -> Build -> Analyze Apk... browse and select the APK now you can find the package name and pretty much you can read. Show activity on this post. You can use Analyze APK... from the Build menu in Android Studio, it will display the package name at the top of new window.
The package for each android application resides within the src/main/java directory of the application module.
The applicationId exactly matches the Java-style package name you chose during project setup in android studio. However, the application ID and package name are independent of each other beyond this point.
Your application name is actually defined in the AndroidManifest.xml, in its first lines. Ex:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yourcompany.appname"
android:versionCode="66"
android:versionName="0.57" >
note the package="com.yourcompany.appname" - this is your package definition.
Other places which contain your package name can be resources, class paths, packages and much more. But all of them should be aligned according to the manifest because that what the package manager reads.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With