automatic start using Alaram Manager problem

by Honest » Fri, 23 Jan 2009 12:53:59 GMT


Sponsored Links
 I created one application to start application After particular time
interval. My application working fine but it does not do particular
work
after particular time. I mean it does not used to start automatically
after the time which i set in AlaramManager.

My coding and xml file is as below.


The following is the code of my mail class which extends Activity. I
have done following thing in it

try
{




Intent intent = new Intent(Lalu_Android.this, OneShotAlarm.class);
PendingIntent sender = PendingIntent.getBroadcast(Lalu_Android.this,
0, intent, 0);

// We want the alarm to go off 30 seconds from now.
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.add(Calendar.SECOND, 15);

// Schedule the alarm!
AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);
am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), sender);
tv.setText("Successful");
setContentView(tv);
//finish();

}
catch(Exception e)
{

tv.setText("Url not called successfully");
setContentView(tv);

}


The following is a class which extends BroadcastReceiver . Which
should
be invoked after particular time.

public class OneShotAlarm extends BroadcastReceiver
{
//Lalu_Android la=new Lalu_Android();
CallUrl ca;

//TextView tv = new TextView();
public void onReceive(Context context, Intent intent)
{
System.out.println("In one shot alaram");
Toast.makeText(context, "Alaram", Toast.LENGTH_SHORT).show();
ca=new CallUrl();
//Toast.makeText(context, R.string.one_shot_received,
Toast.LENGTH_SHORT).show();
/*Intent smsIntent = new Intent();
smsIntent.setClassName("com.android.hello",
"com.android.hello.SendSms");
//startActivity(smsIntent);
//la. */
}
}


The CallUrl is a another class which i want to execute its method
onCreate() when application starts by AlaramManager so i create the
object of it in the OneShotAlaram.


The following my xml file.



<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=" http://schemas.android.com/apk/res/android" ;
package="com.saltriver.android"
android:versionCode="1"
android:versionName="1.0.0">
<application android:icon="@drawable/icon"
android:label="@string/app_name">
<activity android:name=".Lalu_Android"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission
android:name="android.permission.INTERNET"></uses-permission>
<receiver android:name=".OneShotAlarm" />

</manifest>


I am in the big trouble i hope some one will reply me as early as
possible.
--~--~---------~--~----~------------~-------~--~----~



automatic start using Alaram Manager problem

by Honest » Fri, 23 Jan 2009 19:00:32 GMT


 I hope some one will reply me as early as possible.
--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


automatic start using Alaram Manager problem

by AlexeyB » Sat, 24 Jan 2009 08:20:29 GMT


 Try to move your service declaration in the manifest under application
tag. Regards.




--~--~---------~--~----~------------~-------~--~----~



automatic start using Alaram Manager problem

by Honest » Mon, 26 Jan 2009 14:21:14 GMT


 



Actually i did not declare any <service> there so can you tell me what
i am missing there ? Sorry if am asking you basic question but i am
just newbie in android.


--~--~---------~--~----~------------~-------~--~----~



automatic start using Alaram Manager problem

by AlexeyMot » Tue, 27 Jan 2009 04:27:40 GMT


 Move "<receiver android:name=".OneShotAlarm" /> " declaration under
<application></application>







--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. problems with MapActivity in 1.0_r1 eclipse 3.3.2

So I am having a strange behavior which I cannot explain and it only
happens when I try to extend the MapActivity class. This is super
simple stuff so I am bewildered why this is happening. The class is
clearly there if you use the resources tab so I am curious why the
Classloader fails to include it. If I dont extend from MapActivity
and point to another layout it all works. Is there a trick here?

package com.noi.android.maptest;

import android.os.Bundle;

import com.google.android.maps.MapActivity;

public class MapTest extends MapActivity {
        @Override
        protected void onCreate(Bundle savedInstanceState) {
                 super.onCreate(savedInstanceState);
             setContentView(R.layout.maplocator_activity);
        }

        @Override
        protected boolean isRouteDisplayed() {
                return false;
        }
}

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:id="@+id/main"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <com.google.android.maps.MapView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:enabled="true"
        android:clickable="true"
        android:apiKey="ABQIAAAAlCiea28KB-SECRETFROMHERE"/>
</LinearLayout>

