I am trying to follow the example given here on running some code in fixed time intervals. I used the code in this example (setting the waiting time to 1 minute instead), compiled it, started in on my phone, stopped the application on the phone, and waited for several minutes.
However, no Toast
was shown and neither any log-entry. I also notice that the Service.onStart
seems depreciated.
Is something missing in the example? Do I need to register something when the main activity of the app is started? Or call it from somewhere else in my app? Or maybe something is wrong in the manifest?
AndroidManifest.xml
:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mypackage.test" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application>
android:allowBackup="true"
android:icon="@mipmap/stoxx"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light" >
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".NewEntryActivity"
android:label="@string/menu_add"
android:theme="@style/AppTheme.NoActionBar"
/>
<activity
android:name=".UserSettingActivity"
android:label="@string/menu_add"
android:theme="@style/AppTheme.NoActionBar"
/>
<receiver
android:process=":remote"
android:name=".Alarm">
</receiver>
</application>
</manifest>