Alright here I am after a good 8 hours of editing (Yeah I'm new......so sue
me...) I'm working on this service that starts on start up. Keep in mind I
am on my live phone so I DONT have logcat. On top of this it is a Rooted
phone so if that changes anything then I guess I will burn that bridge
after I cross it. Till then I could use a hand.
Here is the service code......once again:
import android.app.Service;
import android.content.Intent;
import android.net.Uri;
import android.os.IBinder;
import android.os.Vibrator;
import android.util.Log;
import android.view.KeyEvent;
import android.widget.Toast;
public class Monitor extends Service {
private static final String LOG_TAG = "::Monitor";
@Override
public void onCreate() {
super.onCreate();
Log.e(LOG_TAG, "Service created.");
}
public void onStartCommand() {
Log.e(LOG_TAG, "Service started.");
Toast.makeText(this, "Test launch started", 600).show();
}
boolean dispatchKeyEventTake2(KeyEvent event) {
int action = event.getAction();
int keyCode = event.getKeyCode();
int ticker = event.getRepeatCount();
final Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
switch (keyCode) {
case KeyEvent.KEYCODE_VOLUME_DOWN:
if (action == KeyEvent.ACTION_DOWN && ticker == 50) {
Intent MainIntent = new Intent("help.me.please.MainActivity");
MainIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(MainIntent);
}
return true;
default:
return this.dispatchKeyEventTake2(event);
}
}
@Override
public IBinder onBind(Intent intent) {
Log.e(LOG_TAG, "Service bind.");
return null;
}
}
As well as the manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
installlocation="internalOnly"
package="help.me.please"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="15" />
<uses-permission
android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<service android:name=".Monitor" >
<intent-filter>
<action android:name="help.me.please.Monitor" >
</action>
</intent-filter>
</service>
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<receiver android:name="autoBot" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"
>
</action>
</intent-filter>
</receiver>
</application>
</manifest>
Basically the program runs starts the service but wont start the intent in
the service. Any ideas?
--
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