Creating a BackGround application

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Creating a BackGround application

Postby joemarshalmathew » Wed Jan 27, 2010 5:43 pm

Hi all,

I tried to create an application, the main feature is it doesnot have a UI interface it runs as a background process.

Can any one say how to create a background application.

I tried with a class extending "Service" but it doesnot work and it has a UI screen.

Thanks in advance
joemarshalmathew
Freshman
Freshman
 
Posts: 9
Joined: Sun Jan 03, 2010 6:25 am
Location: Kochi,India

Top

Postby Draffodx » Thu Jan 28, 2010 12:38 pm

Not sure what you mean?

You want to run it in the background yet you have a user interface?
Draffodx
Master Developer
Master Developer
 
Posts: 205
Joined: Wed Nov 12, 2008 2:31 pm

Postby joemarshalmathew » Thu Jan 28, 2010 6:28 pm

Thanks for the reply

What i want is an application which runs as a service in the phone and to update server certain details, the main requirement is it shouldnot have a UI interface.

The application starts after a reboot and will be active.
joemarshalmathew
Freshman
Freshman
 
Posts: 9
Joined: Sun Jan 03, 2010 6:25 am
Location: Kochi,India

Postby xma » Sun Jan 31, 2010 9:27 am

You want a service which start at boot, just add this to your AndroidManifest.xml:


Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


For additional informations: http://developer.android.com/intl/fr/re ... _COMPLETED
xma
Junior Developer
Junior Developer
 
Posts: 16
Joined: Thu Sep 03, 2009 10:10 pm

Postby joemarshalmathew » Sun Jan 31, 2010 1:25 pm

Thanks for the reply

I have already tried that. Android SDK 1.6 is the version i am using for the app

When i tried to create an application with service only no activity on Android Console this message comes

and from "MyStartupIntentReceiver" i can start a new Service

[2010-01-31 17:38:12 - Test3]No Launcher activity found!
[2010-01-31 17:38:12 - Test3]The launch will only sync the application package on the device!

The Manifest File is

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.      package="test.com"
  6.  
  7.      android:versionCode="1"
  8.  
  9.      android:versionName="1.0">
  10.  
  11.    
  12.  
  13.     <uses-permission android:name="android.permission.WAKE_LOCK" />
  14.  
  15.     <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
  16.  
  17.          
  18.  
  19.     <application android:icon="@drawable/icon" android:label="@string/app_name">
  20.  
  21.  
  22.  
  23.        <receiver android:name=".MyStartupIntentReceiver">
  24.  
  25.             <intent-filter>
  26.  
  27.                  <action android:name="android.intent.action.BOOT_COMPLETED" />
  28.  
  29.                  <category android:name="android.intent.category.HOME" />
  30.  
  31.             </intent-filter>
  32.  
  33.         </receiver>
  34.  
  35.        
  36.  
  37.     </application>
  38.  
  39. </manifest>  
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


And my Java class is

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package test.com;
  2.  
  3.  
  4.  
  5. import android.content.BroadcastReceiver;
  6.  
  7. import android.content.Context;
  8.  
  9. import android.content.Intent;
  10.  
  11. import android.util.Log;
  12.  
  13.  
  14.  
  15. public class MyStartupIntentReceiver extends BroadcastReceiver
  16.  
  17. {
  18.  
  19.        
  20.  
  21.         private static final String LogName = "TestApp";
  22.  
  23.        
  24.  
  25.         @Override
  26.  
  27.         public void onReceive(Context context, Intent intent)
  28.  
  29.         {
  30.  
  31.                 Log.d(LogName, "Got the Boot Event>>>");
  32.  
  33.         }
  34.  
  35. }
  36.  
  37.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


