I have an App that uses a Service that I've added by a Bindable Jar.
Current state:
this Jar has an own Manifest (see below), when I don't touch anything on this Manifest everything works as it should.
Problem:
This Jar lets on Deployment to Device always its launer AppIcon on Device.
So my App leaves finaly two launcher icons, the one desired and the other from the Jar.
My Approach was to delete follow Part from Manifest:
android:theme="#style/AppTheme">
<activity
android:name=".ScanDemoActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Doing this the App Crashed on BootUp with Error: BootReceiver not found ...
Deleting the next few Lines:
<receiver android:name="com.company.scandemo.BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<category android:name="android.intent.category.HOME"/>
</intent-filter>
</receiver>
caused started correctly on bootUp, but the Service didn't come up on BOOT_COMPLETED, when I start the App via Launcher icon everything worked.
Wished Behaviour:
I want the Main App to leave only one launch Icon and startup correctly on Boot
Here is the Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.company.scandemo"
android:versionCode="1"
android:versionName="2.2" >
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name=".ScanDemoActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="com.company.scandemo.FloatingService" />
<receiver android:name="com.company.scandemo.BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<category android:name="android.intent.category.HOME"/>
</intent-filter>
</receiver>
</application>
</manifest>
Related
I have generated an APK using Android Studio and I don't know why the APK behavior is different from installing the software using the usb wire on debug mode. I have two activities in the same application and when I install it from debug, it appears the first of them but if I install it using the APK, it is launched directly in the second activity.
Any hint?
Thanks!
EDIT: this is the new manifest after modifying it accordingly to the answer given by Bala Raja. However, the problem is that now Android is not identifying the second activity as a Launcher. What could I do?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="19"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.REORDER_TASKS" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:label="#string/app_name" android:icon="#drawable/happy" android:debuggable="true">
<activity android:name=".Configure"
android:label="#string/app_name"
android:theme="#android:style/Theme.Holo.Light.NoActionBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".Launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Holo.Light.NoActionBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.CLOSE_SYSTEM_DIALOGS" />
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
paste this in your activity in manifest file which you want first.
I am fairly new to Android programming and I'm doing my best to understand the tutorial. I have downloaded the sample code from this link.
Now I want to integrate the code from this thread. It says here to "declare the SMS receiver in your AndroidManifest.xml"
The code is:
<receiver android:name="mypackage.SMSReceiver">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED"/>
</intent-filter>
</receiver>
<uses-permission android:name="android.permission.RECEIVE_SMS" />
Here's the existing code from the sample file I downloaded under AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.smsTest"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".SMSTest"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.SEND_SMS">
</uses-permission>
<uses-permission android:name="android.permission.RECEIVE_SMS">
</uses-permission>
</manifest>
Now my question is where to add the code (the first code above) into AndroidManifest.xml.
I tried to change this line:
<action android:name="android.intent.action.MAIN" />
with this:
<action android:name="android.provider.Telephony.SMS_RECEIVED"/>
without luck.
Any help is appreciated.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.smsTest"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".SMSTest"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name="mypackage.SMSReceiver">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED"/>
</intent-filter>
</receiver>
</application>
<uses-permission android:name="android.permission.SEND_SMS">
</uses-permission>
<uses-permission android:name="android.permission.RECEIVE_SMS">
</uses-permission>
</manifest>
You need to add the receiver as a 2nd item inside the application. You don't replace the intent filter on the activity. It should go between the and tags.
The manifest is really describing whats in your apk. Your application will have 1 activity, SMSTest, that is launched from the launcher. It also has 1 receiver which receives the intent SMS_RECEIVED. So both parts need to be in there. Make sense?
I am building a simple sms app , i want to open my app automaticaly when ever a new sms is received? is it even possible?
i am using broadcast receiver for this
what changes should i made in manifest?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.message"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="15" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".MessageActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<receiver android:name=".SmsReceiver" >
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
</activity>
<activity android:name=".Reply" >
</activity>
</application>
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
</manifest>
you should move the receiver outside from the activity like this:
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".MessageActivity"
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=".Reply" >
</activity>
<receiver android:name=".SmsReceiver" >
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
</application>
Under Android 3.0 and later, your broadcast is not guaranteed to be received unless the user has opened your application. The application does not have to remain opened, just to have been started once. This is caused by a flag (FLAG_EXCLUDE_STOPPED_PACKAGES) which is now part of most system broadcasts, which says the broadcast should not start a stopped application.
This was already answered in How to make android launch an application on received specific sms to keep it short: it is possible with BroadcastReceiver.
I have made my own sms app with a reciver.
Now the emulator doesn'T start the app when run it via eclipse.
On my phone i can't press open after installing and the App Drawer doens't show my app.
the behaviour is like a widget
MY Manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.korn.websms"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".WebSMSActivity"
android:label="#string/app_name" >
</activity>
<receiver android:name=".SmsReceiver" android:exported="true" >
<intent-filter android:priority="999">
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.READ_SMS"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
</manifest>
you haven't declared a Main and Launcher activity that would be launched when the app is installed.
this should be declared within your main activity
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
You are missing a couple of lines from your manifest if you are looking to launch your app from an icon on the screen...
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
The first one (MAIN) means that this activity is the entry point of the application, when you launch the application, this activity is created.
The second one (LAUNCHER) means that it should show up in the Launcher as a top level app.
I'm trying to put a widget and an app in the same apk.
Here's my manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.me.mywidget"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".settingsPage"
android:label="#string/app_name"
android:theme="#style/app_theme"
>
<intent-filter>
<action android:name="com.me.mywidget.SETTINGSPAGE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<receiver android:name="MyWidgetProvider" android:label="My Widgets">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="#layout/widget_info" />
</receiver>
<service android:name=".UpdateWidgetService"></service>
<activity android:name=".Test"></activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk android:minSdkVersion="7" />
</manifest>
How do I put an app and market in the same apk? I tried this and while it runs, the app does not show up in the app drawer.
Also, when I add android:name=".mywidgets" my widget crashes when I run it.
Also, I will be adding multiple sizes to the widget later on.
You need to add the intent filter for launcher to whichever activity you want to show in the launcher...
<category android:name="android.intent.category.LAUNCHER" />
So if .Test is your primary launching activity you would modify your manifest like below..
<activity android:name=".Test"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>