How to first time installation? - blackberry

I have very strange requirement. I have to generate notification (email) when user installs the application on the blackberry device. I have implemented Boolean and save that value in persistent storage with application version.
Also I have to generate the notification even if users deletes and installs the same app (same version) again. But I don't need to generate the notification if device reboots.
Note: Application is a service.
Salman

If you want the persistent store of an application to be deleted when the application is, then you need to use a Pesistable object that is defined in the application. in this case some thing like:
public class DetectMyApplicationInstallation extends Object implements Persistable {
public boolean installed;
public String version;
}
should do the trick. Enhance it to suit your needs.

Related

How to handle app reinstall and locally stored azure notification hub installationID

In our Xamarin Forms app we register via a backend with Azure Notification Hub using the installation Model.
When a user creates an account in this multi user app, an installation object is created, the deviceToken (iOS) is set and the installationId is generated as a new Guid and the installation is sent to ANH. Last, the InstallationId is stored on the device locally. All is well.
Now, when reinstalling the app, the InstallationId is no longer in the settings and we can never again update the already existing installation in the hub. Since the iOS deviceToken has not changed, when running the app, we start receiving push notifications from the previous app install. In our app, in theory this could be a totally different user(account).
How would one go about this?
One thing we came up with is calling the backend to unregister all installations by a specific PNS/deviceToken when the app start detects an empty installationId property in the Settings (aka, first app start) but taking a closer look at the azure api, there is no GetInstallationByPushChannel or something that looks like it.
Thanx in advance!

Multiple iOS apps with single database and single log on

I created multiple apps in android with single database (Content provider) , single log on (which means if i login in one app it should work for all , if I logout from one app it should logout from all other apps) , I have to open one app from another app and every day I have to update all my off line data to server (it should happen particular time on every day ) . Now I am going to port this system (all apps) to iOS , is it possible in iPhone ? And I am not going to submit this apps to app store.
Yes it is possible. You would need to save your database at container url which you can get using:
- (NSURL *)containerURLForSecurityApplicationGroupIdentifier:(NSString *)groupIdentifier;
The groupIdentifier param needs to be same for all the apps and needs to be configured inside Target->Capabilities->App Groups.
Once you have configured same appGroup for each application, you can use above method to save database at the location, provided by the method. That way the same DB would be accessible to all the apps.
There is NSUserDefaults init methid which takes suitename(appGroup), and creates a shared UserDefaults, which can be used for your single log-on purpose.
- (instancetype)initWithSuiteName:(NSString *)suitename;
Refer:
containerURLForSecurityApplication
NSUserDefaults
You can use AppGroups to share files between your apps. Using AppGroups you can implement a Single Sing-On functionality by storing a Bool in your database that each of your apps have access to that indicates whether the user is currently signed in or not and act accordingly when opening one of your apps.

Initiate Parent iOS App Service Call from Today Widget Extension

I am working on a POC iOS application that will eventually be released through an internal enterprise MDM solution. The app itself is pretty straightforward. It makes a quick call to an internal endpoint to return some simple json and then displays it on screen. At the same time, I have an app extension (Today Widget) displaying a small fraction of that data as well.
I have created a shared framework that includes the service calls, as well as any other common code I am using. Unfortunately, the parent app and extension all work perfectly fine if I'm on the internal network where the service endpoints live. However, this app will not always be on our trusted, internal network. As a result, we wrap the build with a secure container provided by our MDM solution and open up traffic to our specific internal endpoints. This works perfectly fine for the app, but our MDM provider doesn't currently provide similar capabilities for App Extensions.
As a result, I am working to come up with creative ways to best ensure the data in my Today Widget is up to date without it directly making a service call. To do so, I am sharing data between the app and extension via an app group, but if the service call is only made from the parent app and the user very rarely accesses the parent app, the data will still be out of date.
In order to simulate making the service call from the app extension to update the data, I would like a way to call the service on behalf of the parent app, which would then update the NSUserDefaults data being shared between app and extension.
So my question: What is the best way for me to initiate that service call in the parent app? Is it even possible? I know Apple provides the 'openURL' method to allow an extension to open it's parent app, but I don't want to actually open the app. I want the app to be running in the background while the extension makes the service call on it's behalf.
I have been looking into the following, but with not much luck:
Parent app has an observer on NSUserDefaults, watching a specific key, that when modified by the app extension will fire off the service call to update the shared data being displayed. Unfortunately, I don't believe this will work, since as long as the parent app is in the background, the NSUserDefaultsDidChangeNotification will not get fired off in the parent app.
Send a local notification from app extension to parent app, telling it to fire off the service call and update data shared via app group. Unfortunately, UIApplication.sharedApplication() is not accessible from an app extension.
Any suggestions of ways to simulate the service call, to give my Today Widget the highest likelihood of being up-to-date with it's information?
Note: Obviously giving Today Widgets access to internal resources has it's own security concerns, but for this POC, the data is non-sensitive and must only live internally..

How to access iOS 8 sms history with private frameworks?

I want to read iPhone's sms history in my app. My application is for my own use (Enterprise distribution without jailbreak) and it's not for apple store so there is no limits for using private frameworks. The solutions I have tested so far are:
Reading the sms database -> Didn't work because of sandbox restrictions.
Using ChatKit; I saw CKConversationList class that has a method -(id)conversations which I guess returns an array of CKConversations. Then I can retreive all the history. The problem is CKConversationList.sharedConversationList().conversations() returns nil when I call it in my app. Although it doesn't return nil when I call it in MobileSMS process (I checked it with a tweak and tested it on a jailbroken phone). I saw a method named +(void)initialize and I called it before calling the above method but it still doesn't work.
IMCore private framework could be used maybe but I don't know how.
Thanks in advanced:)

Blackberry bluetooth pairing to undiscoverable device

Is there anything in the blackberry api or in j2me which would allow communications and/or pairing to a bluetooth device using the MAC address? (Assuming the device is not-discoverable)
Do you want to know how to generally connect to a device given the MAC address or are you interested in how to circumvent Blackberry specific security/permission issues? I have no idea for the latter case, but for the first case, here is an approach:
To do a service search on a remote device, you need an instance of the class javax.bluetooth.RemoteDevice, which you usually retrieve by a device search using a DiscoveryAgent. If you already have a device address you cannot create a RemoteDevice instance directly because the corresponding constructor of RemoteDevice is protected.
To circumvent this, you can create a new class extending RemoteDevice. In this derived class declare a public constructor which takes the device address. This public constructor is then able to call the protected super constructor:
public class MyRemoteDevice extends RemoteDevice {
public MyRemoteDevice(String addr) {
super(addr);
}
}
Now you have RemoteDevice for a specific device address without doing a device scan and without querying the known devices list.
Note: While this approach works according to my experience, it may still fail on a Blackberry device in case RIM implemented some hidden functionality in the RemoteDevice class which is ignored if a RemoteDevice instance gets created as shown here.

Resources