Communication Handling using Service in Blackberry 4.5 - blackberry

I am developing an app. (like google talk) which at phone boot-up starts a background service which is continuously running. This service interacts with UI (means any request to server is first sent from UI to service & from service to server) & any response is sent to UI through service.
What i know to start background service at boot up is "Create an alternate entry point and use that to start the background service. "
right click the project properties then go to Application tab, then check "Auto run on startup" / "System Module"
is it right?
In Android u can achieve this Service using system-defined Service class. How to achieve this in Blackberry 4.5? I want to do it (UI & Service) in one project.
Any solution?
Thanks for the reply.
I got a link for
"How To - Setup an alternate entry point for my application"
is it the right solution for starting Service?
I want the app. like email app. which will notify u when an incoming mail comes (like even though ur main application is minimized then also ur service is running in background which will continuously check for any incoming mail & will notify the main UI application through any app icon change)
So for this is there any class like Service class which will start at boot-up or "Setup an alternate entry point for my main UI application" is the only solution for this?
Thanks for the reply..
I read this GlobalEveltListener & tried for handling the communication between the 2 apps (Service app. & UI app.) by starting the Service at auto-startup.
I m using the "Persistent Store" & accessing it in both the apps. But the Persistent Store name should be unique otherwise it gives "Linker error: Cannot start the Service app. as Persistent Store is multiply defined." But I have to access the Persistent Store the both the apps to make some database calls.
So now i m trying for handling the Service by putting both apps in one project. So that the Persistent Store will be unique.
How to achieve this communication between Service & UI in one project?

You only need an alternate entry point if you want the program to behave in both the service mode, starting at boot and running in the background; and in application mode, having an icon in the home screen that the user can click to begin interacting with your software. In that case you need to have an entry point that tells the program "you are starting automatically at boot up", and one that tells the program "you are starting in response to user interaction".
There are other ways to handle this. If your application makes itself available to the user through ApplicationMenus, then you make the one and only entry point "Auto Run" and "System Module" so that it starts on boot, registers the menus and does not display an icon.
You can also use one entry point set to "Auto Run" but not a system module so the icon is displayed and detect the start on boot case using the ApplicationManager.inStartup() method.
The method you describe does work well for the type of application you are developing. It simplifies the initialization by allowing you to specify different arguments to the program in each entry point.

Please see the answer I have given earlier to a different question here. This essentially is an IPC mechanism between two running processes.

Related

iOS Switch between Parse Server Connections with a button click

Is it possible to initialize Parse configuration more than once in the app through a button?
The scenario is, Add a button inside a ViewController. When clicking, the app switches from my current live parse server to the testing server and vice versa.
Taking into consideration that the app cannot be killed and forced to restart as stated in apple documentation.
You have 2 options:
With Parse IOS SDK - Parse client is a singleton means that you can create only one instance of it. If you don't mind that users will need to close and open your app what you can do is to use NSUserDefaults there you can save the mode of the client (Test or Prod). Again... Users will need to manually restart the app.
Without Parse IOS SDK - it can be done (without restarting the app) only if you will create a custom REST client that will work against Parse REST API. In this way you can create as many client as you want and each client will have it's own configurations.

iOS - Trigger click events outside of the app - like in app drawer

How can you trigger touch and type events outside of your app. I already have created a service that can collect certain data but I can't trigger clicks.
P. S. My requirement is to have a device cloud hosted on the internet and allow people to access them remotely
This is not possible. Apple would never allow such a huge security risk.
You misunderstand how Seetest works. Seetest requires access to your App's binary code, which it instruments:
https://docs.experitest.com/display/public/UFT/iOS+Applications
It then simulates user events by calling event handling methods, e.g. #IBAction handlers. It does not go to the low level that you want, because nothing can unless you violate Apple's usage rules.
EDIT
I was assuming you wanted to write an iOS App that could generate events outside of its sandbox. Instead I think you're referring to Instruments which is controlled by a host.
Because this is a general question, see if this gets you in the right direction:
https://developer.apple.com/library/ios/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/UsingtheAutomationInstrument/UsingtheAutomationInstrument.html
I have managed to do this using Appium java API. First launch a dummy app, then call driver.back() and from there, you will have full control

Modal Application

I'm using Xamarin.Android and I would like to build an application that start in modal way and don't close if you push the home button.
So this application need to be the only one application than a user can use on device.
Somebody can suggest how it can be done?
You best way to do is to make a "Launcher"/"Home" application. The Android SDK comes with a sample on how to do this.
You basically do this by adding your main Activity to the android.intent.category.HOME and android.intent.category.DEFAULT category and you set the launchMode to singleInstance.
This will register it as a Home application, then when you press your home button it should ask you to choose which launcher you want to use. You will have to set it once and it can be changed by the user.
You can find the sample in: android-sdk\samples\android-17\Home\src\com\example\android\home (should also be available in the other API samples).
You cant stop people from installing applications on android devices. You would have to build your own hardware for that however, you can override OnKeyTouch and check for the key being home.
You could build a service that checks the package of each running application and log which applications are run on the device to prevent users from using company property on other things. However, if android ever decides to kill your application the service should stop and this wont work.
Long story short what you are trying to do is flawed in its inception given the platform you are trying to do it on.

Create equivalent of Androids sync adapter on iOS

I got data on a webserver which I want to download to an iOS contact list. Is it possible to programatically create an account on iOS that works like the android "sync adapter" and is not one of the default account or an LDAP/CardDAV account?
Or can I have my application to periodically chech for updates on my webserver without the user having to manually start it. (i.e. running in the background and starting up automatically when the phone is restarted)
No, to both. The best you can do is create a configuration profile that the user can download to add an LDAP/CardDAV account—but you will need to run an actual LDAP or CardDAV server to have any kind of automatic contact syncing happen without the user opening your app. The Address Book framework on iOS only allows you to add and modify contacts within the existing accounts on the device, and the multitasking rules only allow your app to start in the background if it provides a VoIP service.
Use silverstripe-sync !
Source: SO

Building a blackberry application to be invoked by another blackberry application

was wondering if there was a way to build an application that its screens can be called from another application and values can be passed back and forth between the two apps, taking a cull from the Invoke API
the link http://supportforums.blackberry.com/t5/Java-Development/Launch-a-third-party-application-from-another-third-party/ta-p/444753
just shows how to launch one application from another, however i want to launch a specific screen in a separate application and get results from it into the calling application.
You can use an IPC mechanism available in Blackberry, using Global Events. Check the following link : How to communicate with other applications
In short, two applications A and B can communicate by defining an unique id (long) to identify the messages destined to each other. Once this id is defined in both the applications,
To send a message from application A, use postGlobalEvent
To receive messages from application B implement GlobalEventListener.
Complete example is shown here

Resources