我正在接收我的Android设备上的推送通知,但坚持使用任何插件或一些JS代码保存它。
以下是我在Activity onCreate中修改的代码
Parse.initialize(this, "2dkgSPO0Pklpuo3yVjY8KeUQKtNWwpitTFMlMdHF", "O4ViBkcJRo9MrCeiKF49czzVrc7htMcYfdySKFTF");
PushService.setDefaultPushCallback(this, MyPhoneGapActivity.class);
ParseInstallation.getCurrentInstallation().saveInBackground();
以下是我在Manifest文件中所做的更改:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver> // in application tag
答案 0 :(得分:0)
您应该创建一个使用本地存储的商店,然后在推送和同步商店时添加模型:
Ext.define('MyApp.model.Notification', {
extend: 'Ext.data.Model',
config: {
fields: [
// notification fields
],
proxy: {
type: 'localstorage',
id: 'notifications'
}
}
});
Ext.define('MyApp.store.Notification', {
extend: 'Ext.data.Store',
config: {
model: 'MyApp.store.Notification',
autoSync: true,
autoLoad: true
}
});
receiveNotification: function(notif)
{
var store = Ext.getStore('Notifications'),
record = //create your model from notif
store.sync();
}