After boot up i didn't got any control in my class if i modify the code like this then it works ie adding a class that extends Activity

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.      package="test.com"
  6.  
  7.      android:versionCode="1"
  8.  
  9.      android:versionName="1.0">
  10.  
  11.    
  12.  
  13.     <uses-permission android:name="android.permission.WAKE_LOCK" />
  14.  
  15.     <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
  16.  
  17.          
  18.  
  19.     <application android:icon="@drawable/icon" android:label="@string/app_name">
  20.  
  21.           <activity android:name=".Test"
  22.  
  23.                  android:label="@string/app_name">
  24.  
  25.             <intent-filter>
  26.  
  27.                 <action android:name="android.intent.action.MAIN" />
  28.  
  29.                 <category android:name="android.intent.category.LAUNCHER"/>
  30.  
  31.             </intent-filter>
  32.  
  33.         </activity>
  34.  
  35.    
  36.  
  37.         <receiver android:name=".MyStartupIntentReceiver">
  38.  
  39.             <intent-filter>
  40.  
  41.                  <action android:name="android.intent.action.BOOT_COMPLETED" />
  42.  
  43.                  <category android:name="android.intent.category.HOME" />
  44.  
  45.             </intent-filter>
  46.  
  47.         </receiver>
  48.  
  49.        
  50.  
  51.     </application>
  52.  
  53. </manifest>  
Parsed in 0.004 seconds, using GeSHi 1.0.8.4


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package test.com;
  2.  
  3.  
  4.  
  5. import android.app.Activity;
  6.  
  7. import android.os.Bundle;
  8.  
  9.  
  10.  
  11. public class Test extends Activity {
  12.  
  13.     /** Called when the activity is first created. */
  14.  
  15.     @Override
  16.  
  17.     public void onCreate(Bundle savedInstanceState) {
  18.  
  19.         super.onCreate(savedInstanceState);
  20.  
  21.         setContentView(R.layout.main);
  22.  
  23.     }
  24.  
  25. }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4



"MyStartupIntentReceiver " the same class without any change

Now i got this message in logcat "Got the Boot Event>>>" :shock:


But this will have a UI like the attached screen

I dont know why the service classes doesnot start without the Activity class

If u have a sample code that can run in the background please paste it over here

Thanks in advance
Attachments
Dev.jpg
Dev.jpg (20.47 KiB) Viewed 711 times
joemarshalmathew
Freshman
Freshman
 
Posts: 9
Joined: Sun Jan 03, 2010 6:25 am
Location: Kochi,India

Postby xma » Sun Jan 31, 2010 2:07 pm

I do not understand. You want a background service or an UI program ?

Ok here is how I would do this:

package im.maillard.android.onbootservice;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class OnBootReceiver extends BroadcastReceiver {
  2.  
  3.         public static final String TAG = "TestApp";
  4.  
  5.         @Override
  6.         public void onReceive(Context context, Intent intent) {
  7.                 if ("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) {
  8.                         Log.d("TestApp", "Got the Boot Event>>>");
  9.                         // do your stuff for example, start a background service directly
  10.                         // here
  11.                 }
  12.         }
  13. }
Parsed in 0.036 seconds, using GeSHi 1.0.8.4



Here the corresponding manifest:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  3.      package="im.maillard.android.onbootservice"
  4.      android:versionCode="1"
  5.      android:versionName="1.0">
  6.     <application android:icon="@drawable/icon" android:label="@string/app_name">
  7.       <receiver android:name=".OnBootReceiver"
  8. android:enabled="true"
  9. android:exported="false"
  10. android:label="OnBootReceiver">
  11.     <intent-filter>
  12.         <action android:name="android.intent.action.BOOT_COMPLETED" />
  13.     </intent-filter>
  14. </receiver>
  15.  <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
  16.  
  17.     </application>
  18.     <uses-sdk android:minSdkVersion="4" />
  19. </manifest>
  20.  
Parsed in 0.004 seconds, using GeSHi 1.0.8.4


Here is the output from adb logcat:

