Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to register application class in manifest file?

How to register my application class in my android manifest? I have looked at many tutorials online and still can not get it right. My application class is called Monitor.java. How do I register it in the Manifest file code below?

<manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.example.project"     android:versionCode="1"     android:versionName="1.0" >  <application     android:allowBackup="true"     android:debuggable="true"     android:icon="@drawable/ic_launcher"     android:label="xyz"     android:screenOrientation="landscape"     android:theme="@style/AppTheme" >      <service         android:name=".AudioService"         android:icon="@drawable/ic_launcher"         android:label="audioservice" >     </service>      <activity         android:name=".MainActivity"         android:screenOrientation="landscape" >         <intent-filter>             <action android:name="android.intent.action.MAIN" />              <category android:name="android.intent.category.LAUNCHER" />         </intent-filter>     </activity>      <activity         android:name=".Editor"         android:screenOrientation="landscape"         android:windowSoftInputMode="stateHidden" >         <intent-filter>             <action android:name="com.example.project.EDITOR" />              <category android:name="android.intent.category.DEFAULT" />         </intent-filter>     </activity>  </application> 

like image 221
Kevik Avatar asked Dec 19 '12 09:12

Kevik


People also ask

How would you define application class in manifest?

If it derives from Application, add the fully qualified (namespace + class name) as the android:name parameter of the application element in your manifest. The documentation says "fully qualified name".

How do I register my manifest service?

You declare a service in your app's Manifest, by adding a <service> element as a child of your <application> element. There's a list of attributes that you can use to control a service's behavior, but as a minimum you'll need to provide the service's name (android:name) and a description (android:description).

Where is the application manifest file?

Every project in Android includes a Manifest XML file, which is AndroidManifest. xml, located in the root directory of its project hierarchy. The manifest file is an important part of our app because it defines the structure and metadata of our application, its components, and its requirements.


2 Answers

<application         android:name="package.YourApplicationClass"  <--------         android:allowBackup="true"         android:debuggable="true"         android:icon="@drawable/ic_launcher"         android:label="xyz"         android:screenOrientation="landscape"         android:theme="@style/AppTheme"> 
like image 171
frayab Avatar answered Sep 21 '22 09:09

frayab


Try this:

 <application android:icon="@drawable/icon"         android:label="@string/app_name"         android:name="Monitor"> 

See the good reference link below :

How to use the Application object of Android

Thanks.

like image 30
Pratik Sharma Avatar answered Sep 23 '22 09:09

Pratik Sharma