Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'widget'

  • Loading branch information...
commit dd97b3300fffe854d7e4f5e6944ddb75cd992fb6 2 parents ba9632d + 94090a7
@gregkh authored
Showing with 466 additions and 64 deletions.
  1. +3 −0  .gitignore
  2. +18 −2 AndroidManifest.xml
  3. BIN  res/drawable-hdpi/menu_about.png
  4. BIN  res/drawable-hdpi/menu_add.png
  5. BIN  res/drawable-hdpi/menu_close.png
  6. BIN  res/drawable-hdpi/menu_preferences.png
  7. BIN  res/drawable-ldpi/menu_about.png
  8. BIN  res/drawable-ldpi/menu_add.png
  9. BIN  res/drawable-ldpi/menu_close.png
  10. BIN  res/drawable-ldpi/menu_preferences.png
  11. 0  res/{drawable-mdpi → drawable}/menu_about.png
  12. 0  res/{drawable-mdpi → drawable}/menu_add.png
  13. 0  res/{drawable-mdpi → drawable}/menu_close.png
  14. 0  res/{drawable-mdpi → drawable}/menu_preferences.png
  15. +7 −0 res/drawable/widget_bg.xml
  16. BIN  res/drawable/widget_bg_normal.9.png
  17. BIN  res/drawable/widget_bg_pressed.9.png
  18. BIN  res/drawable/widget_bg_selected.9.png
  19. +18 −0 res/layout/config.xml
  20. +6 −5 res/layout/main.xml
  21. +29 −0 res/layout/widget.xml
  22. +7 −0 res/values/colors.xml
  23. +6 −1 res/values/strings.xml
  24. +22 −0 res/values/styles.xml
  25. +8 −0 res/xml/widget.xml
  26. +40 −56 src/com/kroah/clock/Clock.java
  27. +107 −0 src/com/kroah/clock/Configure.java
  28. +94 −0 src/com/kroah/clock/MedAppWidget.java
  29. +101 −0 src/com/kroah/clock/UpdateService.java