W/NotificationService( 52): error loading sound for content://settings/system/notification_sound
W/NotificationService( 52): java.io.IOException: setDataSource failed.: status=0x80000000
W/NotificationService( 52): at android.media.MediaPlayer.setDataSource(Native Method)
W/NotificationService( 52): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:621)
W/NotificationService( 52): at android.media.AsyncPlayer$Thread.run(AsyncPlayer.java:76)
D/MediaScannerService( 130): start scanning volume internal
I/jdwp ( 142): received file descriptor 10 from ADB
D/ddm-heap( 142): Got feature list request
D/dalvikvm( 100): GC freed 2824 objects / 195376 bytes in 262ms
I/ActivityThread( 142): Publishing provider com.android.alarmclock: com.android.alarmclock.AlarmProvider
I/ActivityManager( 52): Start proc com.android.mms for broadcast com.android.mms/.transaction.MmsSystemEventReceiver: pid=152 uid=10021 gids={3003, 1015}
I/jdwp ( 152): received file descriptor 10 from ADB
D/ddm-heap( 152): Got feature list request
D/HomeLoaders( 102): ----> cleared application list
I/Resources( 100): Loaded time zone names for en_US in 7239ms.
D/SystemClock( 100): Setting time of day to sec=1264942937
W/SystemClock( 100): Unable to set rtc to 1264942937: Invalid argument
D/MediaScanner( 130): opendir /system/media/ failed, errno: 2
D/GpsLocationProvider( 52): state: DISCONNECTED apnName: null reason: radioTurnedOff
D/GpsLocationProvider( 52): state: DISCONNECTED apnName: null reason: gprsDetached
D/MediaScanner( 130): prescan time: 1408ms
I/ActivityManager( 52): Start proc im.maillard.android.onbootservice for broadcast im.maillard.android.onbootservice/.OnBootReceiver: pid=165 uid=10023 gids={}
D/MediaScanner( 130): scan time: -7644ms
D/MediaScanner( 130): postscan time: 0ms
D/MediaScanner( 130): total time: -6236ms
I/jdwp ( 165): received file descriptor 10 from ADB
D/ddm-heap( 165): Got feature list request
D/dalvikvm( 52): GC freed 8955 objects / 672664 bytes in 345ms
D/MediaScannerService( 130): done scanning volume internal
I/ActivityManager( 52): Stopping service: com.android.providers.media/.MediaScannerService
I/ActivityManager( 52): Stopping service: com.android.providers.downloads/.DownloadService
D/TestApp ( 165): Got the Boot Event>>>
E/ActivityThread( 100): Failed to find provider info for android.server.checkin
W/Checkin ( 100): Can't update stat PHONE_GSM_REGISTERED: java.lang.IllegalArgumentException: Unknown URL content://android.server.checkin/stats
D/GpsLocationProvider( 52): state: DISCONNECTED apnName: null reason: null
D/dalvikvm( 52): GC freed 1746 objects / 69848 bytes in 165ms
D/StatusBar( 52): updateResources



[quote]

Now you can do launch a service in the onReceive() of your broadcast receiver class
xma
Junior Developer
Junior Developer
 
Posts: 16
Joined: Thu Sep 03, 2009 10:10 pm

Top

Postby joemarshalmathew » Sun Jan 31, 2010 2:10 pm

What i want is a purely Background application
joemarshalmathew
Freshman
Freshman
 
Posts: 9
Joined: Sun Jan 03, 2010 6:25 am
Location: Kochi,India

Postby xma » Sun Jan 31, 2010 2:12 pm

So do it !

As you can read in my manifest, I did not declare any activity, just this pure receiver. From that, in the if part of the receiver, you can start a service (remember the BIND_AUTO_CREATE flag).

That's all you need (and off course, declare your service in the manifest).
xma
Junior Developer
Junior Developer
 
Posts: 16
Joined: Thu Sep 03, 2009 10:10 pm

Postby joemarshalmathew » Sun Jan 31, 2010 4:28 pm

i tried as u said but the application didn't started or i didn't get any log i tried for android version 1.6 from Eclipse IDE, how u tried from eclipse or through any other IDE
joemarshalmathew
Freshman
Freshman
 
Posts: 9
Joined: Sun Jan 03, 2010 6:25 am
Location: Kochi,India

