how to embedded javascript in blackberry application - blackberry

i am developing an application for login page for linkedIn. so here i know how to log in through java script.but i dont know how to embedded javascript in my application plz help me

1 - Check your Blackberry device OS version before you begin. You can accomplish this step by clicking on the "Options" link and then clicking on "About." You will need to be using Blackberry OS 4.0 or higher; older versions do not support JavaScript.
2- Open your Blackberry Internet Browser by clicking on your "Internet" icon on the home screen of your Blackberry.
3- Click on the "Options" link in the Blackberry Internet browser.
4- Choose the "Browser Configuration" option. Scroll down through the choices shown and click on the option that says "Support JavaScript."
5- Choose "Enable" for "Support JavaScript," which will turn on JavaScript for your Internet browser.
6- Choose the "Save" option. Now simply browse to a web page with JavaScript enabled to test your newly installed setting.
After that create this code to test if it's working :
<script language="JavaScript">
<!--hide
var password;
var numberOfAttempts = 3;
password=prompt('Please enter the password to access this page page!',' ');
if(password > 999 && password < 4001)
{
{
alert('Password Correct! Click OK to enter!');
window.location="http://www.celticfc.net...";
}
}
do
{
password=prompt('Please enter the password to access this page page!',' ');
numberOfAttempts++;
}
while(password <= 999 && password >= 4001)
{
alert('Password Incorrect! Click OK to try again!');
}

Related

React PWA Image Upload in Mobile Safari breaks application?

