Android 当应用程序尚未在安卓系统中运行时,会在通知中将数据保存在本地存储中

Android 当应用程序尚未在安卓系统中运行时,会在通知中将数据保存在本地存储中,android,android-sqlite,android-notifications,Android,Android Sqlite,Android Notifications,当推送通知到达且应用程序未运行时,我在本地存储数据时遇到问题。当应用程序正在运行或在后台运行时,它可以正常工作。只需检查清单中的内容即可。。此许可 <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/><uses-permission android:name="android.permission.INTERNET"/> <uses-permission android

当推送通知到达且应用程序未运行时,我在本地存储数据时遇到问题。当应用程序正在运行或在后台运行时,它可以正常工作。

只需检查清单中的内容即可。。此许可

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/><uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<permission android:name="net.simplifiedcoding.androidgcm.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
<uses-permission android:name="net.simplifiedcoding.androidgcm.permission.C2D_MESSAGE"/>

<application>


<!-- GCM Receiver -->
-<receiver android:name="com.google.android.gms.gcm.GcmReceiver" android:permission="com.google.android.c2dm.permission.SEND" android:exported="true">-<intent-filter><action android:name="com.google.android.c2dm.intent.RECEIVE"/><category android:name="com.gnirt69.gcmexample"/></intent-filter></receiver>
<!-- GCM Receiver Service -->
-<service android:name=".GCMPushReceiverService" android:exported="false">-<intent-filter><action android:name="com.google.android.c2dm.intent.RECEIVE"/></intent-filter></service>
<!-- GCM Registration Intent Service -->
-<service android:name=".GCMRegistrationIntentService" android:exported="false">-<intent-filter><action android:name="com.google.android.gms.iid.InstanceID"/></intent-filter></service>-<receiver android:name=".GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">-<intent-filter>
<!-- Receives the actual messages. -->
<action android:name="com.google.android.c2dm.intent.RECEIVE"/><category android:name="com.google.android.gcm.demo.app"/></intent-filter></receiver>

--
--
----

对不起,维卡什,我没有理解你的意思。你能详细说明一下你说的是哪种权限吗?什么是“本地存储数据”?是否要将数据保存到
SharedReferences
,将其写入文件或其他文件中?我正在将数据存储在sqlite数据库中。您到底有什么问题?获取
上下文
以访问数据库?感谢Droidman,现在我正在访问我的类,在那里我将实现放在本地存储数据。但面临另一个问题,“java.lang.NoClassDefFoundError:DatabaseTables at DataSource”。这里的DataSource是我的类,在这里我有逻辑来存储数据。我想在DataSource中找不到该类。您有即时运行吗?它可能会导致这种问题。尝试清理并重建项目