Postby xma » Sun Jan 31, 2010 11:15 pm

I tried both from Eclipse and from my prefered "IDE": GNU Emacs.

You have to adb logcat to see the output as I do not know Eclipse very well (not to say I do not know it at all :D)
xma
Junior Developer
Junior Developer
 
Posts: 16
Joined: Thu Sep 03, 2009 10:10 pm

Postby xma » Sun Jan 31, 2010 11:50 pm

Okay I modified it a little bit in order to show you how to start a local service directly from the broadcast receiver. I tested it on SDK 1.6 in Eclipse.

Here is the complete AndroidManifest file:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  3.         package="im.maillard.android.onbootservice" android:versionCode="1"
  4.         android:versionName="1.0">
  5.         <application android:icon="@drawable/icon" android:label="@string/app_name">
  6.                 <receiver android:name=".OnBootReceiver" android:enabled="true"
  7.                         android:exported="false" android:label="OnBootReceiver">
  8.                         <intent-filter>
  9.                                 <action android:name="android.intent.action.BOOT_COMPLETED" />
  10.                         </intent-filter>
  11.                 </receiver>
  12.                 <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
  13.                 <service android:name="MySimpleService" android:enabled="true"
  14.                         android:exported="false" android:label="MySimpleService" />
  15.         </application>
  16.         <uses-sdk android:minSdkVersion="4" />
  17. </manifest>
Parsed in 0.004 seconds, using GeSHi 1.0.8.4


Here is the java source code for my simple test service:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package im.maillard.android.onbootservice;
  2.  
  3. import android.app.Service;
  4. import android.content.Intent;
  5. import android.os.IBinder;
  6. import android.util.Log;
  7.  
  8. public class MySimpleService extends Service {
  9.  
  10.         public MySimpleService() {
  11.         }
  12.  
  13.         @Override
  14.         public IBinder onBind(Intent arg0) {
  15.                 // TODO Auto-generated method stub
  16.                 return null;
  17.         }
  18.  
  19.         @Override
  20.         public void onRebind(Intent intent) {
  21.                 super.onRebind(intent);
  22.                 Log.d("TestApp", ">>>onRebind()");
  23.         }
  24.  
  25.         @Override
  26.         public void onCreate() {
  27.                 super.onCreate();
  28.                 Log.d("TestApp", ">>>onCreate()");
  29.         }
  30.  
  31.         @Override
  32.         public void onStart(Intent intent, int startId) {
  33.                 super.onStart(intent, startId);
  34.                 Log.d("TestApp", ">>>onStart()");
  35.         }
  36.  
  37.         @Override
  38.         public boolean onUnbind(Intent intent) {
  39.                 return super.onUnbind(intent);
  40.         }
  41. }
  42.  
Parsed in 0.039 seconds, using GeSHi 1.0.8.4


Here is the modified broadcast receiver:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package im.maillard.android.onbootservice;
  2.  
  3. import android.content.BroadcastReceiver;
  4. import android.content.ComponentName;
  5. import android.content.Context;
  6. import android.content.Intent;
  7. import android.util.Log;
  8.  
  9. public class OnBootReceiver extends BroadcastReceiver {
  10.  
  11.         public static final String TAG = "TestApp";
  12.  
  13.         @Override
  14.         public void onReceive(Context context, Intent intent) {
  15.                 Log.d("TestApp", "Got the Boot Event>>>");
  16.                 Log.d("TestApp", "Starting MySimpleService>>>");
  17.                 context.startService(new Intent().setComponent(new ComponentName(
  18.                                 context.getPackageName(), MySimpleService.class.getName())));
  19.         }
  20. }
  21.  
Parsed in 0.039 seconds, using GeSHi 1.0.8.4


And here is the adb logcat output:

