How do i declare my Activity as Launcher? - android

I am trying to build a kind of custom lockscreen.
In order to achieve that I need to disable the HOME button.
From this post I understand that I can achieve that by declaring my Activity as a Launcher.
Please how do I do that? (it is in the Manifest obviously)
This is the Manifest.
The Activity that "acts" as a lockscreen is LockScreen
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.appengine.paranoid_android.lost"
android:versionCode="2"
android:versionName="1.1" >
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".InfoSetup"
android:clearTaskOnLaunch="true"
android:label="#string/activity_name"
android:launchMode="singleTask" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".LockScreen"
android:clearTaskOnLaunch="true"
android:label="#string/activity_name"
android:launchMode="singleInstance"
android:theme="#android:style/Theme.NoTitleBar" >
<service
android:name=".InfoService"
android:label="#string/service_name" />
<receiver android:name="com.appengine.paranoid_android.lost.BootCompleteReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_CHANGED" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<data android:scheme="package" />
</intent-filter>
</receiver>
</activity>
</application>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<!-- <uses-permission android:name="android.permission.DISABLE_KEYGUARD"/> -->
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" >
</uses-sdk>

Move the intent filter to your activity
<activity
android:name=".LockScreen"
android:clearTaskOnLaunch="true"
android:label="#string/activity_name"
android:launchMode="singleInstance"
android:theme="#android:style/Theme.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Related

Supported devices is 0-Google play

Manifest:
This was working fine before some time. Now it shows 0-supported devices!
Please help me on this.
Shows these features on console though I am not using it.
android.hardware.screen.PORTRAIT
android.hardware.TOUCHSCREEN
android.hardware.WIFI
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.app.irb.wallpro"
android:versionCode="5"
android:versionName="1.0.5" >
<uses-sdk
android:minSdkVersion="8"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!-- Include next permission if you want to allow UIL to cache images on SD card -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<application
android:name="com.irbrothers.wallpro.ui.WallProApplication"
android:allowBackup="true"
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.irbrothers.wallpro.ui.SplashActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.irbrothers.wallpro.ui.PropertiesActivity"
android:configChanges="orientation"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.irbrothers.wallpro.ui.HomeActivity"
android:configChanges="orientation|screenSize"
android:launchMode="singleTask" >
</activity>
<activity
android:name="com.irbrothers.wallpro.ui.EULA"
android:configChanges="orientation|screenSize"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.irbrothers.wallpro.ui.AboutActivity"
android:configChanges="orientation"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar"
android:windowSoftInputMode="adjustPan" >
</activity>
<activity
android:name="com.startapp.android.publish.list3d.List3DActivity"
android:taskAffinity="com.app.irbrothers.wallpro.AppWall"
android:theme="#android:style/Theme" />
<activity
android:name="com.startapp.android.publish.AppWallActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:taskAffinity="com.app.irbrothers.wallpro.AppWall"
android:theme="#android:style/Theme.Translucent" />
<service android:name="com.irbrothers.wallpro.alarm.NotificationService" />
<receiver android:name="com.irbrothers.wallpro.recievers.NotificationAlarmReciever" >
<intent-filter>
<action android:name="com.irbrothers.notification" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.DATE_CHANGED" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.TIMEZONE_CHANGED" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.TIME_SET" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.TIME_TICK" />
</intent-filter>
</receiver>
</application>
</manifest>
Solved
Do not use any library which is already present in framework. Ex: "json-simple" here.

how to set two diffrent launcher name and icon in one app (android)

i am working on an app in witch i am performing two launches from one installation. my both launcher are working fine for there separate individual tasks.
but my problem is: i am getting same name or same icon for both launcher.
i want two different icon and name for both launchers.
this is my manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="info.androidhive.awesomewallpapers"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!-- Start Wallpaper App -->
<application
android:name="info.androidhive.awesomewallpapers.app.AppController"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/FreeWallTheme" >
<activity
android:name="info.androidhive.awesomewallpapers.SplashActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="info.androidhive.awesomewallpapers.MainActivity"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="info.androidhive.awesomewallpapers.FullScreenViewActivity"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="info.androidhive.awesomewallpapers.SettingsActivity"
android:label="#string/action_settings"
android:screenOrientation="portrait" >
</activity>
<!-- End Wallpaper App -->
<!-- Start Crop App -->
<activity
android:name="info.androidhive.awesomewallpapers.CropWallpaper.FolderListScreen"
android:configChanges="orientation|keyboard|keyboardHidden|screenLayout|fontScale|screenSize"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT" />
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.OPENABLE" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
<activity
android:name="info.androidhive.awesomewallpapers.CropWallpaper.ImageListScreen"
android:configChanges="orientation|keyboard|keyboardHidden|screenLayout|fontScale|screenSize"
android:label="#string/app_name" >
</activity>
<activity
android:name="info.androidhive.awesomewallpapers.CropWallpaper.MyPrefScreen"
android:configChanges="orientation|keyboard|keyboardHidden|screenLayout|fontScale"
android:label="#string/app_name" >
</activity>
<activity
android:name="info.androidhive.awesomewallpapers.CropWallpaper.CropWallpaper"
android:configChanges="keyboard|keyboardHidden|fontScale"
android:label="#string/app_name"
android:process=":CropWallpaper" >
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
<!--End Crop App -->
</application>
</manifest>
as the document says, you can provide android:icon attribute in activity tag for the two launchers. It will override that provided in application tag. And for the name of launcher, just set android:label to different string resource.
Currently you only provide an Icon in application tag and android:label for the two activities are the same resource, so you will see same icon and same label.

