| Author |
Message |
sbfalbo Freshman
Joined: 26 Dec 2007 Posts: 8
|
Posted: Sun Feb 17, 2008 5:13 pm Post subject: |
|
|
| Does anyone know if the BOOT_COMPLETED action is still valid in the new Android SDK build (m5 rc14)? I had the startup receiver working fine in the previous SDK build but now it seems to not be working. Thanks! |
|
| Back to top |
|
 |
sbfalbo Freshman
Joined: 26 Dec 2007 Posts: 8
|
Posted: Fri Feb 22, 2008 1:41 pm Post subject: |
|
|
| You need to add android.permission.RECEIVE_BOOT_COMPLETED to your AndroidManifest.xml as of SDK version m5-rc14. |
|
| Back to top |
|
 |
Delirio Freshman
Joined: 03 Mar 2008 Posts: 6
|
Posted: Mon Mar 03, 2008 12:16 pm Post subject: |
|
|
Hi,
It still doesn't work with RECEIVE_BOOT_COMPLETED permission:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
I just get a "Permission Denial" warming message in the log:
WARN/ActivityManager(513): Permission Denial: receiving Intent { action=android.intent.action.BOOT_COMPLETED } from android requires android.permission.RECEIVE_BOOT_COMPLETED
how could I fix it?
Thanks in advance |
|
| Back to top |
|
 |
plusminus Site Admin

Joined: 14 Nov 2007 Posts: 2102 Location: Germany
|
Posted: Mon Mar 03, 2008 1:41 pm Post subject: |
|
|
Hello Delirio,
please post your AndroidManifest.xml
Regards,
plusminus _________________
| Android Development Community / Tutorials |
|
| Back to top |
|
 |
Delirio Freshman
Joined: 03 Mar 2008 Posts: 6
|
Posted: Mon Mar 03, 2008 5:49 pm Post subject: |
|
|
Here you are:
| XML: | <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="my.test">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application android:icon="@drawable/icon" android:name="MainApplication">
<activity android:name=".ActTest" 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="ReceiverTest">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
<activity android:name="OtherActivity" android:clearOnBackground="false"/>
</application>
</manifest> |
|
|
| Back to top |
|
 |
plusminus Site Admin

Joined: 14 Nov 2007 Posts: 2102 Location: Germany
|
|
| Back to top |
|
 |
Delirio Freshman
Joined: 03 Mar 2008 Posts: 6
|
Posted: Tue Mar 04, 2008 2:09 pm Post subject: |
|
|
Ok thanks,
I was just paying attention to the Logcat messages
The log keeps showing the Permission Denial warning but the IntentReceiver gets the BOOT_COMPLETED intent, so finally it works |
|
| Back to top |
|
 |
plusminus Site Admin

Joined: 14 Nov 2007 Posts: 2102 Location: Germany
|
Posted: Tue Mar 04, 2008 2:36 pm Post subject: |
|
|
Hello Delirio,
maybe you need to reset the emulator once with -wipe-data to make the warning also disappear.
Regards,
plusminus _________________
| Android Development Community / Tutorials |
|
| Back to top |
|
 |
Delirio Freshman
Joined: 03 Mar 2008 Posts: 6
|
Posted: Tue Mar 04, 2008 3:34 pm Post subject: |
|
|
Hi plusminus,
nop, the warning persists but the code works
thanks very much anyway |
|
| Back to top |
|
 |
xayide Junior Developer
Joined: 05 Feb 2008 Posts: 20
|
Posted: Tue Mar 25, 2008 5:16 pm Post subject: Start a service?? |
|
|
Hello!
I find this tutorial very interesting. I want to do something similar, but instead of launching an activity, i want to launch a service.
I try to do that this way:
| Java: | public class TheService extends IntentReceiver {
@Override
public void onReceiveIntent(Context context, Intent intent) {
Intent i = new Intent();
i.setClass(context, MyPosition.class);
Bundle b = new Bundle();
startService(i,b);
}
} |
But the problem is that i canīt do startService(i,b) from an intentReceiver.
Is there anyway to launch a service from an intentReceiver?
thanks!! |
|
| Back to top |
|
 |