D/PackageManager( 52): Services: im.maillard.android.onbootservice.MySimpleService
D/PackageManager( 52): Receivers: im.maillard.android.onbootservice.OnBootReceiver
I/installd( 31): move /data/dalvik-cache/data@app@vmdl15924.tmp@classes.dex -> /data/dalvik-cache/data@app@im.maillard.android.onbootservice.apk@classes.dex
D/PackageManager( 52): New package installed in /data/app/im.maillard.android.onbootservice.apk
D/AndroidRuntime( 117): Shutting down VM
D/dalvikvm( 117): DestroyJavaVM waiting for non-daemon threads to exit
D/dalvikvm( 117): DestroyJavaVM shutting VM down
D/dalvikvm( 117): HeapWorker thread shutting down
D/dalvikvm( 117): HeapWorker thread has shut down
D/jdwp ( 117): JDWP shutting down net...
D/dalvikvm( 117): VM cleaning up
D/dalvikvm( 117): LinearAlloc 0x0 used 663068 of 4194304 (15%)
I/WindowManager( 52): Config changed: { scale=1.0 imsi=0/0 loc=fr_CH touch=3 keys=2/1/2 nav=3 orien=1 layout=18}
D/ddm-heap( 129): Got feature list request
D/dalvikvm( 52): GC freed 5361 objects / 354488 bytes in 182ms
D/ActivityManager( 52): Uninstalling process im.maillard.android.onbootservice
D/dalvikvm( 52): GC freed 1172 objects / 53120 bytes in 112ms
D/ActivityManager( 52): Uninstalling process im.maillard.android.onbootservice
D/HomeLoaders( 99): application intent received: android.intent.action.PACKAGE_REMOVED, replacing=true
D/HomeLoaders( 99): --> package:im.maillard.android.onbootservice
D/HomeLoaders( 99): application intent received: android.intent.action.PACKAGE_ADDED, replacing=true
D/HomeLoaders( 99): --> package:im.maillard.android.onbootservice
D/HomeLoaders( 99): --> update package im.maillard.android.onbootservice
D/MountListener( 52): handleEvent ums_disabled
D/MountListener( 52): handleEvent ums_disconnected
I/ActivityManager( 52): Start proc android.process.media for broadcast com.android.providers.downloads/.DownloadReceiver: pid=160 uid=10005 gids={1006, 1015, 2001, 3003}
I/ActivityManager( 52): processNextBroadcast: waiting for ProcessRecord{438d12d0 160:android.process.media/10005}
I/jdwp ( 160): received file descriptor 10 from ADB
E/ActivityThread( 94): Failed to find provider info for android.server.checkin
W/Checkin ( 94): Can't update stat PHONE_GSM_REGISTERED: java.lang.IllegalArgumentException: Unknown URL content://android.server.checkin/stats
D/ddm-heap( 160): Got feature list request
I/ActivityManager( 52): processNextBroadcast: waiting for ProcessRecord{438d12d0 160:android.process.media/10005}
I/ActivityManager( 52): processNextBroadcast: waiting for ProcessRecord{438d12d0 160:android.process.media/10005}
D/dalvikvm( 52): GC freed 3333 objects / 236136 bytes in 142ms
D/HomeLoaders( 99): aborting loaders
I/ActivityManager( 52): processNextBroadcast: waiting for ProcessRecord{438d12d0 160:android.process.media/10005}
I/ActivityThread( 160): Publishing provider downloads: com.android.providers.downloads.DownloadProvider
W/ResourceType( 52): No package identifier when getting value for resource number 0x7f060000
I/ActivityThread( 160): Publishing provider drm: com.android.providers.drm.DrmProvider
W/ResourceType( 52): No package identifier when getting value for resource number 0x7f060001
I/ActivityThread( 160): Publishing provider media: com.android.providers.media.MediaProvider
W/ResourceType( 52): No package identifier when getting value for resource number 0x7f060000
W/ResourceType( 52): No package identifier when getting value for resource number 0x7f060001
D/GpsLocationProvider( 52): state: DISCONNECTED apnName: null reason: radioTurnedOff
D/GpsLocationProvider( 52): state: DISCONNECTED apnName: null reason: gprsDetached
V/MediaProvider( 160): Attached volume: internal
D/HomeLoaders( 99): load applications
D/HomeLoaders( 99): loading user items
D/HomeLoaders( 99): --> starting workspace loader
D/GpsLocationProvider( 52): state: DISCONNECTED apnName: null reason: null
D/StatusBar( 52): updateResources
D/HomeLoaders( 99): ----> running workspace loader (2)
D/TelephonyProvider( 94): Setting numeric '310260' to be the current operator
E/ActivityThread( 94): Failed to find provider info for android.server.checkin
W/Checkin ( 94): Can't update stat PHONE_GPRS_ATTEMPTED: java.lang.IllegalArgumentException: Unknown URL content://android.server.checkin/stats
E/ActivityThread( 94): Failed to find provider info for android.server.checkin
W/Checkin ( 94): Can't update stat PHONE_GPRS_CONNECTED: java.lang.IllegalArgumentException: Unknown URL content://android.server.checkin/stats
D/GpsLocationProvider( 52): state: CONNECTING apnName: epc.tmobile.com reason: simLoaded
D/MobileDataStateTracker( 52): CONNECTED event did not supply interface name.
D/MobileDataStateTracker( 52): DNS server addresses are not known.
D/GpsLocationProvider( 52): state: CONNECTED apnName: epc.tmobile.com reason: simLoaded
D/GpsLocationProvider( 52): updateNetworkState available
D/GpsLocationProvider( 52): NetworkThread wait for 9223372036854775807ms
D/HomeLoaders( 99): --> done loading workspace
D/HomeLoaders( 99): ----> worskpace items=5
D/HomeLoaders( 99): ----> worskpace widgets=0
D/HomeLoaders( 99): ----> items cloned, ready to refresh UI
D/HomeLoaders( 99): ----> loading applications from workspace loader
D/HomeLoaders( 99): --> starting applications loader unlocked
D/HomeLoaders( 99): --> starting applications loader
D/HomeLoaders( 99): ----> running applications loader (2)
I/ActivityManager( 52): Start proc com.android.alarmclock for broadcast com.android.alarmclock/.AlarmInitReceiver: pid=175 uid=10017 gids={}
D/HomeLoaders( 99): ----> onDesktopItemsLoaded()
D/Launcher( 99): ------> binding 5 items
D/Launcher( 99): ------> binding 0 widgets
D/Launcher( 99): ------> start binding items
D/MediaPlayer( 52): Couldn't open file on client side, trying server side
D/ActivityManager( 52): checkComponentPermission() adjusting {pid,uid} to {30,1013}
D/ActivityManager( 52): checkComponentPermission() adjusting {pid,uid} to {30,1013}
D/ActivityManager( 52): checkComponentPermission() adjusting {pid,uid} to {30,1013}
I/jdwp ( 175): received file descriptor 10 from ADB
D/ActivityManager( 52): checkComponentPermission() adjusting {pid,uid} to {30,1013}
E/MediaPlayerService( 30): Couldn't open fd for content://settings/system/notification_sound
E/MediaPlayer( 52): Unable to to create media player
W/NotificationService( 52): error loading sound for content://settings/system/notification_sound
W/NotificationService( 52): java.io.IOException: setDataSource failed.: status=0x80000000
W/NotificationService( 52): at android.media.MediaPlayer.setDataSource(Native Method)
W/NotificationService( 52): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:621)
W/NotificationService( 52): at android.media.AsyncPlayer$Thread.run(AsyncPlayer.java:76)
D/ddm-heap( 175): Got feature list request
D/MediaScannerService( 160): start scanning volume internal
I/ActivityThread( 175): Publishing provider com.android.alarmclock: com.android.alarmclock.AlarmProvider
I/ActivityManager( 52): Start proc im.maillard.android.onbootservice for broadcast im.maillard.android.onbootservice/.OnBootReceiver: pid=186 uid=10023 gids={}
I/jdwp ( 186): received file descriptor 10 from ADB
D/ddm-heap( 186): Got feature list request
I/ActivityManager( 52): Stopping service: com.android.providers.downloads/.DownloadService
D/TestApp ( 186): Got the Boot Event>>>
D/TestApp ( 186): Starting MySimpleService>>>
D/TestApp ( 186): >>>onCreate()
D/TestApp ( 186): >>>onStart()

