This is a migrated thread and some comments may be shown as answers.

Android background service

7 Answers 123 Views
Feedback & Suggestions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Josef
Top achievements
Rank 1
Josef asked on 31 Jul 2013, 08:18 AM
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

7 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 01 Aug 2013, 12:45 PM
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.
0
Josef
Top achievements
Rank 1
answered on 02 Aug 2013, 11:44 AM
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
0
Steve
Telerik team
answered on 05 Aug 2013, 11:43 AM
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.
0
Josef
Top achievements
Rank 1
answered on 05 Aug 2013, 11:59 AM
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

0
Lyubomir Dokov
Telerik team
answered on 05 Aug 2013, 01:11 PM
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.
0
Josef
Top achievements
Rank 1
answered on 05 Aug 2013, 02:40 PM
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

0
Lyubomir Dokov
Telerik team
answered on 06 Aug 2013, 10:09 AM
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.
Tags
Feedback & Suggestions
Asked by
Josef
Top achievements
Rank 1
Answers by
Steve
Telerik team
Josef
Top achievements
Rank 1
Lyubomir Dokov
Telerik team
Share this question
or