Delirio Freshman
Joined: 03 Mar 2008 Posts: 6
|
Posted: Tue Mar 25, 2008 5:35 pm Post subject: |
|
|
Hi xayide,
Just use the context instance given in the method parameter:
context.startService(ib,b); |
|
| Back to top |
|
 |
xayide Junior Developer
Joined: 05 Feb 2008 Posts: 20
|
Posted: Tue Mar 25, 2008 6:03 pm Post subject: |
|
|
I did that, but it doesnīt work at all!!
This is my manifest:
| XML: |
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<service android:name=".anotherService" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</service>
<receiver android:name=".TheService">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver> |
the intent receiver
| Java: | public class TheService extends IntentReceiver {
@Override
public void onReceiveIntent(Context context, Intent intent) {
Log.d("iam in TheService","");
/* Create intent which will finally start the Main-Activity. */
Intent myStarterIntent = new Intent(context,anotherService.class);
/* Set the Launch-Flag to the Intent. */
myStarterIntent.setLaunchFlags(Intent.NEW_TASK_LAUNCH);
/* Send the Intent to the OS. */
Bundle b=new Bundle();
//context.startService(myStarterIntent, );
context.startService(myStarterIntent, b);
}
} |
it doesnīt print the log.d text |
|
| Back to top |
|
 |
Delirio Freshman
Joined: 03 Mar 2008 Posts: 6
|
Posted: Wed Mar 26, 2008 1:04 pm Post subject: |
|
|
Maybe the error is that the tag uses-permission is inside the application tag in your android manifest , it should be placed this way (or at least I think so):
| XML: |
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="my.package">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application android:icon="@drawable/icon" android:label="Application" android:name="Application">
<receiver android:name=".anotherService" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
<service android:name="TheService" />
</application>
</manifest>
|
|
|
| Back to top |
|
 |
xayide Junior Developer
Joined: 05 Feb 2008 Posts: 20
|
Posted: Wed Mar 26, 2008 8:17 pm Post subject: |
|
|
Hi!
Itīs necessary to add all this permissions, otherwise it doesnīt work. It seems that with the new sdk release it is necessary to add all of them.
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" />
<uses-permission android:name="android.permission.ACCESS_CELL_ID" />
However, it just work if i close the emulator and launch a new one. It doesnīt work if i relaunch just the application. I donīt know if it should do like this...
I have a question: do you have problems with the emulator? i launch it and sometimes it doesnīt appear in the ddms perspective, other times it gives me errors saying that the emulator is not found... Other times it gives errors such as, home is not responding, my application is not responding...
regards! |
|
| Back to top |
|
 |
stilwalli Junior Developer
Joined: 21 Jul 2008 Posts: 18
|
Posted: Tue Jul 29, 2008 10:00 am Post subject: android.intent.action.BOOT_COMPLETED |
|
|
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.HelloWorld">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application android:icon="@drawable/icon">
<activity android:name=".HelloWorld" 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=".Start" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
</application>
</manifest>
package com.HelloWorld;
import android.content.Context;
import android.content.Intent;
import android.content.IntentReceiver;
import android.os.Bundle;
import android.util.Log;
public class Start extends IntentReceiver {
public void onReceiveIntent(Context context, Intent intent) {
if (intent.getAction().toString().equals("android.intent.action.BOOT_COMPLETED")) {
Log.i("Test", "121212");
Intent myStarterIntent = new Intent(context,HelloWorld.class);
/* Set the Launch-Flag to the Intent. */
myStarterIntent.setLaunchFlags(Intent.NEW_TASK_LAUNCH);
/* Send the Intent to the OS. */
Bundle b=new Bundle();
//context.startService(myStarterIntent, );
context.startService(myStarterIntent, b);
}
}
}
//HelloWorld is an activity that displays hello world.
I keep getting this error
WARN/PackageManager(510): Granting new permission android.permission.RECEIVE_BOOT_COMPLETED to android.server.PackageManagerService$SharedUserSetting@400c04d0
WARN/ActivityManager(510): Permission Denial: receiving Intent { action=android.intent.action.BOOT_COMPLETED } from android requires android.permission.RECEIVE_BOOT_COMPLETED
Please help |
|
| Back to top |
|
 |
|