I/ActivityManager( 52): Start proc com.svox.pico for broadcast com.svox.pico/.VoiceDataInstallerReceiver: pid=194 uid=10003 gids={}
D/HomeLoaders( 99): ----> cleared application list
I/jdwp ( 194): received file descriptor 20 from ADB
I/dalvikvm( 194): Debugger thread not active, ignoring DDM send (t=0x54455354 l=8)
D/ddm-heap( 194): Got feature list request
D/dalvikvm( 52): GC freed 7382 objects / 597080 bytes in 203ms
D/MediaScanner( 160): opendir /system/media/ failed, errno: 2
D/MediaScanner( 160): prescan time: 1222ms
D/MediaScanner( 160): scan time: 745ms
D/MediaScanner( 160): postscan time: 0ms
D/MediaScanner( 160): total time: 1967ms
I/ActivityManager( 52): Stopping service: com.android.mms/.transaction.TransactionService
D/MediaScannerService( 160): done scanning volume internal
I/ActivityManager( 52): Stopping service: com.android.providers.media/.MediaScannerService
I/ActivityManager( 52): Stopping service: com.android.mms/.transaction.SmsReceiverService
I/ActivityManager( 52): Stopping service: com.android.providers.downloads/.DownloadService
D/dalvikvm( 99): GC freed 6714 objects / 372896 bytes in 125ms


