> > Why is it that when I run this it starts the app then promptly crashes it > about 30 seconds later also why is the app not going to the background > instead of staying up front? >
What does Logcat say? Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Fri, Jul 13, 2012 at 2:42 PM, Cythes <[email protected]> wrote: > Alright I got a good bit of help in my last question so instead of beat my > head against the wall I have decided it would be better to post my code for > my auto starter / service / manifest here and see what I can get. It goes > like this: Auto starter(Just fixed) --> Service --> Main activity > > So I am not so much worried about the first and last steps as they are > both taken care of. I just need to figure out how to get the auto starter > to run the service which ties the main activity to the background. So the > question: Why is it that when I run this it starts the app then promptly > crashes it about 30 seconds later also why is the app not going to the > background instead of staying up front? here is the code: > > package path.to.file; > > import android.app.Service; > import android.content.Intent; > import android.os.IBinder; > import android.util.Log; > > public class Monitor extends Service { > > private static final String LOG_TAG = "::Monitor"; > > @Override > public void onCreate() { > > super.onCreate(); > > Log.e(LOG_TAG, "Service created."); > > Intent i = new Intent(); > > i.setAction("path.to.file.MainActivity"); > > i.addCategory(Intent.CATEGORY_HOME); > > startActivity(i); > } > > @Override > public void onStart(Intent intent, int startId) { > > super.onStartCommand(intent, startId, startId); > > Log.e(LOG_TAG, "Service started."); > } > > @Override > public void onDestroy() { > > super.onDestroy(); > > Log.e(LOG_TAG, "Service destroyed."); > } > > @Override > public IBinder onBind(Intent intent) { > > Log.e(LOG_TAG, "Service bind."); > > return null; > } > } > > As well as the updated manifest: > > <manifest xmlns:android="http://schemas.android.com/apk/res/android" > installlocation="internalOnly" > package="path.to.file" > 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" > > > <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.LAUNCHER" /> > > </intent-filter> > </activity> > > <service android:name="Monitor" > > > <intent-filter> > <action android:name="path.to.file.Monitor" > > > </action> > </intent-filter> > > </service> > > <receiver android:name="autoBot" > > > <intent-filter> > <action android:name="android.intent.action.BOOT_COMPLETED" > > > </action> > </intent-filter> > > </receiver> > </application> > > </manifest> > > -- > 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 -- 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

