Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Alex1200 · Oct 08, 2012 at 05:51 PM ·

Childbrowser not working with Unity and Phonegap

Hello Everyone,

I am building a iPhone App that uses UNITY3D and phonegap. I have used a basic Unity3D Iphone xcode project, and added some of the native and java code from Gregg's Native UI to Unity project (http://clevermartian.com/blog/?p=59). I then added the files (class files and www folder, etc.)from phone gap to the project. The current result allows me to move successfully from unity to phonegap.

I now need to move from phonegap back to Unity, which should be relatively easy using childbrowser to move from phonegap back to an XIB, where I could call the Unitymessage function. My issue is that I cant get childbrowser to work. I have installed it as directed by their site (changed plist keys, put files in plugin folder, added the link to index, etc.), yet there still seems to be no connection between phonegap and childbrowser. I have created a temporary solution by just adding a button on the phonegap webview xib that allows me to return to unity, but this solution is always on the screen while phonegap is running which is not the desired result. Does anyone have suggestions on how to get childbrowser working for this project?

Thank you in advance for your advise.

-Alex

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Alex1200 · Nov 16, 2012 at 06:43 PM

Hello Again, I solve my problem. I decided not to use Childbrowser in my project becasue I couldnt get it working. Instead I set up a listener in my viewcontroller for the html page, part of it follows:

 if(requestString != nil){
     if([requestString rangeOfString:@"#"].location != NSNotFound){
         NSArray* foo = [requestString componentsSeparatedByString: @"#"];
     int* number = 0;
     for (int i = 0, count = [foo count]; i < count; i = i + 1)
     {
         number+=1;
     }
     if (number == 2);
     NSString* day = [foo objectAtIndex: 1];
     NSString *cheater = @"cphotos";
         if([day isEqualToString:cheater]){
             NSLog(@"OpenUnity");

//Here it then calls the Unity Message command to go back to unity like is done in Gregg's Native UI to Unity project.

This was placed in: - (BOOL)webView:(UIWebView )webView2 shouldStartLoadWithRequest:(NSURLRequest )request navigationType:(UIWebViewNavigationType)navigationType {

So when the user navigated to the 'cphotos' (index.html#cphotos) page they would be forwarded to unity. I also included a 'window.location' in the html for that page to reset the html back to my home page. I am not a programmer so this might not be the most elegant solution but it does allow me to go from unity to html (phonegap) and back in a single app. Hope this helps anyone trying to do similar things, I can try to share more of the process if there is interest.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

Z-index issues 2 Answers

How to perform a task in a specified time 2 Answers

Unity on Google TV?? 3 Answers

ARCamera Issue when migrating to Qualcomm Augmented Reality vuforia-unity-android-ios-3-0-6 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges