The ability to add custom URL scheme directly into config.xml so that a native application can be launched from Safari or other applications on IOS. This is extremely critical since PG Build does not provide XCODE project to edit and only an IPA file.
- 10 Posts
- 3 Reply Likes
- frustrated
Posted 8 years ago
- 8261 Posts
- 263 Reply Likes
Hi Jjsquared
Did you meant that the ability of PhoneGap to launch another application in iOS? If that not the case then could you please elaborate more about your current issue. Perhaps simple use case / code snippet could helps.
Thanks
-Amir
Did you meant that the ability of PhoneGap to launch another application in iOS? If that not the case then could you please elaborate more about your current issue. Perhaps simple use case / code snippet could helps.
Thanks
-Amir
- 4 Posts
- 1 Reply Like
I'd like to see this same thing. Use Case:
App sends an email to the user with a link to view some new content in the app.
User clicks the link
App opens to the specific page.
Would like this on Android as well.
App sends an email to the user with a link to view some new content in the app.
User clicks the link
App opens to the specific page.
Would like this on Android as well.
- 10 Posts
- 3 Reply Likes
Hi Amir,
Specifically, I'm trying to send a user back into the application
after they go out via Safari and authenticate their account with a 3rd
party. After successful authentication, the 3rd party redirects the
user to my specified URL. I understand if I set a custom URL in iOS
such as http://myapp/confirm, the user would be redirected to the
confirm page within my application. I believe this is possible by
editing some settings in XCODE, but would be great if this setting
lived in the config.xml. And if that isn't possible, the ability to download the PG Build XCODE/Android project files rather than just compiled code.
Specifically, I'm trying to send a user back into the application
after they go out via Safari and authenticate their account with a 3rd
party. After successful authentication, the 3rd party redirects the
user to my specified URL. I understand if I set a custom URL in iOS
such as http://myapp/confirm, the user would be redirected to the
confirm page within my application. I believe this is possible by
editing some settings in XCODE, but would be great if this setting
lived in the config.xml. And if that isn't possible, the ability to download the PG Build XCODE/Android project files rather than just compiled code.
- 8261 Posts
- 263 Reply Likes
Hello Jjsquared
Great Idea. Let's leave this idea open so others can vote.
p/s: unfortunately we can't make a topic sticky.
https://getsatisfaction.com/getsatisf...
Cheers
-Amir
Great Idea. Let's leave this idea open so others can vote.
p/s: unfortunately we can't make a topic sticky.
https://getsatisfaction.com/getsatisf...
Cheers
-Amir
- 7 Posts
- 2 Reply Likes
I got a shock to find out this isn't supported already. Why does PhoneGap Build fail to support such important features of application specification as custom URL schemes, minimum OS versions, and so on?
How can we assist with making this happen? Obviously Build (unlike PhoneGap itself) is not Open Source. Who is the right person in Adobe to bring to light the importance of these missing capabilities in the (otherwise excellent) Build service? If we buy an additional support package, can we have this looked at?
Thanks
Tim
How can we assist with making this happen? Obviously Build (unlike PhoneGap itself) is not Open Source. Who is the right person in Adobe to bring to light the importance of these missing capabilities in the (otherwise excellent) Build service? If we buy an additional support package, can we have this looked at?
Thanks
Tim
- 10 Posts
- 3 Reply Likes
Okay, I think I've figured out a workaround for this guys. If you Download your build from build.phonegap.com and then rename the .IPA to .ZIP and unzip the contents, you should have access to the project files. Within the PAYLOAD folder and then your app name, you should have access to the Info.plist file. This is where the changes need to be made for custom URL redirects.
I'm going to investigate trying to modify this file with Xcode, rename back to .IPA, and load it on my phone. Hopefully I have much success. Will report back here my findings.
I'm going to investigate trying to modify this file with Xcode, rename back to .IPA, and load it on my phone. Hopefully I have much success. Will report back here my findings.
- 10 Posts
- 3 Reply Likes
So I was able to edit the info.plist file to add a URL type, a URL Identifier and a URL Scheme. I then tried rezipping the Payload folder and renaming the .zip to .ipa and installing via iTunes, but I get an install error. Not sure if this work around is possible or not. Has anyone else tried this with success?
- 8 Posts
- 0 Reply Likes
Hi jjsquared, were you finally able to find a solution for ios? How about android. This is a show stopper for us using phonegap build.
- 10 Posts
- 3 Reply Likes
I've just posted a solution to this thread. I hope it's not too late for you.
- 23 Posts
- 1 Reply Like
- 8261 Posts
- 263 Reply Likes
Hi Jjsquared
Afaik the moment you extract the payload content, the cert-seal used to authenticate/validate the apps is already being broken. The app is no longer a valid app from iTunes/Application Loader pov.
-Amir
Afaik the moment you extract the payload content, the cert-seal used to authenticate/validate the apps is already being broken. The app is no longer a valid app from iTunes/Application Loader pov.
-Amir
- 8 Posts
- 0 Reply Likes
Amir, Having to try to hack the phonegap build compiled content is kind of ridiculous. Are there any plans to provide this functionality in the config.xml file where it really belongs?
- 10 Posts
- 3 Reply Likes
Thanks Amir. With that in mind, is there a way to edit the info.plist and reauthenticate the app via XCODE or by uploading new files to build.phonegap.com?
- 8261 Posts
- 263 Reply Likes
Hey buddy
None that I am aware of. Must rebuild the app with xcode with the new .plist settings and there is no option for this on Build at the moment.
Sorry.
-Amir
None that I am aware of. Must rebuild the app with xcode with the new .plist settings and there is no option for this on Build at the moment.
Sorry.
-Amir
- 31 Posts
- 0 Reply Likes
- 3 Posts
- 0 Reply Likes
Ouch! I am really disappointed that this was not supported. This is essential!
The best practice on integrating with OAuth based APIs is requiring the use of custom url schemes to handle the callback properly... This is important!
Please!
The best practice on integrating with OAuth based APIs is requiring the use of custom url schemes to handle the callback properly... This is important!
Please!
- 21 Posts
- 0 Reply Likes
I also vote for this feature as this has become a basic feature which needs to be embedded in the PGB at the earliest.
- 7 Posts
- 2 Reply Likes
I am going to chime in again since originally commenting 3 months ago. PhoneGap Build is a great service adding value to a great technology platform. Recent changes such as the addition of the barcode scanning plugin continue to make it more compelling. The lack of this basic capability - transforming one entry in the config.xml to the appropriate representation within the build content - prevents PG Build from being used to make products supporting any kind of inter-app coordination. It seems such a simple change to provide such a powerful capability. Is there anything else that is blocking this development?
- 24 Posts
- 0 Reply Likes
I need support for this so users can for example lauch my application from a link within an email. I would need to be able to get hold of the parameters passed so the app can enter the correct context.
It would be great to have custom URL plugins for all platforms (for me mainly iOS and Android) and be able to configure/enable the URL via config.xml.
Thanks,
James
It would be great to have custom URL plugins for all platforms (for me mainly iOS and Android) and be able to configure/enable the URL via config.xml.
Thanks,
James
- 6 Posts
- 1 Reply Like
it's been a while since we heard from a PhoneGap employee on this one. Does anyone know how to get their ear? There is also another thread on this topic, so it seems that there are several people out there waiting for a feature like this. Personally, I am in a holding pattern since I use PGB exclusively and don't want to do this "by hand" only to have it implemented in PGB the next day. Even knowing that it's not on the list of things to be implemented soon would be helpful for me. Just looking for some feedback from the inside...
- 8261 Posts
- 263 Reply Likes
Hello Everyone
I have open a feature request here, and hopefully this could be discussed & implemented soon. Please watch/follow the issue for latest update.
Thanks
-Amir
I have open a feature request here, and hopefully this could be discussed & implemented soon. Please watch/follow the issue for latest update.
Thanks
-Amir
- 24 Posts
- 0 Reply Likes
Can you also consider adding the ability to check for other applications URL scheme via the javascript API. This would allow phonegap app's to check if google maps is installed on an iPhone before launching a native mapping app.
In the iOS plugin:
- (id)isUriAvailable:(NSString*)uri {
return [NSURL URLWithString:uri]];
}
In Android plugin:
public static boolean isUriAvailable(Context context, String uri) {
Intent test = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
return context.getPackageManager().resolveActivity(test, 0) != null;
}
Thanks,
James
In the iOS plugin:
- (id)isUriAvailable:(NSString*)uri {
return [NSURL URLWithString:uri]];
}
In Android plugin:
public static boolean isUriAvailable(Context context, String uri) {
Intent test = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
return context.getPackageManager().resolveActivity(test, 0) != null;
}
Thanks,
James
- 10 Posts
- 3 Reply Likes
I was able to find a solution for iOS to this while we wait for it to become a feature. Part of this solution involves needing a MAC and XCODE.
1. Build the app with Phone Gap Build service (build.phonegap.com) and download the package.
2. Rename the package from .IPA to .ZIP and extract the contents to a directory on your computer.
3. Launch XCODE and create a new Cordova project (I'm using 2.2.0). For versions after 2.0, you have to create this project via command line. (see this guide: http://docs.phonegap.com/en/2.2.0/gui...)
4. Copy contents of WWW folder from what you extracted from phonegap into the WWW folder for this new XCODE project.
5. Modify your project.plist file within XCODE editor. You will be adding your custom URL scheme to this file. There is a handy guide on how to do this here: http://mobiledevelopertips.com/cocoa/...
6. Add the following function to your AppDelegate.m file: (this forum is duplicating this function, you only need it once )
7. Add a Javascript function to your www/index.html file. This can be inline or placed in an external.js file.
8. Build your project in XCODE. You can test in either simulator or on device.
9. Once your app launches, press home button to place it into the background, and launch safari.
10. Enter your custom URL scheme into Safari: mycustomurl://mycustompage
11. Safari will redirect to your app using the custom URL scheme.
12. You should see your javascript function fire, and the console log will appear in XCODE console.
13. Function not firing? Make sure you are including a reference to the cordova lib js within your index.html:
The only downside to this is now you will need to build and release your project using XCODE, meaning you'll need the proper certificates and provisioning profiles set up on your MAC for this example to work. You will not be able to build using phonegap.build anymore.
Up Next: I will try to figure out a similar solution for Android.
I hope this helps some of you.
Cheers!
1. Build the app with Phone Gap Build service (build.phonegap.com) and download the package.
2. Rename the package from .IPA to .ZIP and extract the contents to a directory on your computer.
3. Launch XCODE and create a new Cordova project (I'm using 2.2.0). For versions after 2.0, you have to create this project via command line. (see this guide: http://docs.phonegap.com/en/2.2.0/gui...)
4. Copy contents of WWW folder from what you extracted from phonegap into the WWW folder for this new XCODE project.
5. Modify your project.plist file within XCODE editor. You will be adding your custom URL scheme to this file. There is a handy guide on how to do this here: http://mobiledevelopertips.com/cocoa/...
6. Add the following function to your AppDelegate.m file: (this forum is duplicating this function, you only need it once )
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
// Do something with the url here
NSString* jsString = [NSString stringWithFormat:@
"window.setTimeout(function() { \n"
"handleOpenURL(
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
// Do something with the url here
NSString* jsString = [NSString stringWithFormat:@
"window.setTimeout(function() { \n"
"handleOpenURL(\"%@\"); \n"
"},1);", url];
[self.viewController.webView stringByEvaluatingJavaScriptFromString:jsString];
return YES;
}
quot;%@
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
// Do something with the url here
NSString* jsString = [NSString stringWithFormat:@
"window.setTimeout(function() { \n"
"handleOpenURL(\"%@\"); \n"
"},1);", url];
[self.viewController.webView stringByEvaluatingJavaScriptFromString:jsString];
return YES;
}
quot;); \n"
"},1);", url];
[self.viewController.webView stringByEvaluatingJavaScriptFromString:jsString];
return YES;
}
7. Add a Javascript function to your www/index.html file. This can be inline or placed in an external.js file.
function handleOpenURL(){
console.log("handle Open URL");
//custom code here such as going to new page
$.mobile.changePage("#customUrlConfirmPage");
}
8. Build your project in XCODE. You can test in either simulator or on device.
9. Once your app launches, press home button to place it into the background, and launch safari.
10. Enter your custom URL scheme into Safari: mycustomurl://mycustompage
11. Safari will redirect to your app using the custom URL scheme.
12. You should see your javascript function fire, and the console log will appear in XCODE console.
13. Function not firing? Make sure you are including a reference to the cordova lib js within your index.html:
<script type="text/javascript" charset="utf-8" src="cordova-2.2.0.js"></script>
The only downside to this is now you will need to build and release your project using XCODE, meaning you'll need the proper certificates and provisioning profiles set up on your MAC for this example to work. You will not be able to build using phonegap.build anymore.
Up Next: I will try to figure out a similar solution for Android.
I hope this helps some of you.
Cheers!
- 1 Post
- 0 Reply Likes
once i get this far, why am I using phonegap build at all? Seems like just building my phonegap app locally is a better solution than this.
- 8261 Posts
- 263 Reply Likes
- 8 Posts
- 0 Reply Likes
How is the usage? The docs only describe config.xml, not how to access the url string from js.
- 8261 Posts
- 263 Reply Likes
Use a global function handleOpenUrl();
example:
detailed instruction:
https://github.com/phonegap/phonegap/...
Thanks
example:
function handleOpenURL(url) {
// TODO: parse the url, and do something
}
detailed instruction:
https://github.com/phonegap/phonegap/...
Thanks
- 1 Post
- 0 Reply Likes
Is there documentation or a timeline for Android support?
This has info for PG code if it helps: http://stackoverflow.com/questions/15...
This has info for PG code if it helps: http://stackoverflow.com/questions/15...
- 8261 Posts
- 263 Reply Likes
This conversation is no longer open for comments or replies.
This conversation is no longer open for comments or replies.
Related Categories
-
PhoneGap Build
- 15111 Conversations
- 275 Followers





