If you want your app to start at boot then you should not allow it to be 
installed on external storage. 

http://developer.android.com/guide/topics/data/install-location.html#ShouldNot

On Thursday, October 4, 2012 1:58:22 PM UTC+2, Juned Khan wrote:
>
> How do i start my application on startup in case when application is 
> installed on SD card? If i application is installed on Internal memory 
> then  using `BOOT_COMPLETED` completed broadcast we can achieve our 
> requirements but this BOOT_COMPLETED intent is broadcasts before the media 
> is mounted so we can not use this broadcast.
>
> What i tried so far is, i used the another intent which is `MEDIA_MOUNTED` 
> but don't know why broadcast is not being received.
>
> **Here is my code**:<br> AndroidManifest.xml<br>
>  
>
>     <receiver
>                 android:name=".ui.Receiver"
>                 android:enabled="true" >
>                 <intent-filter>
>                     <action 
> android:name="android.intent.action.MEDIA_MOUNTED" />
>                     <data android:scheme="file" />
>                 </intent-filter>
>                 <intent-filter>
>                     <action 
> android:name="android.intent.action.BOOT_COMPLETED" />
>                     <action 
> android:name="android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE" />
>                     <action 
> android:name="android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE" />
>                     <category 
> android:name="android.intent.category.DEFAULT" />
>                 </intent-filter>
>                 <intent-filter>
>                     <action 
> android:name="android.intent.action.PACKAGE_REPLACED" />
>     
>                     <data android:scheme="package" />
>                     <data android:path="org.sipchat.sipua" />
>                 </intent-filter>
>             </receiver>
>
> **Receiver.java**<br>
>
>     public void onReceive(Context context, Intent intent) {
>             String intentAction = intent.getAction();
>             if (intentAction.equals(Intent.ACTION_BOOT_COMPLETED)) {
>                 Toast.makeText(context, "BOOT Completed", 
> Toast.LENGTH_LONG).show();
>                 on_vpn(false);
>                 engine(context).register();
>             } else if (intentAction.equals(Intent.ACTION_MEDIA_MOUNTED)) {
>                 Toast.makeText(context, "Media is Mounted", 
> Toast.LENGTH_LONG)
>                         .show();
>                 engine(context).register();
>             } else if 
> (intentAction.equals(ConnectivityManager.CONNECTIVITY_ACTION)
>                     || 
> intentAction.equals(ACTION_EXTERNAL_APPLICATIONS_AVAILABLE)
>                     || intentAction
>                             
> .equals(ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE)
>                     || 
> intentAction.equals(Intent.ACTION_PACKAGE_REPLACED)) {
>                 engine(context).register();}}
>
> Any help and suggestion will be appreciated<br>
> Thanks
>

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

Reply via email to