View
3  .gitignore
@@ -0,0 +1,3 @@
+bin/
+gen/
+*.swp
View
20 AndroidManifest.xml
@@ -3,7 +3,22 @@
package="com.kroah.clock"
android:versionCode="1"
android:versionName="001">
- <application android:icon="@drawable/icon" android:label="@string/app_name">
+ <application android:icon="@drawable/icon" android:label="@string/app_name" android:description="@string/app_descrip">
+
+ <service android:name=".UpdateService" />
+
+ <receiver android:name=".MedAppWidget">
+ <intent-filter>
+ <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
+ </intent-filter>
+ <meta-data android:name="android.appwidget.provider"
+ android:resource="@xml/widget"/>
+ </receiver>
+ <activity android:name=".Configure">
+ <intent-filter>
+ <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
+ </intent-filter>
+ </activity>
<activity android:name=".Clock"
android:label="@string/app_name">
<intent-filter>
@@ -13,7 +28,8 @@
</activity>
</application>
-
+
+ <uses-permission android:name="android.permission.INTERNET"/>
<!--<uses-permission android:name="android.permission.BATTERY_STATS"/> -->
<!--<uses-permission android:name="android.permission_group.STORAGE"/> -->
View
BIN  res/drawable-hdpi/menu_about.png
Deleted file not rendered
View
BIN  res/drawable-hdpi/menu_add.png
Deleted file not rendered
View
BIN  res/drawable-hdpi/menu_close.png
Deleted file not rendered
View
BIN  res/drawable-hdpi/menu_preferences.png
Deleted file not rendered
View
BIN  res/drawable-ldpi/menu_about.png
Deleted file not rendered
View
BIN  res/drawable-ldpi/menu_add.png
Deleted file not rendered
View
BIN  res/drawable-ldpi/menu_close.png
Deleted file not rendered
View
BIN  res/drawable-ldpi/menu_preferences.png
Deleted file not rendered
View
0  res/drawable-mdpi/menu_about.png → res/drawable/menu_about.png
File renamed without changes
View
0  res/drawable-mdpi/menu_add.png → res/drawable/menu_add.png
File renamed without changes
View
0  res/drawable-mdpi/menu_close.png → res/drawable/menu_close.png
File renamed without changes
View
0  res/drawable-mdpi/menu_preferences.png → res/drawable/menu_preferences.png
File renamed without changes
View
7 res/drawable/widget_bg.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_window_focused="false" android:drawable="@drawable/widget_bg_normal" />
+ <item android:state_pressed="true" android:drawable="@drawable/widget_bg_pressed" />
+ <item android:state_focused="true" android:drawable="@drawable/widget_bg_selected" />
+ <item android:drawable="@drawable/widget_bg_normal" />
+</selector>
View
BIN  res/drawable/widget_bg_normal.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  res/drawable/widget_bg_pressed.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  res/drawable/widget_bg_selected.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
18 res/layout/config.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ >
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/configure"
+ />
+ <Button
+ android:id="@+id/myButton"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/ok"
+ />
+</LinearLayout>
View
11 res/layout/main.xml
@@ -9,9 +9,10 @@
android:layout_height="wrap_content"
android:text="@string/hello"
/>
- <ListView
- android:id="@+id/myListView"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- />
+ <Button
+ android:id="@+id/myButton"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/ok"
+ />
</LinearLayout>
View
29 res/layout/widget.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/widget"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:focusable="true"
+ style="@style/WidgetBackground">
+
+ <TextView
+ android:id="@+id/time"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:includeFontPadding="false"
+ android:gravity="center_horizontal"
+ android:text="@string/widget_time"
+ android:padding="4dip"
+ style="@style/Text.Time" />
+ <TextView
+ android:id="@+id/date"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:includeFontPadding="false"
+ android:gravity="center_horizontal"
+ android:text="@string/widget_date"
+ android:padding="4dip"
+ style="@style/Text.Date"/>
+</LinearLayout>
+
View
7 res/values/colors.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="black">#f000</color>
+ <color name="white">#ffff</color>
+ <color name="semi_white">#f888</color>
+ <color name="semi_black">#f666</color>
+</resources>
View
7 res/values/strings.xml
@@ -1,9 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <string name="hello">List of watched timezones here?</string>
+ <string name="hello"> This is a Widget, so there is nothing to do here</string>
+ <string name="configure">This is the configure screen</string>
<string name="app_name">World Clock</string>
+ <string name="app_descrip">A World Clock desktop widget</string>
<string name="ok">Ok</string>
<string name="about">This is a tiny widget to figure out what the time is in different parts of the world.</string>
<string name="about_title">About World Clock</string>
+ <string name="widget_loading">loading...</string>
+ <string name="widget_date">date</string>
+ <string name="widget_time">time</string>
</resources>
View
22 res/values/styles.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<resources>
+
+ <style name="WidgetBackground">
+ <item name="android:background">@drawable/widget_bg</item>
+ </style>
+
+ <style name="Text">
+ </style>
+
+ <style name="Text.Time">
+ <item name="android:textSize">10sp</item>
+ <item name="android:textColor">@color/white</item>
+ </style>
+
+ <style name="Text.Date">
+ <item name="android:textSize">10sp</item>
+ <item name="android:textColor">@color/white</item>
+ </style>
+
+</resources>
View
8 res/xml/widget.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
+ android:minWidth="72dip"
+ android:minHeight="72dip"
+ android:updatePeriodMillis="0"
+ android:initialLayout="@layout/widget"
+ android:configure="com.kroah.clock.Configure" />
View
96 src/com/kroah/clock/Clock.java
@@ -1,21 +1,22 @@
package com.kroah.clock;
-import java.util.ArrayList;
-
import android.app.Activity;
import android.os.Bundle;
+import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
-import android.widget.ArrayAdapter;
-import android.widget.ListView;
+import android.view.View;
+import android.widget.Button;
import android.app.AlertDialog;
import android.content.DialogInterface;
+import android.content.Intent;
import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnClickListener;
public class Clock extends Activity {
+ public static final String MODULE = "GREGKHMainScreen";
// Display a simple "About" dialog
final void about() {
@@ -36,67 +37,50 @@ public void onCancel(DialogInterface Dialog) {
});
ad.show();
}
-
- static final private int MENU_ADD = 0;
- static final private int MENU_SETTINGS = 1;
- static final private int MENU_ABOUT = 2;
- static final private int MENU_EXIT = 3;
-
+
+ static final private int MENU_ABOUT = 0;
+ static final private int MENU_EXIT = 1;
+ static final private int MENU_CONFIG = 2;
+
/* Creates the menu items */
public boolean onCreateOptionsMenu(Menu menu) {
- menu.add(0, MENU_ADD, 0, "Add").setIcon(R.drawable.menu_add);
- menu.add(0, MENU_SETTINGS, 0, "Settings").setIcon(R.drawable.menu_preferences);
menu.add(0, MENU_ABOUT, 0, "About").setIcon(R.drawable.menu_about);
menu.add(0, MENU_EXIT, 0, "Exit").setIcon(R.drawable.menu_close);
+ menu.add(0, MENU_CONFIG, 0, "Configure");
return true;
}
/* Handles item selections */
public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case MENU_ADD:
- timezone_list.add(0, "timezone foo");
- timezone_adapter.notifyDataSetChanged();
- return true;
- case MENU_SETTINGS:
- //settings();
- return true;
- case MENU_ABOUT:
- about();
- return true;
- case MENU_EXIT:
- finish();
- return true;
- }
- return false;
+ switch (item.getItemId()) {
+ case MENU_ABOUT:
+ about();
+ return true;
+ case MENU_EXIT:
+ finish();
+ return true;
+ case MENU_CONFIG:
+ Intent intent = new Intent(this, Configure.class);
+ startActivity(intent);
+ return true;
+ }
+ return false;
}
-
- private ArrayList<String> timezone_list;
- private ArrayAdapter<String> timezone_adapter;
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
-
- ListView myListView = (ListView)findViewById(R.id.myListView);
-
- timezone_list = new ArrayList<String>();
- timezone_adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, timezone_list);
- myListView.setAdapter(timezone_adapter);
+ private Button okButton;
+
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main);
- timezone_list.add(0, "timezone 1");
- timezone_list.add(0, "timezone 2");
- timezone_list.add(0, "timezone 3");
- timezone_list.add(0, "timezone 4");
- timezone_list.add(0, "timezone 5");
- timezone_list.add(0, "timezone 6");
- timezone_list.add(0, "timezone 7");
- timezone_list.add(0, "timezone 8");
- timezone_list.add(0, "timezone 9");
- timezone_list.add(0, "timezone10");
- timezone_list.add(0, "timezone22");
- timezone_adapter.notifyDataSetChanged();
- }
-}
+ okButton = (Button)findViewById(R.id.myButton);
+ okButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ Log.d(MODULE, "button clicked");
+ finish();
+ }
+ });
+ }
+}
View
107 src/com/kroah/clock/Configure.java
@@ -0,0 +1,107 @@
+package com.kroah.clock;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.Button;
+import android.app.AlertDialog;
+import android.appwidget.AppWidgetManager;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.DialogInterface.OnCancelListener;
+import android.content.DialogInterface.OnClickListener;
+
+public class Configure extends Activity {
+
+ public static final String MODULE = "GREGKHConfigureScreen";
+ public static int mAppWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID;
+ private Button okButton;
+
+ // Display a simple "About" dialog
+ final void about() {
+ AlertDialog.Builder ad = new AlertDialog.Builder(Configure.this);
+ ad.setTitle(getString(R.string.about_title));
+ ad.setMessage(getString(R.string.about));
+ ad.setPositiveButton(getString(R.string.ok),
+ new OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ // nothing
+ }
+ });
+ ad.setCancelable(true);
+ ad.setOnCancelListener(new OnCancelListener() {
+ public void onCancel(DialogInterface Dialog) {
+ // nothing
+ }
+ });
+ ad.show();
+ }
+
+ static final private int MENU_SETTINGS = 1;
+ static final private int MENU_ABOUT = 2;
+ static final private int MENU_EXIT = 3;
+
+ /* Creates the menu items */
+ public boolean onCreateOptionsMenu(Menu menu) {
+ menu.add(0, MENU_SETTINGS, 0, "Settings").setIcon(R.drawable.menu_preferences);
+ menu.add(0, MENU_ABOUT, 0, "About").setIcon(R.drawable.menu_about);
+ menu.add(0, MENU_EXIT, 0, "Exit").setIcon(R.drawable.menu_close);
+ return true;
+ }
+
+ /* Handles item selections */
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case MENU_SETTINGS:
+ //settings();
+ return true;
+ case MENU_ABOUT:
+ about();
+ return true;
+ case MENU_EXIT:
+ Intent result = new Intent();
+ result.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId);
+ setResult(RESULT_OK, result);
+ finish();
+ return true;
+ }
+ return false;
+ }
+
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ Log.d(MODULE, "onCreate:enter");
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.config);
+
+ // Find the widget id from the intent.
+ Intent intent = getIntent();
+ Bundle extras = intent.getExtras();
+ if (extras != null) {
+ Log.d(MODULE, "onCreate:extras != null");
+ mAppWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
+ }
+ // If they gave us an intent without the widget id, get out
+ if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
+ Log.d(MODULE, "onCreatea:mAppWidgetId == INVALID");
+ finish();
+ }
+
+ okButton = (Button)findViewById(R.id.myButton);
+ okButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ Log.d(MODULE, "ok button clicked");
+ Intent result = new Intent();
+ result.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId);
+ setResult(RESULT_OK, result);
+ Log.d(MODULE, "ok button finishing");
+ finish();
+ }
+ });
+ Log.d(MODULE, "onCreate:exit");
+ }
+}
View
94 src/com/kroah/clock/MedAppWidget.java
@@ -0,0 +1,94 @@
+package com.kroah.clock;
+
+import android.app.PendingIntent;
+import android.appwidget.AppWidgetManager;
+import android.appwidget.AppWidgetProvider;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+import android.widget.RemoteViews;
+
+public class MedAppWidget extends AppWidgetProvider {
+
+ public static final String MODULE = "GREGKHWidget";
+
+ @Override
+ public void onUpdate(Context context,
+ AppWidgetManager appWidgetManager,
+ int[] appWidgetIds) {
+ Log.d(MODULE, "onUpdate:enter");
+ if (appWidgetIds == null) {
+ appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, MedAppWidget.class));
+ }
+
+ // Tie clicking on the button to bring up our configure screen
+ RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget);
+ if (views == null)
+ Log.d(MODULE, "buildUpdate:views == null");
+ Intent intent = new Intent(context, Configure.class);
+ if (intent == null)
+ Log.d(MODULE, "buildUpdate:intent == null");
+ intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, Configure.mAppWidgetId);
+ PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
+ if (pendingIntent == null)
+ Log.d(MODULE, "buildUpdate:pendingIntent == null");
+ views.setOnClickPendingIntent(R.id.time, pendingIntent);
+
+// UpdateService.requestUpdate(appWidgetIds);
+ context.startService(new Intent(context, UpdateService.class));
+ Log.d(MODULE, "onUpdate:exit");
+ }
+
+ public static RemoteViews buildUpdate(Context context) {
+
+ Log.d(MODULE, "buildUpdate:enter");
+ RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget);
+ if (views == null)
+ Log.d(MODULE, "buildUpdate:views == null");
+
+// ContentResolver resolver = context.getContentResolver();
+// Resources res = context.getResources();
+// Cursor cursor = null;
+
+ // Tie clicking on the button to bring up our configure screen
+ Intent intent = new Intent(context, Configure.class);
+ if (intent == null)
+ Log.d(MODULE, "buildUpdate:intent == null");
+ intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, Configure.mAppWidgetId);
+ PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
+ if (pendingIntent == null)
+ Log.d(MODULE, "buildUpdate:pendingIntent == null");
+ views.setOnClickPendingIntent(R.id.time, pendingIntent);
+
+// Intent result = new Intent();
+// result.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId);
+
+ Log.d(MODULE, "buildUpdate:exit");
+ return views;
+
+ }
+
+// final int num_ids = appWidgetIds.length;
+// for (int i = 0; i < num_ids; i++) {
+//
+// int appWidgetId = appWidgetIds[i];
+//
+// Timer timer = new Timer();
+// timer.scheduleAtFixedRate(new myTime(context, appWidgetManager), 1, 10000);
+//
+// // Create a remote view
+// RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_loading);
+
+//
+// // set the time
+//// DateFormat format = SimpleDateFormat.getTimeInstance(SimpleDateFormat.MEDIUM, Locale.getDefault());
+//// views.setTextViewText(R.id.loading, format.format(new Date()));
+// // TODO update the UI
+//
+// appWidgetManager.updateAppWidget(appWidgetId, views);
+// }
+// }
+
+}
+
View
101 src/com/kroah/clock/UpdateService.java
@@ -0,0 +1,101 @@
+package com.kroah.clock;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+import android.app.AlarmManager;
+import android.app.PendingIntent;
+import android.app.Service;
+import android.appwidget.AppWidgetManager;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.os.IBinder;
+import android.text.format.DateUtils;
+import android.text.format.Time;
+import android.util.Log;
+import android.widget.RemoteViews;
+
+
+public class UpdateService extends Service implements Runnable {
+ private static final String MODULE = "GREGKHUpdateService";
+
+ private static final long UPDATE_INTERVAL = DateUtils.MINUTE_IN_MILLIS;
+
+ // Our lock for the list of times.
+ private static Object lock = new Object();
+ private static boolean thread_running;
+
+ public static final String ACTION_UPDATE_ALL = "com.kroah.clock.UPDATE_ALL";
+
+ @Override
+ public void onStart(Intent intent, int startId) {
+ Log.d(MODULE, "onStart:enter");
+ RemoteViews updateViews = new RemoteViews(this.getPackageName(), R.layout.widget);
+ Date date = new Date();
+ DateFormat format = SimpleDateFormat.getTimeInstance(SimpleDateFormat.MEDIUM, Locale.getDefault());
+
+ updateViews.setTextViewText(R.id.time, format.format(date));
+
+ ComponentName thisWidget = new ComponentName(this, MedAppWidget.class);
+ AppWidgetManager manager = AppWidgetManager.getInstance(this);
+ manager.updateAppWidget(thisWidget, updateViews);
+ synchronized (lock) {
+ if (!thread_running) {
+ thread_running = true;
+ new Thread(this).start();
+ }
+ }
+ Log.d(MODULE, "onStart:exit");
+ }
+
+ public void run() {
+ Log.d(MODULE, "run:enter");
+
+ AppWidgetManager manager = AppWidgetManager.getInstance(this);
+// ContentResolver resolve = getContentResolver();
+
+ RemoteViews updateViews = null;
+
+ updateViews = MedAppWidget.buildUpdate(this);
+
+ // Draw the updated time
+
+// RemoteViews updateViews = new RemoteViews(this.getPackageName(), R.layout.widget_loading);
+ Date date = new Date();
+ DateFormat format = SimpleDateFormat.getTimeInstance(SimpleDateFormat.MEDIUM, Locale.getDefault());
+
+ updateViews.setTextViewText(R.id.time, format.format(date));
+
+
+ ComponentName thisWidget = new ComponentName(this, MedAppWidget.class);
+ manager.updateAppWidget(thisWidget, updateViews);
+
+ // Schedule our next update
+ Time time = new Time();
+ time.set(System.currentTimeMillis() + UPDATE_INTERVAL);
+ time.second = 0;
+ long nextUpdate = time.toMillis(false);
+
+ Intent updateIntent = new Intent(ACTION_UPDATE_ALL);
+ updateIntent.setClass(this, UpdateService.class);
+ PendingIntent pendingIntent = PendingIntent.getService(this, 0, updateIntent, 0);
+
+ AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
+ alarmManager.set(AlarmManager.RTC_WAKEUP, nextUpdate, pendingIntent);
+
+ thread_running = false;
+ stopSelf();
+ Log.d(MODULE, "run:exit");
+ }
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ // TODO Auto-generated method stub
+ Log.d(MODULE, "onBind:enter");
+ Log.d(MODULE, "onBind:exit");
+ return null;
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.