Page 1 of 3

Receive URL / content from phone browser / other app

Posted: Mon Jun 16, 2014 1:57 pm
by pjamourik

Hi Guys,

Now I have installed my appery app on my android phone, I have the possibility to share a web-page to it when browsing the internet (via Chrome for instance), by clicking on the menu button of the phone (then all installed apps are displayed).

When I choose the app to share the URL to, I would like to control the behaviour in the Appery app...is this possible?

Thanks in advance,

Peter


Receive URL / content from phone browser / other app

Posted: Mon Jun 16, 2014 3:00 pm
by Kateryna Grynko

Hi Peter,

Could you please clarify, do you need to open a URL within your app? This should be helpful: http://devcenter.appery.io/documentat...


Receive URL / content from phone browser / other app

Posted: Tue Jun 17, 2014 6:57 am
by pjamourik

Hi Katya,

Thanks for the response.

I just want to know how i can handle the incoming data.

I have installed my app (iMonitoring) on my phone. When I browse with Chrome to any website and i press the share button the app is visible, so I can send the current URL / website to the app :

Image

When I click my app in this list it opens, but nothing really happens...I want to be able to handle te received information (For example, open a form and edit the url).

Is this possible?

Thanks again,

Peter


Receive URL / content from phone browser / other app

Posted: Fri Jun 20, 2014 9:55 am
by Maryna Brodina

Hello!

We are sorry for delay! Working on it at the moment.


Receive URL / content from phone browser / other app

Posted: Fri Jun 20, 2014 10:09 am
by Evgene Karachevtsev

Hello Peter,

Please look at this link, it should be usefull:
http://stackoverflow.com/questions/16...


Receive URL / content from phone browser / other app

Posted: Fri Jun 20, 2014 10:18 am
by pjamourik

Hi Guys,

Thanks for the response.

So I need to put next code somewhere in the App :

code
document.addEventListener('deviceready', function () {
window.plugins.webintent.getExtra(WebIntent.EXTRA\_TEXT, function (url) {
// url is the value of EXTRA_TEXT
}, function() {
// There was no extra supplied.
});
});
/code

This must be available on every page I guess, what's the best place to put this? Love to hear your suggestion.

Thanks,

Peter


Receive URL / content from phone browser / other app

Posted: Fri Jun 20, 2014 1:51 pm
by Evgene Karachevtsev

Peter,

You can use device ready event on the start page of the application and place the function in it:

codewindow.plugins.webintent.getExtra(WebIntent.EXTRA\_TEXT, function (url) {
// url is the value of EXTRA_TEXT
}, function() {
// There was no extra supplied.
});/code

Or you can add the event listener (all the code that you sent) into custom js file: Create New - JavaScript


Receive URL / content from phone browser / other app

Posted: Tue Jun 24, 2014 2:05 pm
by pjamourik

Hi Guys,

I'm a bit stuck here.

So my next step will be to add the WebIntent plugin to my project, right?

I don't know how to do so...I am / have read(ing) your tutorial on how to do it, but i'm failing to implement : http://devcenter.appery.io/documentat....

As I understand I have to include 2 files in my app folder, a JAVA file and a JavaScript file (wich can be found here http://devcenter.appery.io/documentat...)...

but where should I place it?

Can you please help me in the right direction?

Thanks,

Peter


Receive URL / content from phone browser / other app

Posted: Tue Jun 24, 2014 7:33 pm
by Evgene Karachevtsev

Hello Peter,

Please clarify, you are are going to add this plugin:
https://github.com/Initsogar/cordova-...
?
There are 2 files:
https://github.com/Initsogar/cordova-...
https://github.com/Initsogar/cordova-...

To understand where to put the files, look https://github.com/Initsogar/cordova-...

i.e.
1) in the Android/projectName/assets/www/files/resources/lib/plugins/
create a folder
com.borismus.webintent
in it create new folder
www
and put in it
webintent.js
2) in res/xml/config.xml add

code<feature name="WebIntent" >
<param name="android-package" value="com&#46;borismus&#46;webintent&#46;WebIntent"/>
</feature>/code

3) in the Android/projectName/src/com/
create a folder
borismus
and in it
webintent
and add the file WebIntent.java in it


Receive URL / content from phone browser / other app

Posted: Thu Jun 26, 2014 10:46 am
by pjamourik

Hi Evgene,

Thanks so much for the detailed information, it helped me a lot...but it's still not working tough.

FYI: All I want to do is to handle the incoming "SHARE-INTENT" from another app.

I have set an alert at the "deviceready" event.

  1. When I just open the App the alert is shown.

  2. When I try to share something from another app the alert is not shown. Strange thing is that some kind of QR code is showing...

    I see some ZXING activities in the AndroidManifest.xml file, I guess this has something to do with the BarCodeScanner? It seems that before the deviceready event is fired, the incoming message is picked up by this plugin.

    Also I wonder why this plugin exists in my project, I did not add it myself!?

    From the StackOverflow answer I also see that I have to add following code to the AndroidManifest.xml :

    code<intent-filter>
    <action android:name="android&#46;intent&#46;action&#46;SEND" />
    <category android:name="android&#46;intent&#46;category&#46;DEFAULT" />
    <data android:mimeType="text/plain" />
    </intent-filter>/code

    In my manifest file following code was allready present :

    code<activity android:name="com&#46;google&#46;zxing&#46;client&#46;android&#46;encode&#46;EncodeActivity" >
    <!-- This allows us to handle sharing any plain text &#46; -->
    <intent-filter>
    <action android:name="android&#46;intent&#46;action&#46;SEND"/>
    <category android:name="android&#46;intent&#46;category&#46;DEFAULT"/>
    <data android:mimeType="text/plain"/>
    </intent-filter>
    </activity>/code

    Is this intent causing the barcode plugin to be activated?

    I really would like to get this thing working ASAP...

    Thanks,

    Peter