launch bbm programmatically - blackberry

How can we launch a blackberry messenger programmatically. Any help would be greatly appreciated. As far as I know the following would get the BlackberryMessenger instance but what can be done to launch the BBM:
BlackBerryMessenger bbm= BlackBerryMessenger.getInstance();

I still urge you to consider my comments above, but you should be able to cause BBM to come to the foreground with:
int modHandle = CodeModuleManager.getModuleHandle( <bbm module name> );
ApplicationDescriptor[] apDes = CodeModuleManager.getApplicationDescriptors( modHandle );
ApplicationManager.getApplicationManager().runApplication(apDes [ 0 ] );
You will have to find out what the appropriate module name is and put that string in the call to getModuleHandle(). BBM has a bunch of modules and I don't know off hand which one is the main one.

Related

Why can't I share both message and image in MMS cordova ios using cordova-plugin-x-socialsharing

I have included the cordova-plugin-x-socialsharing
in my cordova project so I can use the MMS capabilities to share a message and image. This works fine on Android, but I am having problems with iOS. I can share text or an image, but I cannot share both together. Everything seems to work, and the native interface is opened, but if an image is present then the text is missing. I have no idea what might be the issue, I've tried searching the web for similar situations but can't find anything related. However, according to the cordova-plugin-x-socialsharing docs, it appears this is an issue with WhatsApp, but not MMS. If anyone has any ideas about what is causing this problem, or what I can do to fix it, that would be greatly appreciated.
I have included the cordova-plugin-x-socialsharing plugin in my config.xml like this:
<plugin name="cordova-plugin-x-socialsharing" spec="~5.6.5" />
The code I am using to send the message is as follows:
window.plugins.socialsharing.shareViaSMS(
{
message: "Test Message #helloworld",
subject: "Test Message #helloworld",
image: this.shareImageURL //local file system url
},
this.phoneNumber.replace(/\D/g, ""),
function() {
that.showPhoneNumber = false;
that.phoneNumber = null;
},
function(e) {
alert("An Error Occured While Sharing: " + JSON.stringify(e));
that.showPhoneNumber = false;
that.phoneNumber = null;
}
);
Again, I can share the image just fine, but the subject/message will not be included if I share the image. I've tried many different combinations, but nothing has worked so far
Base on the official github already declare iOS will not work message/subject with image together. Either one will share to whatsapp only.
Reference : https://github.com/codeborne/cordova-plugin-x-socialsharing#whatsapp

How to use SpringboardServices to get notifications count of an app ios

