<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.moo.android.myApp"
android:versionCode="12"
android:versionName="1.2.37">
try
{
PackageManager manager = context.getPackageManager();
PackageInfo info = manager.getPackageInfo("org.moo.android.myApp", 0);
int code = info.versionCode;
String name = info.versionName;

// Compare with values on the server to see if there is a new version
}
catch(NameNotFoundException nnf)
{
nnf
.printStackTrace();
}

2.

final Intent intent = new Intent(context, YourService.class);
final PendingIntent pending = PendingIntent.getService(context, 0, intent, 0);
final AlarmManager alarm = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
alarm
.cancel(pending);
long interval = 30000;//milliseconds
alarm
.setRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime(),interval, pending);

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Conversion to Dalvik format failed: Un
  2. 2014年开源夏令营-android下编译libusb和
  3. Android里面用XML定义菜单资源
  4. 设置DrawerLayout不可以点击后面的控件
  5. android播放网络音频
  6. Android:Android系统启动(笔记)
  7. Android系统操作的50个实用技巧
  8. 【Android】Navigation初试-官方demo分析
  9. csr8811蓝牙芯片porting总结
  10. activity启动模式