Android background service

8 posts, 0 answers
  1. Josef
    Josef avatar
    1 posts
    Member since:
    Dec 2008

    Posted 31 Jul 2013 Link to this post

    Hi.

    exists the simple solution, how to create icenium application for iOS and Android, which will be store geo location data, if the application is not running (background).

    For iOS I have found the solution (Background Mode support http://docs.icenium.com/release-notes/v1-5).

    Thanks.

    JZ
  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 01 Aug 2013 Link to this post

    Hi Josef,

    To keep the app running in the background on Android, it’s necessary to acquire a partial wakelock (see android powermanager for more info). In Cordova, you need to use a plugin to achieve this and luckily there is already an existing Cordova plugin to do this. For more information on adding custom Cordova plug-in to Icenium, please see Working with Custom Plugins documentation section.

    Since the plug-in is currently not compatible with Cordova 2.7 and plugman specifications, you would have to modify it in order to be able to use it. We've already posted the instructions for the modification of this plug-in and the modified plug-in itself in this forum thread, so please review them carefully and follow the documentation instructions in Working with Custom Plugins help articles.

    Regards,
    Steve
    Telerik

    Do you enjoy Icenium? Vote for it as your favorite new product here (use short code H048S).
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  3. Josef
    Josef avatar
    3 posts
    Member since:
    Aug 2013

    Posted 02 Aug 2013 Link to this post

    Thanks Steve, I will try Your solution.

    Now I have Push Notification question. I want to send notification from ASP.NET application to device with specific push token, it is possible?

    Send me please example, how can I set this filter.

    Thanks.

    Josef
  4. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 05 Aug 2013 Link to this post

    Hi Josef,

    Here is a sample ASP.NET app that should get you started. You can check out this blog post for more information.

    Regards,
    Steve
    Telerik

    Do you enjoy Icenium? Vote for it as your favorite new product here (use short code H048S).
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  5. Josef
    Josef avatar
    3 posts
    Member since:
    Aug 2013

    Posted 05 Aug 2013 Link to this post

    Thanks,

    but How can I do it with Your Everylive push notification. I want send notification only to specifically devices. Can I use the custom parameters? 

    This works for all devices, but how can I filter this devices?

    EverliveApp myApp = new EverliveApp("API Key");

    Telerik.Everlive.Sdk.Core.Model.System.Push.PushNotification notification = new Telerik.Everlive.Sdk.Core.Model.System.Push.PushNotification(this.MessageTextBox.Text);

    //notification.CustomProperties.Add("Parameters.Age", "16");

    //notification.Filter = new JObject

    // {

    // {

    // "Parameters.Age",

    // "15"

    // }

    // };

    await myApp.WorkWith().Push().Notifications().Create(notification).ExecuteAsync();

    Thanks.

    Josef

  6. Lyubomir Dokov
    Admin
    Lyubomir Dokov avatar
    43 posts

    Posted 05 Aug 2013 Link to this post

    Hi Josef,

    Yes, with Everlive you can target push notifications to specific devices. This is done by specifying a filter when sending the notification.

    There are three most common filtering patterns, I will explain each below. I believe you need the last one (number 3), but I decided to explain each, so that you can get a glance at all the possibilities.

    1. Filtering devices by system parameters.
    A common scenario is to filter devices by some of their system parameters. In Everlive we store some device parameters with each device registration to make filtering easy. Those parameters include OS type, OS version, device type, device locale and some more. You can see all available system parameters in the documentation.

    2. Filtering devices by custom paremeters.
    In Everlive you can specify custom parameters when registering a device for push notifications. They are stored along with the system parameters and can be used for filtering in the same way. You can update the custom parameters as often as you want.  A good example is storing the last time the user opened your app as a custom parameter (e.g. update it every time the users starts the app). Then you could easily send notification only to people who have not opened your app recently and remind them how great your app is.

    3. Filtering by specifying devices explicitly.
    Another common scenario is when you know exactly the devices you want to send to, not some common characteristics they have. Everlive supports sending to certain devices. When you register a device for notifications, it gets a unique ID. You can use this ID in the filter to specify who should receive the notification.

    Example: you have a chat application with chat rooms. When someone joins a room, you associate the ID of its Everlive device registration to the room. When someone posts a message to the chat room, you get the IDs of the device registrations in the room and send a notification to them.

    Here is how to specify filter by device registration IDs:
    var ids = new[] {
        "device_registration_id_1",
        "device_registration_id_2"
    };
    var af = new ArrayCondition("Id", ArrayConditionOperator.ValueIsIn, ids);
    notification.Filter = af.GetAsJson();

    The above is for the .NET SDK. As a REST call (and JS SDK), you must specify the filter like this:
    "Filter": {
        "Id": {
            "$in": [
                "device_registration_id_1",
                "device_registration_id_2"
            ]
        }
    }


    Let me know if you have more questions, I will be happy to help.


    Regards,
    Lyubomir Dokov
    Telerik

    Do you enjoy Icenium? Vote for it as your favorite new product here (use short code H048S).
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  7. Josef
    Josef avatar
    3 posts
    Member since:
    Aug 2013

    Posted 05 Aug 2013 Link to this post

    Hi,
    thanks for response. I write this code:

    EverliveApp myApp = new EverliveApp("API Key");

    Telerik.Everlive.Sdk.Core.Model.System.Push.PushNotification notification = new Telerik.Everlive.Sdk.Core.Model.System.Push.PushNotification(this.MessageTextBox.Text);

    var ids = new[] {

    "62fdd7b0-fb73-11e2-b5af-0d3ac9283676"

    };

    var af = new ArrayCondition("Id", ArrayConditionOperator.ValueIsIn, ids);

    notification.Filter = af.GetAsJson();

    await myApp.WorkWith().Push().Notifications().Create(notification).ExecuteAsync();

    But I get Server internal error.

    Josef

  8. Lyubomir Dokov
    Admin
    Lyubomir Dokov avatar
    43 posts

    Posted 06 Aug 2013 Link to this post

    Hello Josef,

    I tested it again and found the problem. It seems that we have a small bug in our .NET SDK. I fixed it and tested this exact case again and it is working now. Sorry for the inconvenience.

    You can get the fixed SDK from the Everlive Backend Portal. There is also a slight change in the code, this is the updated example (only difference is the ToString() call):
    var ids = new[] {
        "device_registration_id_1",
        "device_registration_id_2"
    };
    var af = new ArrayCondition("Id", ArrayConditionOperator.ValueIsIn, ids);
    notification.Filter = af.GetAsJson().ToString();

    Let us know if you still have problems or you have other questions. We are always happy to help.


    Regards,
    Lyubomir Dokov
    Telerik

    Do you enjoy Icenium? Vote for it as your favorite new product here (use short code H048S).
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
Back to Top