How can I get notifications count of another app into my app by using SpringboardServices and SBSPushStore?
I'm trying to show notification count taken from whatsapp into my app so I was searching around and one thing is for sure that it is possible but I didn't find any approbate way on how to do it.Here is the question which answers it but I didn't get it. How to do it? Can someone please share the step by step procedure.
Based on the question I was able to find the code which can actually lock you iphone using SpringboardServices but I don't know how to use it for SBSPushStore?
void *SpringBoardServices = dlopen("/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices", RTLD_LAZY);
NSParameterAssert(SpringBoardServices);
mach_port_t (*SBSSpringBoardServerPort)() = dlsym(SpringBoardServices, "SBSSpringBoardServerPort");
NSParameterAssert(SBSSpringBoardServerPort);
SpringBoardServicesReturn (*SBSLockDevice)(mach_port_t port) = dlsym(SpringBoardServices, "SBSLockDevice");
NSParameterAssert(SBSLockDevice);
mach_port_t sbsMachPort = SBSSpringBoardServerPort();
SBSLockDevice(sbsMachPort);
dlclose(SpringBoardServices);
The answer to that linked question you commented on implies that you don't need any framework, as long as your device is jailbroken.
You simply load the plist file located at /var/mobile/Library/SpringBoard/applicationState.plist. The format of that answer is a bit broken, but I assume the > are meant as indicators to explain the inner structure of the file (i.e. key values).
So from that I assume it's a dictionary, you can load it by
NSDictionary *plistFile = [NSDictionary dictionaryWithContentsOfFile:#"/var/mobile/Library/SpringBoard/applicationState.plist"];
NSDictionary *entryForYourApp = plistFile[#"com.app.identifier"]; // obviously you have to use the identifier of whatever app you wanna check
NSInteger badgeCount = entryForYourApp[#"SBApplicationBadgeKey"];
You probably want to inspect the file yourself first (so set a debug point) and make sure its structure is like I assumed, the types are correct and so forth (not to mention it exists, Apple sometimes changes stuff like that and the other question is already several years old).
In general be aware that you can only do that, as said, on a jailbroken device. Otherwise your application simply doesn't have reading access to the path /var/mobile/Library/SpringBoard/applicationState.plist. Or to anything outside its sandbox, for that matter.

How to get bundleId of the source app when using share extension in IOS8

I wanna know which app calls the share extension to share image to my app(its bundleId or appName). But I found no way to do it. There is none information about the source app in NSExtensionContext. I would greatly appreciate any help.
To achieve what you're asking:
#ifdef HIDE_POST_DIALOG
- ( void ) willMoveToParentViewController: ( UIViewController * ) parent
{
// This is called at the point where the Post dialog is about to be shown.
NSString * hostBundleID = [parent valueForKey:(#"_hostBundleID")];
NSLog( #"**** parent bundle id is %#" ,hostBundleID);
}
#endif
You don't get to find out what app is hosting your extension. That's not part of the extension system. You get to find out what kind of data the app is passing you and, with action extensions, you get to return some data. But you don't get to find out who you're dealing with, only what data is going back and forth.
Your bundle ID is usually com.yourcompany/yourname.yourappname
If you don't know what Xcode has for your company name, create a new project and the screen that prompts you for your app name will have your company name.
Also you can do this,
In Xcode, select your project, then your target (you should have only one) and then the 'Info' tab. You should be able to see the bundle identifier there.
The answer to this question can be found here:
How to get bundle ID?

App launched with custom URL scheme. How do I return data to the calling app when done?

I am taking an Android programming course at my University only I have been allowed by the teacher to do IOS but I have to implement the same projects. This project is to have two apps. The first app is a color picker from a previous assignment. The second app is to call the colorpicker and allow the user to choose a color and when done return it too the second app to be displayed.
I have defined a custom URL scheme in my ColorPicker which works fine. In my second app I have a changeColor button that has the following IBAction method.
- (IBAction)colorChangePressed:(UIButton *)sender {
UIApplication *test = [ UIApplication sharedApplication ];
BOOL found =
[ test openURL:[ NSURL URLWithString:#"colorPicker://" ] ];
if (found) NSLog( #"Resource was found" );
else NSLog(#"unable to locate resource" );
}
This indeed launches the color picker app and it behaves as expected. My question is, after the color has been selected how do I return to the calling app with the selected color? I will add a finished button in my colorPicker to be clicked when the user is done selecting the color and I will capture the values I need but I can't figure out how to get this data back to the calling app. Is there some protocol/delegate pattern I need to implement?
The complete code is on git hub at. https://github.com/jnels124/CS390H
Thanks in advance for any insight as to how to solve my problem.
You need to have both apps with unique schemes. Encode the scheme of app1 and use it as a part of app1->app2 URL. When app2 is finished, you'll have a app2->app1 URL, use itto open app1 and send it required information (encoded).
It is similar as if you've put a String extra to app2 Intent with the name of app1 Intent, but instead of Intent you use URL and parse it as needed.
I defined a custom scheme in the other project as stated in the first answer but I was unsure how to generate the query string in the called URL and return it to the calling application to be parsed. I had this resolved in the following post.
Syntax for passing NSArray to other application with custom URL Scheme

How to get a list of background processes on BlackBerry

I'm looking for something corresponding to net.rim.device.api.system.ApplicationManager.getVisibleApplications(), but including applications that might not/do not have a UI. Any ideas?
Unreasonably complicated work-around solutions welcome, I'm growing slowly more sure that there's not a simple single call to do this...
If you know the application name you can detect if it is running or not by checking the size of the array containing all AppDescriptor actually running this app.
int codeModuleHandle = CodeModuleManager.getModuleHandle(applicationPackageName);
if (codeModuleHandle != 0) {
ApplicationDescriptor[] apDes = CodeModuleManager.getApplicationDescriptors(codeModuleHandle);
}
You could imagine a code to get all installed application and then check

Resources