11-29 20:02:08.867: ERROR/AndroidRuntime(327): Uncaught handler:
thread main exiting due to uncaught exception
11-29 20:02:08.877: ERROR/AndroidRuntime(327):
java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{com.noi.android.maptest/
com.noi.android.maptest.MapTest}: java.lang.ClassNotFoundException:
com.noi.android.maptest.MapTest in loader
[EMAIL PROTECTED]
11-29 20:02:08.877: ERROR/AndroidRuntime(327):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2068)
11-29 20:02:08.877: ERROR/AndroidRuntime(327):     at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2156)
11-29 20:02:08.877: ERROR/AndroidRuntime(327):     at
android.app.ActivityThread.access$1800(ActivityThread.java:112)
11-29 20:02:08.877: ERROR/AndroidRuntime(327):     at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1580)
11-29 20:02:08.877: ERROR/AndroidRuntime(327):     at
android.os.Handler.dispatchMessage(Handler.java:88)
11-29 20:02:08.877: ERROR/AndroidRuntime(327):     at
android.os.Looper.loop(Looper.java:123)
11-29 20:02:08.877: ERROR/AndroidRuntime(327):     at
android.app.ActivityThread.main(ActivityThread.java:3742)
11-29 20:02:08.877: ERROR/AndroidRuntime(327):     at
java.lang.reflect.Method.invokeNative(Native Method)
11-29 20:02:08.877: ERROR/AndroidRuntime(327):     at
java.lang.reflect.Method.invoke(Method.java:515)
11-29 20:02:08.877: ERROR/AndroidRuntime(327):     at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:739)
11-29 20:02:08.877: ERROR/AndroidRuntime(327):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
11-29 20:02:08.877: ERROR/AndroidRuntime(327):     at
dalvik.system.NativeStart.main(Native Method)
11-29 20:02:08.877: ERROR/AndroidRuntime(327): Caused by:
java.lang.ClassNotFoundException: com.noi.android.maptest.MapTest in
loader [EMAIL PROTECTED]
11-29 20:02:08.877: ERROR/AndroidRuntime(327):     at
dalvik.system.PathClassLoader.findClass(PathClassLoader.java:215)
11-29 20:02:08.877: ERROR/AndroidRuntime(327):     at
java.lang.ClassLoader.loadClass(ClassLoader.java:453)
11-29 20:02:08.877: ERROR/AndroidRuntime(327):     at
java.lang.ClassLoader.loadClass(ClassLoader.java:421)
11-29 20:02:08.877: ERROR/AndroidRuntime(327):     at
android.app.Instrumentation.newActivity(Instrumentation.java:1096)
11-29 20:02:08.877: ERROR/AndroidRuntime(327):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2060)
11-29 20:02:08.877: ERROR/AndroidRuntime(327):     ... 11 more


--~--~---------~--~----~------------~-------~--~----~

2. Keeping ListView rows clickable

OK, either I'm asking a stupid question or I'm not supplying enough
information (as I haven't got a response to this question).  Searching
Google hasn't helped; the ListView reference documentation hasn't helped.
So if I'm being stupid, please forgive me and kindly point me to the proper
documentation.

I want to create a ListView with a custom row that remains tappable and
long-tappable.

If I use the following row (lifted directly from Mark Murphy's book, p90),
everything works as expected:

<?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="wrap_content"
  android:orientation="horizontal">
  <ImageView
     android:id="@+id/icon"
     android:layout_width="42px"
     android:paddingLeft="2px"
     android:paddingRight="2px"
     android:paddingTop="2px"
     android:layout_height="wrap_content"
     android:src="@drawable/icon"
  />
  <TextView
     android:id="@+id/label"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:textSize="44sp"
  />
</LinearLayout>

In Mark's example, the TextView objects are loaded with a bunch of words;
tapping a word puts it into another TextView outside the ListView.

However, adding a CheckBox to the layout breaks Mark's code so that tapping
the word no longer generates the click event:

<?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="wrap_content"
  android:orientation="horizontal">
  <ImageView
     android:id="@+id/icon"
     android:layout_width="42px"
     android:paddingLeft="2px"
     android:paddingRight="2px"
     android:paddingTop="2px"
     android:layout_height="wrap_content"
     android:src="@drawable/icon"
  />
  <CheckBox android:id="@+tasklist_row/star"
      style="?android:attr/starStyle"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginLeft="4px"/>
  <TextView
     android:id="@+id/label"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:textSize="44sp"
  />
</LinearLayout>

It makes sense that tapping the CheckBox should toggle the star.  But I
would expect that tapping the TextView would still select and click the row
and it doesn't.  Similaraly, long-taps are now disabled...

So how do I restore the ability to tap and long-tap on the TextView?

Thanks in adavance and thanks for bearing with my newbie questions.


Regards,

Dave Orme

--~--~---------~--~----~------------~-------~--~----~

3. contextmenu getselectedtestid

4. Need Help animating Text

5. Gallery never converts/recycles Views

6. Best way to select data from file/db?

7. SMS entry