This is as simple as this.

Hope it is clear now.
xma
Junior Developer
Junior Developer
 
Posts: 16
Joined: Thu Sep 03, 2009 10:10 pm

Get particular application

Postby dhaiwat » Mon Feb 01, 2010 9:40 am

Hi


i follow on your post and create service that start on booting of device.

Now My problem is I want to get click on particular application launch.

Ex. How this background application know that which application is start(Ex Messaging,Contact)
In short I want to open my application instead of android native messaging application..

Can u suggest me any Idea how can i done this.



Dhaiwat Bhavsar (dhaiwat.bhavsar@yahoo.com)
dhaiwat
Developer
Developer
 
Posts: 28
Joined: Tue Feb 10, 2009 6:49 am

Postby xma » Mon Feb 01, 2010 1:08 pm

Short answer is: it depends.

I am not sure I understand all your needs but, in the receiver part of the AndroidManifest.xml file, you can specify a priority. On a specific intent, the Android system is chossing between all the receiver what is the best candidate, which in turn, is the receiver with the highest priority.

So in your broadcast receiver, specify a priority of, for example, 42000, and you will be almost sure it is your application that will be launched.

I'd rather avoid such things without an easy way for a user to disable this behaviour (either through a preference entry "choose XYZ as the default contact manager" or let the default priority.

I hope I answered correctly and that it will help.
xma
Junior Developer
Junior Developer
 
Posts: 16
Joined: Thu Sep 03, 2009 10:10 pm

messaging intent

Postby dhaiwat » Mon Feb 01, 2010 2:26 pm

hi

i want to start my activity from service when user touch on Messaging application of android.
can u tell me which Intent is call on receive so that i put in AndroidManifest.xm file to start my application on touch of Messaging of android.

Dhaiwat Bhavsar
dhaiwat
Developer
Developer
 
Posts: 28
Joined: Tue Feb 10, 2009 6:49 am

Postby joemarshalmathew » Mon Feb 01, 2010 4:42 pm

Thanks it worked 8)
Last edited by joemarshalmathew on Mon Feb 01, 2010 4:50 pm, edited 1 time in total.
joemarshalmathew
Freshman
Freshman
 
Posts: 9
Joined: Sun Jan 03, 2010 6:25 am
Location: Kochi,India

Top
Next

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 8 guests