We were surprised we didn't find any mention of this anywhere online, so we're posting here in hopes we find a solution.
Using an iPhone with mobile safari is when we hit this issue running the 2 easy to follow tests below, one works, one doesn't.
Here is the link
https://pwa-react.netlify.com/
Here are the 2 tests we run (both listed in the link), one works when not in PWA mode, and the other fails when in PWA mode.
Test #1: Works Perfectly (Expected Behaviour)
Visit https://pwa-react.netlify.com/ from iPhone in mobile safari
1. Make sure you have google drive on the phone but not logged in.
2. Click "Choose File". It will show you the list of options to choose from.
3. Click "Browse" to look for the photo.
4. Click "Cancel" and you're back here.
5. Click "Choose File" it will still show you the list of options to choose from.
This works perfectly in mobile safari but NOT in PWA mode below.
Test #2: Does NOT Work (Unexpected Behaviour) (PWA)
Visit https://pwa-react.netlify.com/ from iPhone in mobile safari, hit the share
button, then add to home screen. This will add the PWA app on your phone. Open App.
1. Make sure you have google drive on the phone but not logged in.
2. Click "Choose File". It will show you the list of options to choose from.
3. Click "Browse" to look for the photo.
4. When it shows you the Google Drive logo with Sign In, double click the home
button, then go back to the PWA.
5. Click "Choose File" it will NOT show you the list of options to choose from.
This is now 100% broken.
The ONLY way to fix it is to go to Settings>Safari>Clear History and Website Data (all the way down)
How can we fix this so when the user hits "Choose File" it shows the list of
options to choose from in the PWA?
Screenshot #1: These are the options that appear in Test #1 and stop appearing in Test #2
Screenshot #2: This screen allows us to cancel in Test #1 but it disappears in Test #2
Any idea how to get Test #2 to work by allowing us to choose the upload options like in Screenshot #1 without breaking the app and having to go to safari settings to clear history and website data for it to function again?
PS - Here is the repository file pwa-react/src/App.js
We were facing almost exactly the same issue in our PWA, so first, off I want to thank you for helping us narrow down the cause.
After reviewing the iOS PWA lifecycle (article here) and a couple maddening hours of trial and error I was able to figure out a solution that is semi-acceptable.
My guess at what is happening when you leave the app mid-upload (Test #2) is that there is some internal context in how iOS handles PWA's that is not being reset, so when you go back and try to upload a file again it thinks that the upload dialog is already open.
The article mentions that opening external links without target=_blank will cause the PWA context to be deleted, so when the in-app browser closes, the PWA page reloads in the standalone window. I thought that might reset the "detached upload" context, and it ended up working.
So I created a page hosted on another domain, and linked to it below our upload button in the PWA:
// not sure the target={'_self'} is necessary but not risking it
<a href={'https://externalDomain.com/reset'} target={'_self'}>
Having Issues? Reset Upload
</a>
This works decently well, minus one issue. When you click this link it opens the in-app browser, but there is no "Done" button or navigation tools for the user to know how to exit. Linking back to the PWA does not work, because iOS detects that and does not reset the app context. What I did notice was that if I navigated to another page from the first external page (I originally just tested this with google.com), the "Done" button would show up, making it obvious how to exit.
With that knowledge, I guessed that you could probably just do window.history.pushState to achieve the same effect, which works. My final solution is below. It causes the entire app to reload when the user presses Done from the in-app browser, but that's far better than having them re-add to the home screen in my opinion.
const Reset: React.FC = props => {
React.useEffect(() => {
// Redirect any wayward users who find this page from outside the PWA
if (!window.matchMedia('(display-mode: standalone)').matches) {
navigate('/');
}
// push an additional page into history
const newUrl = `${window.location.href}?reset`;
window.history.pushState({ path: newUrl }, '', newUrl);
}, []);
return (
<Grid container>
<ArrowUpIcon />
<Typography variant={'h5'}>Press done above to return to App</Typography>
<Typography variant={'body1'}>Sorry for the inconvenience!</Typography>
</Grid>
);
};
Hope this helps! Would love to hear if it works for you.
Edit After Production Testing:
An additional important note is that your "reset" page must be on a completely different domain for this to work. Ran into this today in production, because our reset page was on a subdomain with the same root as the PWA, iOS was not resetting the entire PWA lifecycle.
SUMMARY
Key Issues:
Leaving an iOS PWA while any of the "file upload" dialogs are open ('Take Photo', 'Photo Library', or 'Browse') breaks the iOS PWA lifecycle.This breakage makes it impossible for the user to open any "file upload" dialogs when clicking on a file input.
In order to fix this issue, the PWA context must be completely reset.
It seems that the only ways to reset the PWA context are to restart the phone, delete the app and re-add it to the home screen, or to open an external link.
When opening an external link, the "Done" button that closes the iOS PWA embedded browser will not show on the initial page. The user must navigate to an additional external page in order for the "Done" button to show.
External links do not trigger a reset of the PWA context reset when they have target="_blank".
Solution:
In order for the user to be able to upload files again, the PWA context must be reset. The easiest way to do this (in my opinion) is to ask them to open an external link.
(In PWA): Present a link to the user to fix the fact that the upload dialog is not showing. The link destination must be a completely unrelated domain (not a subdomain) and must have target="_self" (issue #5).
(External Page): Once the user clicks on the link and the external page opens, there will be no visible way to leave the page (issue #4). To resolve this, you can use history.pushState to simulate navigating to an additional page.
(External Page - Bonus): To make it clear to the user that the issue has been resolved, add an arrow in the top left pointing to the "Done" button (as shown in my screenshot).

Authentication challenge in Webview component of React Native

I am trying to load a URL in react native webview which needs credentials. Normally when we open this URL in a browser like Safari and Chrome, it give us a popup to enter the credentials. Not sure how to handle it in React-Native?
We require LinkedIn authentication for our React Native application, we couldn't find a way to work with the WebView component.
This may very well be possible, however, I will highlight what solution we came up with. These steps are for an iOS React Native app, steps will differ for Android but the concept is the same. This also does require some server configuration.
We created a URL Type. In XCode, select your project and click on the Info tab. Scroll to the bottom to see URL Types. Fill in the identifier and URL Schemes. Remember what you've set for the URL Schemes. For this example, we will use myscheme.
When the app opens, we use Linking to open up the URL in Safari.
Linking.openURL('https://foo.bar');
The User could then log in via the website, once logged in, you can redirect your User back to.
myscheme://name=Dan
The myscheme matching the URL Scheme you entered within Xcode. As long as you have your application installed and the scheme matches then your app will open.
You can add any payload of information after ://.
In your React application, you can register
componentWillMount() {
Linking.addEventListener('url', this.handleOpenURL);
}
componentWillUnmount() {
Linking.removeEventListener('url', this.handleOpenURL);
}
handleOpenURL = (event) => {
const { url } = event;
if (url.startsWith('myscheme://')) {
// do something with your data.
}
};

Getting error using Apache Cordova Facebook Plugin with ionic and angular js running on Xcode simulator

Requirement:
I am trying to build a mobile app using Ionic, Apache Cordova, Angular Js and Parse. One of the functionalities of the app is- it is suppose to let user login using Facebook (either using native app or browser based login). User will click 'Login with Facebook' button on the 'Sign In' page and that is suppose to open either the native Facebook app (if installed) or browser to redirect to Facebook login page for authentication. Once authenticated user should be able to perform further actions within the app.
Issue:
I am getting the following error on clicking 'Login with Facebook' button in my app within Xcode simulator.
ReferenceError: Can't find variable: facebookConnectPlugin
What I have done so far?
1) Created necessary HTML files with login button, angular js controllers and services for authentication flow.
2) Followed the instructions mentioned in the link below for Facebook authentication part.
https://ionicthemes.com/tutorials/about/native-facebook-login-with-ionic-framework
3) Based on the above article, cloned the plugin to the local directory and then installed the plugin to the app directory using cordova command.
As per the article, I got the plugin from this git URL.
https://github.com/Wizcorp/phonegap-facebook-plugin
4) Plugin installation seems successful. Didn't see any errors on the Terminal. I can also see the plugin folder but it seem to have a folder with name 'phonegap-facebook-plugin' instead of com.phonegap.plugins.facebookconnect. See comments in the above article if you couldn't figure out what I mean. Not sure if this has anything to do with my issue.
5) Build the application using ionic build ios command.
6) Opened the xcodeproj inside platforms/ios folder in Xcode and ran the application on Xcode simulator.
7) When I click on 'Login with Facebook' button, I am getting 'Can't find variable: facebookConnectPlugin' as mentioned in the issue section above.
8) Added following code in the run method in app.js.I have removed the actual parseid, fbids from below code for the sake of this post.
myApp.run(function ($ionicPlatform,$rootScope,$state) {
$ionicPlatform.ready(function () {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if (window.StatusBar) {
StatusBar.styleDefault();
}
Parse.initialize("parseappid", "parsejskey");
if (!(ionic.Platform.isIOS() || ionic.Platform.isAndroid())) {
window.fbAsyncInit = function () {
Parse.FacebookUtils.init({
appId: 'fbappid',
version: 'v2.5',
xfbml: true
});
};
(function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {
return;
}
js = d.createElement(s);
js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
} (document, 'script', 'facebook-jssdk'));
}
});
9) Added the following after body in index.html file.
<div id="fb-root"></div>
10) I even tried to manually add reference to facebookConnectPlugin.js (that was installed as a part of plugin installation) by copying this js file from plugin directory into my js directory (www\js) as some articles suggested in the internet but nothing seem to make it work.
Confusions I have?
1) Do I also need to reference cordova.js in my index.html? I have only referenced ng-cordova.js.
2) Is facebookConnectPlugin suppose to work in Xcode simulator?
Dev Environment I am using
Mac OS X Yesomite, Visual Studio Code, Safari/Chrome, Xcode (v7.1.1)
Mostly testing using Xcode simulator & from Safari Develop
I'm stuck in a similar situation , but I can redirect the user to the login page.
I don't know if this helps you but you take a look.
See Google Firebase: Handle the social login for further details on this.
I know it's from the guys of Firebase but there is one very important sentence in this article:
The best way to build a hybrid app is to deal with the underlying details of Cordova as little as possible. For this, Ionic is your best friend. Ionic abstracts the difficult parts of hybrid development into an easy to use SDK.
But, there still is one area of difficulty. Social login. Logging in with a social provider requires a popup or a redirect. The problem is, this doesn’t exist in the native world. It’s okay though, there’s another way, and it’s easy.
And the "easy way" is to handle the flow manually:
Facebook: Handling the login flow manually
I hope this helps you somehow even though you are using a social login plugin and I don't.
Note: Are you using an inapp-browser?.
Hope this helps

