http://www.devx.com/Java/how-to-integrate-facebook-and-twitter-with-java-applications.html?dni=86961901&rni=7006468
Free Android Tutorials, Android Tips, Android Developments, Free Android Codings., Free Android App Examples, Open Source Code for Android
Tuesday, 29 October 2013
Friday, 18 October 2013
Emulator is not starting up
i had facing the problem emulator is not at all starting up
i tried somany way finally i got
run dos comment
then run----------------------
go to SDK and go to platform-tools
then type adb emulator <your emulator name>
if you r getting bad comment error
then check spelling mistake
if something runs
its fine after u can run manually run your emulator it will run
i tried somany way finally i got
run dos comment
then run----------------------
go to SDK and go to platform-tools
then type adb emulator <your emulator name>
if you r getting bad comment error
then check spelling mistake
if something runs
its fine after u can run manually run your emulator it will run
Friday, 4 October 2013
AlarmManager Android Every Day
Calendar calendar = Calendar.getInstance();
// 9 AM
calendar.set(Calendar.HOUR_OF_DAY, 9);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
PendingIntent pi = PendingIntent.getService(context, 0,
new Intent(context, MyClass.class),PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
AlarmManager.INTERVAL_DAY, pi);
Tuesday, 1 October 2013
How to stop service at particular time on Android?
This might be an old question but I came
across this issue myself today and figured a way to do it:
You can use a new service which stops your service, and start that
service in the desired time on a daily basis using alarm manager, like
this:
Define the service which will stop your service:
add the following code after the one you posted, and run the method inside your activity:
this way the service will be scheduled to start as you posted above, and scheduled to stop at 6 as shown in the code I posted. |
Monday, 30 September 2013
How to use alarmmanager 2 times every day?
You can use an interval of AlarmManager.INTERVAL_DAY / 2 :
but if the time of the day in which you fire your alarm matters you can use two calendar objects :
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 10);
calendar.set(Calendar.MINUTE, 35);
calendar.set(Calendar.SECOND, 0);
AlarmManager am = (AlarmManager)getApplicationContext().getSystemService (Context.ALARM_SERVICE);
Intent intent = new Intent(getApplicationContext(), AlarmReceiver.class);
PendingIntent pi = PendingIntent.getBroadcast(getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY / 2, pi);
but if the time of the day in which you fire your alarm matters you can use two calendar objects :
Calendar cal1 = Calendar.getInstance();
cal1.set(Calendar.HOUR_OF_DAY, 12); //midday
cal1.set(Calendar.MINUTE, 00);
cal1.set(Calendar.SECOND, 00);
Calendar cal2 = Calendar.getInstance();
cal2.set(Calendar.HOUR_OF_DAY, 18);//8pm for example
cal2.set(Calendar.MINUTE, 00);
cal2.set(Calendar.SECOND, 00);
and set your alarm manager : am.setRepeating(AlarmManager.RTC_WAKEUP, cal1.getTimeInMillis(),cal2.getTimeInMillis(), pi);
Subscribe to:
Posts (Atom)