Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/186.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android警报接收器未在果冻豆上启动_Android_Service_Gps_Broadcastreceiver_Alarmmanager - Fatal编程技术网

Android警报接收器未在果冻豆上启动

Android警报接收器未在果冻豆上启动,android,service,gps,broadcastreceiver,alarmmanager,Android,Service,Gps,Broadcastreceiver,Alarmmanager,我已经创建了一个应用程序,其中包括将GPS坐标发送到服务器的服务。因此,目前我正在通过报警类激活服务,即,如果我们说60秒,则应启动报警类并启动服务,然后关闭 这些都是android 2.3.6版本的所有功能。但若我尝试在果冻豆上工作,警报接收器和广播接收器都不会呼叫 I have registered the receiver in the manifest file like below, <receiver android:name="com.receivers.AlarmR

我已经创建了一个应用程序,其中包括将GPS坐标发送到服务器的服务。因此,目前我正在通过报警类激活服务,即,如果我们说60秒,则应启动报警类并启动服务,然后关闭

这些都是android 2.3.6版本的所有功能。但若我尝试在果冻豆上工作,警报接收器和广播接收器都不会呼叫

I have registered the receiver in the manifest file like below,

   <receiver android:name="com.receivers.AlarmReceiver"/>
最后我有了
GPSLOggerservice
类,它将lat,long发送到服务器


所以我的问题是,当时间到来时,没有调用报警接收器,因此我无法启动服务。如何在更高版本(如Jelly Bean和更高版本)上克服此问题?但是,正如我之前测试的那样,它在较低版本(如2.3.6)上运行良好。

从Honeycomb的发行版开始,BroadcastReceivers安装在停止状态,并且在应用程序实际运行之前不会触发,也就是说,您必须至少运行一次活动


请查看@and@

了解Jelly Bean您是否在使用HTC设备?不,我在使用三星。好的,您的项目中有任何活动吗?是的,我有活动。它是否在Jelly Bean上提供NullPointerException?
public class AlarmReceiver extends BroadcastReceiver 
{
        @Override
        public void onReceive(Context context, Intent intent) 
        {
        //Intent i = new Intent(context, GPSLoggerService.class);
        //i.setAction("com.varma.samples.gpslogger.receivers.KEEP_ALIVE");
        //i.putExtra("screen_state", screenOff);
        //context.startService(i);
        //System.out.println("hi::");
        context.startService(new Intent(context,GPSLoggerService.class));
        }
}