get BBM Pin using webworks sdk on Android,windows,IOS - blackberry

I am developing an application for Android,IOS,Windows using Phonegap based on bbm.
But I could not find any way to retrieve bbm pin from device.
Is it possible to retrieve bbm pin from device using webworks api?

Since WebWorks 2.0 it is possible.
To use this API in your project, add the identity plugin:
webworks plugin add com.blackberry.identity
and check read-only String blackberry.identity.uuid
more information:
https://developer.blackberry.com/html5/apis/v2_2/blackberry.identity.html
if you mean uuid related to the BBM Platform (not the Blackberry device uuid) then if you consider the following code:
<script type="text/javascript">
// Create callback invoked when access changes
document.addEventListener("onaccesschanged", accessChangedCallback);
function accessChangedCallback(accessible, status) {
if (status == "unregistered") {
// App is unregistered, proceed to register
registerApp();
} else if (status == "allowed") {
// Access allowed
}
// Listen for other status...
};
function registerApp() {
// Register with the platform
blackberry.bbm.platform.register({
uuid: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" // Randomly generated UUID
});
}
</script>
you can see, that uuid used for register app is just randomly generated uuid. And for your application when you call registerApp generate your own UUID to be used with BBM platform as a unique identifier.
Just found the following information:
Each application must define its own Universally Unique Identifier (UUID) so that it can uniquely identify itself. This UUID is used to register with the BBM SP servers during testing and development. Applications in the BlackBerry App World™ storefront are assigned their own UUID automatically. In BlackBerry WebWorks, the UUID is stored in the options parameter used in registration.
options = {
uuid: "33490f91-ad95-4ba9-82c4-33f6ad69fbbc"
};
blackberry.bbm.platform.register(options);
And below the post there is a short discussion:
Q: can you please indicate where/how to find the AppWorld listed application UUID
A: That isn't visible to you. It's handled automatically.
Q: So how can we use the app's AppWorld UUID to register with BBM? Which was the context in which you mentioned the UUID.
A: In your code you always use your UUID you created. When the application is downloaded from App World the OS will automatically swap out your custom UUID with the one from App World.

Currently this is not possible , Right now BBM does not provide such API may be in future release they provide that

Related

iOS: Detect whether my SDK is installed on another apps on the device

