I registered a broadcast  to detect sd card status, but it only works
on the device below 2.1(include 2.1)

it's doesn't work on nexus one or 2.2 emulator...

android os will kill my process on nexus one and 2.2 emulator, but it
won't do that on device below 2.1(include 2.1)

is there anything wrong?




public class serviceSDcard extends Service {

        private static Context contextService           = null;
        private static AppWidgetManager awmService      = null;
        public static boolean bIsUnmount                        = false;
        @Override
        public IBinder onBind(Intent intent) {
                return null;
        }

        @Override
        public void onStart(Intent intent, int startId) {

                IntentFilter intentFilter = new IntentFilter();
                intentFilter.addAction(Intent.ACTION_MEDIA_MOUNTED);
                intentFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
                intentFilter.addDataScheme("file");
                intentFilter.addDataAuthority("*", null);

                registerReceiver(receiver, intentFilter);
                super.onStart(intent, startId);
        }
        private BroadcastReceiver receiver = new BroadcastReceiver() {

                @Override
                public void onReceive(Context context, Intent intent) {
                        try {
                                bIsUnmount              = !bIsUnmount;
                                if 
(intent.getAction().equals(Intent.ACTION_MEDIA_UNMOUNTED)){
                                        beauty_large_main.fos.close();

                                }else{

                                }

                        } catch (Exception e) {
                                Log.d("main", e.toString());
                        }

                }
        };
}

-- 
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