Micha Kops avatar Micha Kops committed 924b7ad

Initial import

Comments (0)

Files changed (13)

+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="gen"/>
+	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+	<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+	<classpathentry kind="output" path="bin/classes"/>
+</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>android-scheduling-tutorial</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.ApkBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

AndroidManifest.xml

+<?xml version="1.0" encoding="utf-8"?>
+<manifest package="com.hascode.android"
+    android:versionCode="1"
+    android:versionName="1.0" xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <uses-sdk android:minSdkVersion="8" />
+
+    <application
+        android:debuggable="true"
+        android:icon="@drawable/ic_launcher"
+        android:label="@string/app_name">
+ 
+        <service android:name="SchedulerEventService" android:process=":hascode_process">
+        </service>
+
+        <receiver android:name="SchedulerEventReceiver" android:process=":hascode_process">
+        </receiver>
+        <receiver android:name="SchedulerSetupReceiver" android:process=":hascode_process">
+            <intent-filter >
+                <action android:name="android.intent.action.BOOT_COMPLETED" />
+                <action android:name="android.intent.action.USER_PRESENT" />
+            </intent-filter>
+        </receiver>
+    </application>
+
+</manifest>
+-optimizationpasses 5
+-dontusemixedcaseclassnames
+-dontskipnonpubliclibraryclasses
+-dontpreverify
+-verbose
+-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
+
+-keep public class * extends android.app.Activity
+-keep public class * extends android.app.Application
+-keep public class * extends android.app.Service
+-keep public class * extends android.content.BroadcastReceiver
+-keep public class * extends android.content.ContentProvider
+-keep public class * extends android.app.backup.BackupAgentHelper
+-keep public class * extends android.preference.Preference
+-keep public class com.android.vending.licensing.ILicensingService
+
+-keepclasseswithmembernames class * {
+    native <methods>;
+}
+
+-keepclasseswithmembers class * {
+    public <init>(android.content.Context, android.util.AttributeSet);
+}
+
+-keepclasseswithmembers class * {
+    public <init>(android.content.Context, android.util.AttributeSet, int);
+}
+
+-keepclassmembers class * extends android.app.Activity {
+   public void *(android.view.View);
+}
+
+-keepclassmembers enum * {
+    public static **[] values();
+    public static ** valueOf(java.lang.String);
+}
+
+-keep class * implements android.os.Parcelable {
+  public static final android.os.Parcelable$Creator *;
+}

project.properties

+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-8
Add a comment to this file

res/drawable-hdpi/ic_launcher.png

Added
New image
Add a comment to this file

res/drawable-ldpi/ic_launcher.png

Added
New image
Add a comment to this file

res/drawable-mdpi/ic_launcher.png

Added
New image

res/layout/main.xml

+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="vertical" >
+
+    <TextView
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:text="@string/hello" />
+
+</LinearLayout>

res/values/strings.xml

+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <string name="hello">Hello World!</string>
+    <string name="app_name">hasCode Scheduling Tutorial</string>
+    <string name="process_name">hascode-scheduler-process</string>
+
+</resources>

src/com/hascode/android/SchedulerEventReceiver.java

+package com.hascode.android;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
+public class SchedulerEventReceiver extends BroadcastReceiver {
+	private static final String APP_TAG = "com.hascode.android";
+
+	@Override
+	public void onReceive(final Context ctx, final Intent intent) {
+		Log.d(APP_TAG, "SchedulerEventReceiver.onReceive() called");
+		Intent eventService = new Intent(ctx, SchedulerEventService.class);
+		ctx.startService(eventService);
+	}
+
+}

src/com/hascode/android/SchedulerEventService.java

+package com.hascode.android;
+
+import java.util.Date;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.IBinder;
+import android.util.Log;
+
+public class SchedulerEventService extends Service {
+	private static final String APP_TAG = "com.hascode.android.scheduler";
+
+	@Override
+	public IBinder onBind(final Intent intent) {
+		return null;
+	}
+
+	@Override
+	public int onStartCommand(final Intent intent, final int flags,
+			final int startId) {
+		Log.d(APP_TAG, "event received in service: " + new Date().toString());
+		return Service.START_NOT_STICKY;
+	}
+
+}

src/com/hascode/android/SchedulerSetupReceiver.java

+package com.hascode.android;
+
+import java.util.Calendar;
+
+import android.app.AlarmManager;
+import android.app.PendingIntent;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
+public class SchedulerSetupReceiver extends BroadcastReceiver {
+	private static final String APP_TAG = "com.hascode.android";
+
+	private static final int EXEC_INTERVAL = 20 * 1000;
+
+	@Override
+	public void onReceive(final Context ctx, final Intent intent) {
+		Log.d(APP_TAG, "SchedulerSetupReceiver.onReceive() called");
+		AlarmManager alarmManager = (AlarmManager) ctx
+				.getSystemService(Context.ALARM_SERVICE);
+		Intent i = new Intent(ctx, SchedulerEventReceiver.class); // explicit
+																	// intent
+		PendingIntent intentExecuted = PendingIntent.getBroadcast(ctx, 0, i,
+				PendingIntent.FLAG_CANCEL_CURRENT);
+		Calendar now = Calendar.getInstance();
+		now.add(Calendar.SECOND, 20);
+		alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
+				now.getTimeInMillis(), EXEC_INTERVAL, intentExecuted);
+	}
+
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.