iOS client side data persistence
by Yavuz Selim YILMAZ
Hi All,
I am trying out the AeroGear iOS lib, and trying to achieve client side data persistency employing AeroGear as much as possible. Here are a few questions I have, and I would appreciate any comments, suggestions and/or directions:
- So, starting from the basic question, how can I retrieve my data stores once user leaves the app and comes back (or, can I do this at all)?
-Then, what is the difference between "MEMORY" type data store and "PLIST" type one (especially considering my goal is data persistence)?
- Or alternatively, considering what AeroGear provides for now, what would be the best approach to implement offline support for the client? (for now, what I know is the lib does not provide DataSync. so data consistency is what I will take care of on my own.)
Thanks for your time to read (and to respond). Bests,
---
Yavuz Selim Yilmaz
SUNY at Buffalo
Computer Science and Engineering
PhD Candidate
11 years, 6 months
AeroGear Push Message Format
by Matthias Wessendorf
This document is devided in two sections:
- Native Push (Android and iOS)
- SimplePush (web-based Push)
<https://gist.github.com/matzew/98762c8d3f516e1abd38#native-push>Native Push
The Unified Push Server allows two different ways to send message to the
native Push API, of the supported devices:
- broadcast
- to all MobileVariants and their MobileVariant Instances (devices)
- to one specific MobileVariant and its MobileVariant Instances
(devices)
- seletive Send
<https://gist.github.com/matzew/98762c8d3f516e1abd38#broadcast>Broadcast
curl -v -H "Accept: application/json" -H "Content-type: application/json"
-H "ag-push-application: {PushApplicationID}
-H "ag-mobile-variant: {MobileVariantID}
-X POST
-d '{"key":"value", "key2":"other value", "alert":"HELLO!",
"sound":"default", "badge":7}'
http://localhost:8080/ag-push/rest/sender/broadcast
If the ag-push-application header is used, a message is send to a
PushApplication and *ALL*MobileVariantIncances will receive the message.
If the ag-mobile-variant header is used, a message is send to a particular
MobileVariant and *ALL* of its MobileVariantIncances will receive the
message.
<https://gist.github.com/matzew/98762c8d3f516e1abd38#message-format>Message
Format
The message format is very simple: A generic JSON map is used to send
messages to Android and iOS devices. The applications on the devices will
receive the JSON map and are responsible for performing a lookup to read
values of the given keys.
<https://gist.github.com/matzew/98762c8d3f516e1abd38#ios-special-keys>iOS
special keys
If the JSON map contains on of the following reserved keywords, Apple
specific hooks will be invoked on the device:
- alert (triggers a dialog, displaying the value - no iOS API needs to
be invoked by the app developer)
- sound (plays a given sound - no iOS API needs to be invoked by the app
developer)
- badge (sets the value of the badge icon - no iOS API needs to be
invoked by the app developer)
<https://gist.github.com/matzew/98762c8d3f516e1abd38#android-special-keys>Android
special keys
None! The JSON map is submitted as it is, directly to the device. There are
no Android specific keywords.
<https://gist.github.com/matzew/98762c8d3f516e1abd38#selective-send>Selective
Send
A message is send to a restricted number of MobileVariantIncances, based on
a given criteria. The following example shows the correspondent HTTP
interface:
curl -v -H "Accept: application/json" -H "Content-type: application/json"
-X POST
-d '{
"alias" : ["user(a)account.com", "jay(a)redhat.org", ....],
"deviceType" : ["iPad", "AndroidTablet"],
"message": {"key":"value", "key2":"other value", "alert":"HELLO!"}
}'
http://localhost:8080/ag-push/rest/sender/selected/{PushApplicationID}
<https://gist.github.com/matzew/98762c8d3f516e1abd38#message-format-1>Message
Format
Besides the actual payload the the API accepts a few *classifiers* to
select a subset of registered devices.
<https://gist.github.com/matzew/98762c8d3f516e1abd38#query-component>Query
component
Currently the Server will support the following query criterias:
- alias: A list of email address (or usernames) to send messages to
*ALL* devices
of the users. Thealias needs to be stored, when the device is
registering itself with the server. See here for
details<https://github.com/matzew/ag-client-push-sdk/blob/master/push-sdk/AGClien...>
- deviceType: A list of raw devices types that should receive the
message (e.g. Coupon only for iPad and AndroidTablets). The deviceType needs
to be stored, when the device is registering itself with the server. See
here for details<https://github.com/matzew/ag-client-push-sdk/blob/master/push-sdk/AGClien...>
<https://gist.github.com/matzew/98762c8d3f516e1abd38#message-payload>Message
Payload
The message format is very simple: A generic JSON map is used to send
messages to Android and iOS devices. The applications on the devices will
receive the JSON map and are responsible for performing a lookup to read
values of the given keys. Like above, iOS specific keywords are honored.
<https://gist.github.com/matzew/98762c8d3f516e1abd38#simplepush>SimplePush
The Unified Push Server allows two different ways to send message to
SimplePush-enabled devices:
- broadcast
- seletive Send
<https://gist.github.com/matzew/98762c8d3f516e1abd38#broadcast-1>Broadcast
Sends a message to all connected devices of a SimplePush variant. The
message (aka version) will be received on the *broadcast* channel (AeroGear
specific broadcast channel, not part of the official spec).
curl -v -H "Accept: application/json" -H "Content-type: application/json"
-X POST
-d '{"version":1234}'
http://localhost:8080/ag-push/rest/sender/simplePush/broadcast/{SimplePus...
<https://gist.github.com/matzew/98762c8d3f516e1abd38#message-format-2>Message
Format
The message format is very simple: The version number is send to the
server, as a JSON object.
<https://gist.github.com/matzew/98762c8d3f516e1abd38#selective-send-1>Selective
Send
A message is send to a selected number of channels, connected against a
specific SimplePush variant
curl -v -H "Accept: application/json" -H "Content-type: application/json"
-X POST
-d '{
"channelIDs":["someID", "moreID...."],
"version":1909
}'http://localhost:8080/ag-push/rest/sender/simplePush/selected/{SimplePush...
<https://gist.github.com/matzew/98762c8d3f516e1abd38#message-format-3>Message
Format
The message format is very simple: A JSON object, containing the actual
payload (version) and an array, containing all the different channels.
<https://gist.github.com/matzew/98762c8d3f516e1abd38#discussion>Discussion
SimplePush and NativePush do have different APIs / endpoints. However,
that's mainly because the SimplePush is really.... simple.... and not 100%
compliant with the richer APIs for Android/iOS.
We *could* (later?) try to unify the API and simply *IGNORE* everything
besides the version, when talking toSimplePush Variant.
--
Matthias Wessendorf
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf
11 years, 6 months
AeroGear Security on Staging
by Bruno Oliveira
Good morning everyone,
I'm planning to release AeroGear Security 1.0.1 on this Wednesday or at
maximum Thursday morning. For this reason: AG Security, AG Security
PicketLink and AG Security Shiro were staged under
https://repository.jboss.org/nexus/content/repositories/jboss_releases_st....
You can also take a look at our example here:
https://github.com/aerogear/aerogear-controller-demo/pull/63.
A complete list of JIRAs solved in this release:
- AGSEC
https://issues.jboss.org/issues/?jql=project%20%3D%20AGSEC%20AND%20fixVer...
- AGJS
https://issues.jboss.org/browse/AGJS-3
Changelog
- AeroGear Security
* Merge branch 'AGSEC-63'
* Updates on README
* Javadoc updates
* License headers, please
* R.I.P AeroGearUser
* Refactoring to generics
* Code clean up
* Make it more decoupled
* Code clean up
* Bump up to snapshots
* Merge branch 'travis'
* enable notifications
* Minimal configuration for travis
- AeroGear Security PicketLink
* Merge branch 'AGSEC-63'
* Removal of old note
* Removing old references to AeroGearUser
* Updates at Javadocs
* License headers, please
* R.I.P AeroGearUser
* Make the implementation compatible with AGSEC
* Living on the edge with PicketLink beta4
* Accept generic entities
* Refactoring and clean up to be compatible with the new release
* Merge branch 'AGSEC-56'
* Inclusion of snapshot repositories
* Code clean up
* Upgrade to PicketLink 2.5 beta3
* Merge branch 'travis'
* enable notifications
* Minimal configuration for travis
- AeroGear Security Shiro
* A little bit of Javadoc
* Travis configuration file
* R.I.P AeroGearUser
* License headers, please
* Update to be compatible with the latest changes on AGSEC
* Readme instructions
* Fixing compilation issues
* Unit testing grant configuration
* Inclusion of unit tests just for the sake of my sanity
* Inclusion of TODO
* Import clean up
* Inclusion of support to secrets
* Extracting methods to Identity management implementation
* Inclusion of authentication validation
* Inclusion of methods for grant
* Addition of .gitignore
* User registration
* Initial support for Shiro
- AeroGear Controller Demo app
* Inclusion of staging repository
* Fixing persistence issues
* R.I.P AeroGearUser
* Updating the demo to keep the compatibility with AGSEC
Feedback is always welcome.
--
abstractj
11 years, 6 months
[aerogear-ios] error on store save
by Yavuz Selim YILMAZ
Hi all,
I am getting error while saving my response object to my store. Here are my codes:
AGPipeline *pipeline = [AGPipeline pipelineWithBaseURL:[NSURL URLWithString:@"localhost"]];
id<AGPipe> dataPipe = [pipeline pipe:^(id<AGPipeConfig> config) {
[config setName:@"persons"];
[config setEndpoint:@"get_persons.php"];
}];
AGDataManager *dm = [AGDataManager manager];
id<AGStore> dataStore = [dm store:^(id<AGStoreConfig> config) {
[config setName:@"persons"];
[config setType:@"PLIST"];
}];
[dataPipe read:^(id responseObject) {
NSError *error;
if (![dataStore save:responseObject error:&error])
NSLog(@"Save: An error occured during save! \n%@", error);
} failure:^(NSError *error) {
NSLog(@"An error has occured during read! \n%@", error);
}];
And I am getting this log output:
Save: An error occured during save!
Error Domain=org.aerogear.stores.save Code=0 "error on save" UserInfo=0x727a6e0 {NSLocalizedDescription=error on save}
here is my "get_persons.php"
<?php
$result_array = array(array(
"id" => 1,
"name" => "yavuz",
"mail" => "yavuzsel(a)buffalo.edu",
"telephone" => NULL
),
array(
"id" => 2,
"name" => "yavuzsel",
"mail" => "yavuzsel(a)buffalo.edu",
"telephone" => "001234"
));
header('HTTP/1.1 200 OK');
header('content-type: application/json');
echo json_encode($result_array);
?>
Any help or direction is appreciated.
Cheers,
---
Yavuz Selim Yilmaz
SUNY at Buffalo
Computer Science and Engineering
PhD Candidate
11 years, 6 months