I am developing a location based Q&A SDK for mobile devices.
When a question is asked about a specific location, the server side targets the most relevant user and sends the question to that user. If the user fails to answer, the question is sent to the second best user, and so on.
The problem is that my SDK might be installed on more than one application on the device, meaning that the user can get a question more than once.
Is there a way to detect whether my SDK is installed on more than one app? I thought that sending the UDID to the server might work, but iOS UDIDs differ between applications.
You can use UIPasteboard to share data between applications on the device.
The UIPasteboard class enables an app to share data within the app and with another app. To share data with any other app, you can use system-wide pasteboards; to share data with another app that has the same team ID as your app, you can use app-specific pasteboards.
In your SDK, do something like this:
#interface SDKDetector : NSObject
#end
#implementation SDKDetector
+ (void)load
{
int numberOfApps = (int)[self numberOfAppsInDeviceUsingSDK];
NSLog(#"Number of apps using sdk:%d", numberOfApps);
}
+ (NSInteger)numberOfAppsInDeviceUsingSDK
{
static NSString *pasteboardType = #"mySDKPasteboardUniqueKey";
NSData *value = [[UIPasteboard generalPasteboard] valueForPasteboardType:pasteboardType];
NSMutableArray *storedData = [[NSKeyedUnarchiver unarchiveObjectWithData:value] mutableCopy];
if (!storedData) {
storedData = [NSMutableArray new];
}
NSString *bundleId = [[NSBundle mainBundle] bundleIdentifier];
if (![storedData containsObject:bundleId]) {
[storedData addObject:[[NSBundle mainBundle] bundleIdentifier]];
}
value = [NSKeyedArchiver archivedDataWithRootObject:storedData];
[[UIPasteboard generalPasteboard] setData:value forPasteboardType:pasteboardType];
return [storedData count];
}
#end
If you only want to provide an SDK, it is not possible. Apple has added security steps to prevent that for user privacy. Keychain sharing will not work, because apps must share the same bundle seed ID (see here for more info).
If you want to provide an app along with your SDK, then you could do something like Facebook does, where app sends a "helo" message, Facebook asks user and finally Facebook sends "ehlo" message.
Your App -> "I would like to use the SDK; please give me token" -> SDK Controller App -> (Remember which apps have requested use) -> "OK, you can use the SDK; here is a token: #123" -> Your App
The SDK controller app can now send the server the list of apps.
I think you can group the apps on the same device by IP address as they will use the same address to connect to your server.
So the IP address will represent the device and the API key will represent the app that uses the SDK.
Can you try using
advertisingIdentifier
Not sure whether it serves your purpose. It is explained in here ASIdentifierManager class reference : Apple doc
I think its possible using keychain, you can have an unique keychain key in which you can save anything you want, and can be accessed by other apps if available. So for your SDK, lets say if there is one app, it will register some value in keychain with a unique key which is private to your SDK only if the key doesn't exist, and if it exist you get to know, since you can save any value in keychain, you can try multiple options and combinations which suits you.
You can use KeychainItemWrapper for the implementations.
Elaboration
Lets say we have an method.
[MySDK register];
Which can be used anywhere, say in AppDelegate. The register method will generate a token for the app, for the device, which we will save in the keychain using an unique key we have defined in the SDK, say in com.mysdk.key. And while saving in keychain the SDK can actually do a registration.
We consider the above method is implemented in multiple apps.
Now we have scenario.
User installs an App-A which uses the SDK, the register method will call and create a token and will save in keychain for the first time.
Now user installs another App-B which also uses the SDK, the same register method will call, but now it will check for the key com.mysdk.key in keychain, if exist it will just update the count for the token, which meant for the device.
Note
Keychain not meant to save only unique identifier, you can save other informations too.
Update
Check demo projects https://db.tt/7xpKrgMp
The wrapper I have used in the projects is same as SDK in your case which is same in both the projects.
Cheers.

Web service for deep linking

This is my first time create an ios application that required deep linking. I need to create a web service for my custom url scheme for ios in order to publish it online. Please give some pointer on regarding which web service i should use or is there an alternative way to create a deep linking for custom url scheme for iOS. Thanks.
You can do it yourself with any server platform - Rails, PHP, Dot.Net, etc.
Here is a very simple PHP snippet. Replace "myappname" with your app's URL scheme. The param/value query is optional - you can use any other text and parse it in your App Delegate's openUrl method.
if (strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone OS') !== FALSE) {
// redirect
header("location: myappname://?key=value");
exit();
}
Client use-cases:
iOS Safari, your app installed - will open your app.
iOS Safari, your app not installed - Safari will complain that it cannot open the link.
Another iOS app, your app installed - will switch to your app.
Another iOS app, your app not installed - same as Safari. However, if the other app is implementing UIApplication's canOpenURL: - it may gracefully take the user to the App Store, but it's up to the other app developer.
Any other device or browser - will continue to render the page, where you can add your html including AppStore links.
If you don't want to create the server code, you can use a tool I created for this purpose. You have it here:
http://www.uppurl.com/
It's mainly a short link tool that checks for user device and give him the right url based on his devices. With this tool you don't need to write any server code and it also takes care of different devices, operating systems and browsers.
Take care of Tal answer as latest versions of Chrome has changed the way to open app and now you need to provide a link in different format, they use something like "intent://..."

Get AppWorld link of my app programmatically

Is there any chance to get the app link(link from AppWorld) directly from the code?
It will be very helpful for me since I have more distributions of the same app and don't want to hard-code those links anymore. The link is used to open AppWorld at the app's page in order to update it.
I know that the application descriptor is edited after the app is published, and maybe the appWorld link is included into descriptor.
The App Id is a part of the application metadata. It has the name "RIM_APP_WORLD_ID".
// If you are targeting 4.3+, use this:
String myAppName = "My Amazing App"; //Name of your app
CodeModuleGroup group = CodeModuleGroupManager.load( myAppName );
String appid = group.getProperty("RIM_APP_WORLD_ID");
Check out this sample code Getting Info from the App World

Can Spring Mobile Treat iOS and Android Differently?

Spring Mobile allows a Spring MVC application to detect whether a web client is a desktop/laptop, tablet, or mobile device.
Is it possible to determine if a device is Android/iOS using Spring Mobile? Are there extension points for this, or would it be 'homebrew' functionality?
Spring Mobile does not include built in support to differentiate between Android and iOS. However, it includes two interfaces, Device and DeviceResolver. You can implement custom versions of these that detect Android and iOS devices and offer additional methods, such as isAndroid() or isIOS() for example. Then you can configure DeviceResolverHandlerInterceptor to use your DeviceResolver implementation. When you use the detected device in a Controller you can simply cast it to your implementation. Review the provided LiteDevice and LiteDeviceResolver implementations for inspiration.
I know that this ticket is quite old, but I just wanted to inform you that it is possible with newer versions of spring-mobile-device.
In the latest 1.1.5.RELEASE you can easily access the Device's DevicePlatform. See https://github.com/spring-projects/spring-mobile/blob/1.1.5.RELEASE/spring-mobile-device/src/main/java/org/springframework/mobile/device/DevicePlatform.java
So if you use 1.1.5.RELEASE, you can easily do something like this:
if (currentDevice.isNormal()) {
// do stuff for desktop devices
} elseif (currentDevice.getDevicePlattform() == DevicePlatform.IOS) {
// do iOS specific stuff
} else {
// treat as mobile device
}

Launching BlackBerry and Windows Phone markets from NFC tag if application isn't installed

Is there any way to launch the BlackBerry or Windows Phone markets from a NFC tag when the application isn't installed?
I mean, like AAR in Android platform, if the application that the tag is destined for isn't installed then google play store is launched.
Thanks.
Here is how you can launch an installed Windows Phone app or redirect to the Store if it isn't installed:
Put an NDEF message on the tag with a LaunchApp record as the first record.
Set the platform ID to "WindowsPhone"
Set the app ID to the ID of the app (to get the app ID, just browse the web app store, the ID is at the end of the URL, e.g for Facebook the app URL is http://www.windowsphone.com/en-us/store/app/facebook/82a23635-5bd9-df11-a844-00237de2db9e, the app ID is 82a23635-5bd9-df11-a844-00237de2db9e).
This library on Codeplex that can help to create such NDEF records on Windows Phone.
Code to receive a message from NFC tag
ProximityDevice device = ProximityDevice.GetDefault();
// Make sure NFC is supported
if (device!= null)
{
long Id = device.SubscribeForMessage ("Windows.SampleMessageType", messageReceived);
Debug.WriteLine("Published Message. ID is {0}", Id);
// Store the unique message Id so that it
// can be used to stop subscribing for this message type
}
private void messageReceived(ProximityDevice sender, ProximityMessage message)
{
Debug.WriteLine("Received from {0}:'{1}'", sender.DeviceId, message.DataAsString);
openMarketPlace(message.DataAsString);
}
How To get the app ID to open the app page on the marketplace
private void openMarketPlace(string appID){
MarketplaceDetailTask marketplaceDetailTask = new MarketplaceDetailTask();
marketplaceDetailTask.ContentIdentifier = appID;
marketplaceDetailTask.Show();
}

Resources