Permalink
Browse files

Initial commit of the code

  • Loading branch information...
1 parent da7e934 commit 2bb74d1877bf6bc966ffd409be82518030966066 unknown committed May 13, 2010
View
@@ -0,0 +1,8 @@
+<?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="lib" path="wmqtt.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
View
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>AndroidPushNotificationsDemo</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>
View
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.tokudu.demo"
+ android:versionCode="1"
+ android:versionName="1.0">
+ <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
+ <activity android:name=".PushActivity"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.Light.NoTitleBar"
+ android:launchMode="singleTop"
+ >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <service android:name=".PushService" android:label="Tokudu Push Notifications Service"></service>
+ </application>
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+ <uses-sdk android:minSdkVersion="3"/>
+
+</manifest>
View
@@ -0,0 +1,13 @@
+# 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,
+# "build.properties", and override values to adapt the script to your
+# project structure.
+
+# Indicates whether an apk should be generated for each density.
+split.density=false
+# Project target.
+target=android-3
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -0,0 +1,63 @@
+<?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"
+ android:background="@color/background_color"
+ >
+
+ <ImageView android:id="@+id/logo"
+ android:src="@drawable/logo"
+ android:layout_centerHorizontal="true"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginTop="5dip"
+ />
+
+ <TextView android:id="@+id/targetlabel_text"
+ android:text = "@string/target"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginTop="5dip"
+ android:textColor="@color/text_color"
+ />
+
+ <TextView android:id="@+id/target_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginTop="5dip"
+ android:textStyle="bold"
+ android:textColor="@color/text_color"
+ />
+
+ <Button android:id="@+id/start_button"
+ android:text="@string/start_service"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginTop="5dip"
+ />
+
+ <Button android:id="@+id/stop_button"
+ android:text="@string/stop_service"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginTop="5dip"
+ />
+
+ <TextView android:id="@+id/aboutlabel_text"
+ android:text = "@string/about"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginTop="5dip"
+ android:textColor="@color/text_color"
+ />
+
+
+</LinearLayout>
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+<color name="background_color">#a2d03b</color>
+<color name="text_color">#FFFFFF</color>
+</resources>
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="hello">Hello World, PushActivity!</string>
+ <string name="app_name">Push Demo</string>
+<string name="target">Your Device Target:</string>
+<string name="stop_service">Stop Push Service</string>
+<string name="start_service">Start Push service</string>
+<string name="about">www.tokudu.com</string>
+</resources>
@@ -0,0 +1,57 @@
+package com.tokudu.demo;
+
+import android.app.Activity;
+import android.content.SharedPreferences;
+import android.content.SharedPreferences.Editor;
+import android.os.Bundle;
+import android.provider.Settings.Secure;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.TextView;
+
+public class PushActivity extends Activity {
+ private String mDeviceID;
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main);
+
+ mDeviceID = Secure.getString(this.getContentResolver(), Secure.ANDROID_ID);
+ ((TextView) findViewById(R.id.target_text)).setText(mDeviceID);
+
+ final Button startButton = ((Button) findViewById(R.id.start_button));
+ final Button stopButton = ((Button) findViewById(R.id.stop_button));
+ startButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Editor editor = getSharedPreferences(PushService.TAG, MODE_PRIVATE).edit();
+ editor.putString(PushService.PREF_DEVICE_ID, mDeviceID);
+ editor.commit();
+ PushService.actionStart(getApplicationContext());
+ startButton.setEnabled(false);
+ stopButton.setEnabled(true);
+ }
+ });
+ stopButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ PushService.actionStop(getApplicationContext());
+ startButton.setEnabled(true);
+ stopButton.setEnabled(false);
+ }
+ });
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+ SharedPreferences p = getSharedPreferences(PushService.TAG, MODE_PRIVATE);
+ boolean started = p.getBoolean(PushService.PREF_STARTED, false);
+
+ ((Button) findViewById(R.id.start_button)).setEnabled(!started);
+ ((Button) findViewById(R.id.stop_button)).setEnabled(started);
+ }
+}
Oops, something went wrong.

0 comments on commit 2bb74d1

Please sign in to comment.