Manfred wrote:
> Hi!
> 
> If i insert a receiver in my manifest, my application starts after a
> reboot:
> 
>       <activity android:name=".RNAutostart"
>                 android:label="RNAutostart"/>
>     <receiver android:enabled="true"
>                         android:name=".Autostart"
>  
> android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
> 
>                     <intent-filter>
>                             <action
> android:name="android.intent.action.BOOT_COMPLETED"/>
>                             <category
> android:name="android.intent.category.DEFAULT" />
>                     </intent-filter>
> 
>    </receiver>
> 
> This works fine!
> 
> But i want to programatically register the receiver, only if the user
> wants an autostart:
> 
>               IntentFilter inf = new IntentFilter();
>               inf.addAction("android.intent.action.BOOT_COMPLETED");
>               inf.addCategory("android.intent.category.DEFAULT");
>               this.registerReceiver(new Autostart(), inf);
> 
> If i use this (without the receiver in manifest) my app does not start
> after reboot? Do i something wrong?

What you are trying to do does not work. You can only register
BOOT_COMPLETED receivers via the manifest.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android App Developer Training: http://commonsware.com/training.html

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to