How do I properly specify my starting activity in the android manifest?

This is my android manifest and for some reason my MainActivity does not start first. The activity that starts first whenever I run the application is RegisterActivity. Can anyone help me figure out why?
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.indigohate"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<permission
android:name="com.indigohate.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.indigohate.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<service android:name="com.indigohate.GCMIntentService" />
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.indigohate" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.indigohate" />
</intent-filter>
</receiver>
<activity
android:name="com.indigohate.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.indigohate.RegisterActivity"
android:launchMode="singleTop" />
<activity
android:name="com.indigohate.UserRegister"
android:launchMode="singleTop" />
<activity
android:name="com.indigohate.LoginActivity"
android:launchMode="singleTop" >
</activity>
<activity
android:name="com.indigohate.RideRequest"
android:label="#string/title_activity_ride_request" >
</activity>
<activity
android:name="com.indigohate.TimePickerFragment"
android:label="#string/title_activity_time_picker_fragment" >
</activity>
<activity
android:name="com.indigohate.SearchResultsListActivity"
android:launchMode="singleTop" />
<activity
android:name="com.indigohate.LoadingScreenActivity"
android:label="#string/title_activity_loading_screen" >
</activity>
<activity
android:name="com.indigohate.HomeActivity"
android:label="#string/title_activity_home" >
</activity>
<activity
android:name="com.indigohate.LostPasswordActivity"
android:label="#string/title_activity_lost_password" >
</activity>
<activity
android:name="com.indigohate.RideOfferActivity"
android:label="#string/title_activity_ride_offer" >
</activity>
<activity
android:name="com.indigohate.StartRideActivity"
android:label="#string/title_activity_start_ride" >
</activity>
<activity
android:name="com.indigohate.StopRideActivity"
android:label="#string/title_activity_stop_ride" >
</activity>
<activity
android:name="com.indigohate.CalendarActivity"
android:label="#string/title_activity_calendar" >
</activity>
<activity
android:name="com.indigohate.ProfileActivity"
android:label="#string/title_activity_profile" >
</activity>
<activity
android:name="com.indigohate.MakeCommentActivity"
android:label="#string/title_activity_make_comment" >
</activity>
<activity
android:name="com.indigohate.PaymentInformationActivity"
android:label="#string/title_activity_payment_information" >
</activity>
<activity
android:name="com.indigohate.RideHistoryActivity"
android:label="#string/title_activity_ride_history" >
</activity>
</application>
</manifest>
It's because you kept this attribute in your RegisterActivity
android:launchMode="singleTop"
Remove all these launchmodes in all activities. Keep it only in your MainActivity:
<activity
android:name="com.indigohate.MainActivity"
android:label="#string/app_name"
android:launchMode="singleTop"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
The starting activity contains <category android:name="android.intent.category.LAUNCHER" /> to ensure that it's a launcher activity when an app starts.

AndroidManifest.xml: The markup in the document preceding the root element must be well-formed

