am trying to start my service on device boot up.

by Wojciech Topolski » Wed, 21 Jul 2010 18:05:08 GMT


Sponsored Links
 i

Below is my code. Maybe you find something interesting...

*manifest file:::*
<receiver android:enabled="true"
android:name=".broadcastreceiver.BootCompletedBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"
/>
</intent-filter>
</receiver>

<service android:name=".service.MonitoringService">
<intent-filter>
<action android:name="your.package.name.MonitoringService"
/>
</intent-filter>
</service>

*Broadcast reciever*:::

@Override
public void onReceive(Context context, Intent intent) {
// Start service.
Intent serviceIntent = new Intent(context,
MonitoringService.class);
serviceIntent.putExtra(something, something);
context.startService(serviceIntent);
}

But remember! If you deploy app on running emulator don't expect to see your
"BootCompletedBroadcastReceiver" in action. First: deploy your app. Second:
close emulator. Third: run emulator with command: emulator -avd
your_emulator_name

2010/7/21 A N K ! T <ankit.awasth...@gmail.com>

>



am trying to start my service on device boot up.

by mac-systems » Wed, 21 Jul 2010 19:10:45 GMT


 Add:

        <uses-permission
                android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

To you Manifest

--


Sponsored Links


Other Threads

1. What's the trick for viewing my location?

I've got my map working in the emulator, I can place various markers and all
that good stuff, but I can't see my location.  All of the code I see says
all I have to do is

        me=new MyLocationOverlay(this, map);
        map.getOverlays().add(me);

and a blue dot will magically appear on my map.  Well, it doesn't.

I've used DDMS to set the location to a known location.  I've placed a
marker at that location to prove I now what I'm doing.

I've got me.enableCompass and me.enableMyLocation in my onResume.  Oh, and I
don't see the compass, either.

What's the trick?

-- 

Faber Fedor
Cloud Computing New Jersey
http://cloudcomputingnj.com

--~--~---------~--~----~------------~-------~--~----~

2. Null Pointer Exception/ Crashing problem

When I try to run the following code My program eather crashes or
throws a null pointer exception in the LogCat.

public class The_Perfect_Tip extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

                EditText billAmt = new EditText(this);
                EditText precentage = new EditText(this);
                TextView Ans = new TextView(this);
                double billNum = 0;
                double preNum = 0;


                billNum = Double.parseDouble(((EditText)findViewById
(R.id.BillAmt)).getText().toString());

                preNum = Double.parseDouble(((EditText)findViewById
(R.id.Precentage)).getText().toString());


                ((TextView)findViewById(R.id.Ans)).setText(""+billNum * (preNum 
/
100));

                setContentView(R.layout.main);
    }
}

Why is there a null pointer excetpion being thrown?
--~--~---------~--~----~------------~-------~--~----~

3. Performance Problem with ListView / Styled TextView

4. Activity callback anomaly

5. Changes to Google's apps?

6. Not a big problem.

7. Unable to reconstruct bitmap from ksop2 response