Automatically type text into text box and click button on iOS

I made an iOS app using Ionic Framework (https://appsto.re/cn/EY8s7.i). Is it possible to simulate user input to that app?
For example, user clicks QQ login button in my app, and my app opens the facebook authentication page inside the in-app browser. Now I want the app automatically fill the username and password to the authentication window and hit the "Login" button.
How can I achieve it?
I suppose you want to accomplish this to test your app and some of its functionalities?
If so, you should use Angular Protractor for this kind of testing.
Protractor is a Node.js program, and runs end-to-end tests that are also written in JavaScript and run with node. Protractor uses WebDriver to control browsers and simulate user actions.
Here's an example:
describe('TODO list', function() {
it('should filter results', function() {
// Find the element with ng-model="user" and type "jacksparrow" into it
element(by.model('user')).sendKeys('jacksparrow');
// Find the first (and only) button on the page and click it
element(by.css(':button')).click();
// Verify that there are 10 tasks
expect(element.all(by.repeater('task in tasks')).count()).toEqual(10);
// Enter 'groceries' into the element with ng-model="filterText"
element(by.model('filterText')).sendKeys('groceries');
// Verify that now there is only one item in the task list
expect(element.all(by.repeater('task in tasks')).count()).toEqual(1);
});
});
More info about this matter can be found at AngularJS end-to-end testing.

Convert blackerry program/app into an installable form

I need to send a completed BlackBerry app, for OS 5, to my client in an installable form. What are the ways to achieve this?
I am using the BlackBerry Eclipse plugin and I have a BlackBerry Bold 9000.
Follow this steps:
1) To get Signing Keys you will need to go to the BlackBerry Developer’s web site:
https://www.blackberry.com/SignedKeys/
2) As you finished your registration successfully you will get the confirmation mail with the order number.
3) You will get three different mail(Within 48 hours or within 2 working days) from the devsupport#rim.com which contains
client-RBB-XXXXXXXXX.csi
client-RCR-XXXXXXXXX.csi
client-RRT-XXXXXXXXX.csi
Where “XXXXXXXXX” may be any number.
4) You can configure these .csi files in this ways.
Configure using Eclipse IDE
i. Go to windows > preferences > BlackBerry Java Plug-in > Signature Tool > Install New Key
ii. Please select client-RBB-XXXXXXXXX.csi file which you get from RIM.
iii. You will get the pop up window which ask for password and configure password. Please enter eight digit number which you what to set as you password. And remember it for future use.
iv. After clicking ok button you will get a screen which generates the random information. Please drag your mouse over that screen(Continuously until whole process will be finished) to proceed further.
v. After finishing random info. Generation you will be asked to enter the registration PIN. Please enter same Registration PIN as you applied for Registration.
vi. You will get the success message.
vii. Follows steps (ii) to (v) for client-RCR-XXXXXXXXX.csi & client-RRT-XXXXXXXXX.csi files (Those files that you received from BB server).
5) After finishing the registration process, you are able to sign you BB app. Open the Eclipse, select project that you want to sign, goto “Project-> Blackberry -> Sign With Signature Tool…” Enter the 8 digit password which you entered in step (iii) when following popup screen appears and click on ok.
Note:
Please take back up of “sigtool.csk” & “sigtool.db” from “eclipse\plugins\net.rim.ejde\vmTools” to use the key in case of reinstallation of Eclipse/Blackberry SDK.
after that sign the application using key.
and you can find the ".cod" & ".alx" file in deliverable folder , you can send it to the client..

Resources