• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

retrieve and save data to the cloud

Contributor ,
Nov 05, 2014 Nov 05, 2014

Copy link to clipboard

Copied

Hi,

I'm trying to create an Android app where I can send notifications to users.

In order to send notification to the users, I need their devices ID.

So I'd like to retrieve this info and send it to my server.

For saving the ID here's what I did :

private function pn_registerSuccessHandler( event:PushNotificationEvent ):void

  {

  message( "PN registration succeeded with reg ID: \n" + event.data  );

  _idField.text = event.data;

  mySharedObject.data._idField = event.data;

         mySharedObject.flush();

  sendData();

  }

But what should I put in my sendData function in order to send, in a text format, the informations ?

Thank you for your answers,

TOPICS
ActionScript

Views

917

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 06, 2014 Nov 06, 2014

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 06, 2014 Nov 06, 2014

Copy link to clipboard

Copied

Hmm my question wasn't about how to retrieve the device ID, but how to save and send data to the cloud.

Can I send the information in mySharedObject to a website ?

Steps I'd like to do (but don't know how) :

- Convert mySharedObject into a json or text format

- send the txt file or json file to http://www.exemple.com/data.txt

Thank you !

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 06, 2014 Nov 06, 2014

Copy link to clipboard

Copied

use the urlloader class to send data to your server.  the only tricky part is, "I need their devices ID" and that's why i posted the link in message 1.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 06, 2014 Nov 06, 2014

Copy link to clipboard

Copied

I'm trying to use urlLoader but it's not working and I don't know why..

I've created a php file that I have uploaded. Here's the php code :

<?php

$psPreRegEmail=$_POST['sEml'];

$FRM_ID=$_POST['sID'];

$psBD=$_POST['sBD'];

echo "email=".$psPreRegEmail;

echo "&id=".$FRM_ID;

echo "&db=".$psBD;

?>

Here is my AS3 code :

var request:URLRequest = new URLRequest("http://www.mysite.fr/login.php");

var variables:URLVariables = new URLVariables();//create a variable container

variables.sEml = "steph4";

variables.sID = "steph5";

variables.sBD = "steph6";

request.data = variables;//add the data to our containers

request.method = URLRequestMethod.POST;//select the method as post

var loader:URLLoader = new URLLoader();

loader.addEventListener(Event.COMPLETE, handleComplete);

loader.load(request);//send the request with URLLoader()

function handleComplete(event:Event)

{

var loader:URLLoader = URLLoader(event.target);

var vars:URLVariables = new URLVariables(loader.data);

//Access data from the PHP file

trace("vars.email: "+vars.email);

trace("vars.id: "+vars.id);

trace("vars.db: "+vars.db);

}

No errors, but when I'm going at http://www.mysite.fr/login.php it displays : email=&id=&db=

Why don't I see : ???

email=steph4

id=steph5

db=steph6


Thx

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 06, 2014 Nov 06, 2014

Copy link to clipboard

Copied

I'm starting to wonder if it's possible to send data from an AIR app to a php file on a server ??

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 07, 2014 Nov 07, 2014

Copy link to clipboard

Copied

i don't see a problem with your code, but i'm not sure how you're checking trace output from your air app.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 12, 2014 Nov 12, 2014

Copy link to clipboard

Copied

LATEST

>>I'm starting to wonder if it's possible to send data from an AIR app to a php file on a server ??

Of course it is.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines