what's my application package name in android?

android, java, manifest

Solution

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.

Problem

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?

Original source