I'm unable to sort out the problem.I have two manifest tags in xml.
I am getting the Following error:
AndroidManifest.xml: The markup in the document preceding the root element must be well-formed.
I have searched for the error and got a solution that there are two manifest tag in code.If it is due to 2 manifest tag which should i comment?OR its due to something else?
Here is my androidmanifest.xml
<<<<<<< Original
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.github.andlyticsproject"
android:installLocation="auto"
android:versionCode="217"
android:versionName="2.2.3" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.READ_SYNC_STATS" />
<uses-permission android:name="android.permission.WRITE_SYNC_STATS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="16" />
<application
android:name="AndlyticsApp"
android:allowBackup="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:theme="#style/Theme.Andlytics" >
<activity
android:name=".LoginActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Main"
android:label="#string/app_name"
android:uiOptions="splitActionBarWhenNarrow" >
</activity>
<activity
android:name=".CommentsActivity"
android:label="#string/comments" >
</activity>
<activity
android:name=".ChartActivity"
android:label="#string/app_name" >
</activity>
<activity
android:name=".AdmobActivity"
android:label="#string/app_name_admob" >
</activity>
<activity
android:name=".AdmobAuthenticatorActivity"
android:excludeFromRecents="true"
android:label="#string/app_name_admob"
android:theme="#android:style/Theme.Dialog" />
<activity
android:name=".PreferenceActivity"
android:label="#string/preferences" >
</activity>
<activity
android:name=".NotificationPreferenceActivity"
android:label="#string/notifications" >
</activity>
<activity
android:name=".AccountSpecificPreferenceActivity"
android:label="#string/notifications" >
</activity>
<activity
android:name=".ImportActivity"
android:label="#string/statistics_import"
tools:ignore="ExportedActivity" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="*"
android:mimeType="application/zip"
android:pathPattern="andlytics\\.zip"
android:scheme="file" />
</intent-filter>
<!-- intent-filter android:priority="-100" -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:mimeType="application/zip"
android:scheme="file" />
</intent-filter>
</activity>
<activity
android:name=".ExportActivity"
android:label="#string/statistics_export" >
</activity>
<service
android:name=".sync.SyncAdapterService"
android:exported="false"
android:process=":andlytics" >
<intent-filter>
<action android:name="android.content.SyncAdapter" />
</intent-filter>
<meta-data
android:name="android.content.SyncAdapter"
android:resource="#xml/sync" />
</service>
<service
android:name=".admob.AdmobAccountAuthenticator"
android:exported="false" >
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator" />
</intent-filter>
<meta-data
android:name="android.accounts.AccountAuthenticator"
android:resource="#xml/authenticator" />
</service>
<service
android:name=".io.ExportService"
android:exported="false" />
<service
android:name=".io.ImportService"
android:exported="false" />
<provider
android:name="com.github.andlyticsproject.sync.ContentProvider"
android:authorities="com.github.andlyticsproject"
android:exported="false" />
<provider
android:name="com.github.andlyticsproject.db.AndlyticsContentProvider"
android:authorities="com.github.andlyticsproject.db.AndlyticsContentProvider"
android:exported="false" />
<receiver
android:name="com.github.andlyticsproject.sync.AlarmReceiver"
android:exported="false"
android:process=":remote" >
</receiver>
</application>
</manifest>
=======
<manifest xmlns:android="http://schemas.android.com/apk/res/android" >
<application>
<activity
android:name=".LoginActivity"
android:label="#string/title_activity_login" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
>>>>>>> Added
Your version control system went and marked a conflict in the file (the <<<<<<< and >>>>>>> tags). You will have to fix the conflict before you can use the file. (The toolchain is complaining because the VCS tags are illegal XML syntax).
comment the second manifest tag. there should be only one manifest tag.

Error when installing android application

I trying to use C2DM in my android application, but after I added it I can't install the application. I get this error "Installation error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED". But I can't see whats wrong.
Anyone that know what I have done wrong?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="Wordy.Game"
android:versionCode="1"
android:versionName="0.1"
android:installLocation="preferExternal">
<uses-sdk android:minSdkVersion="8" />
<permission
android:name="Wordy.Game.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission
android:name="Wordy.Game.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<application android:label="#string/app_name" android:icon="#drawable/wordy">
<activity android:name="Main"
android:label="#string/app_name" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name=".C2DMRegistrationReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter >
<action android:name="com.google.android.c2dm.intent.REGISTRATION" >
</action>
<category android:name="Wordy.Game" />
</intent-filter>
</receiver>
<receiver
android:name=".C2DMRegistrationReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter >
<action android:name="com.google.android.c2dm.intent.RECEIVE" >
</action>
<category android:name="Wordy.Game" />
</intent-filter>
</receiver>
<activity android:name="Result" android:label="#string/app_name" android:screenOrientation="portrait" />
<activity android:name="PlayField" android:label="#string/app_name" android:screenOrientation="portrait" />
<activity android:name="Game" android:label="#string/app_name" android:screenOrientation="portrait" />
<activity android:name="News" android:label="#string/app_name" android:screenOrientation="portrait" />
<activity android:name="PlayOnline" android:label="#string/app_name" android:screenOrientation="portrait" />
<activity android:name="UsersOnline" android:label="#string/app_name" android:screenOrientation="portrait" />
</application>
</manifest>
I finally found whats wrong, the package name on the application was not allowed to start with capital letter.
try prefixing your activityies with a . or the full package name:
<activity android:name="com.gizm0.YourClass"></activvity>
or
<activity android:name=".YourClass"></activvity>

Categories

Resources