How to make dynamic apps using Phonegap?

  • 2
  • Problem
  • Updated 6 months ago
Hi there, i am a student creating an app. But having some problems, i still cudn't found that what are the plugins and how we can use i used many from list but all they are not responding. Phonegap Team please help me i just want to create an app with camera(to capture images) and Call(to a particular number) how i can use them? I am using build.phonegap.com using dreamweaver. Thanks in advance. I also attached the screen shot of my app
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes

Posted 4 years ago

  • 2
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes
-I couldn’t also understood use of locationtxt field. Which type of data we will record in this field?
are they okay both table?
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes
Okay Sir i got all your points. But have confusion in locationtxt, and how we will use ActiveY/N with picklist.
Help me!
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
1. You said that this was a small town, not completely covered by Google Maps. So, my thought was to offer the user as many flexible ways to determine the location for the complaint as possible.
Options are:
a. use the device to determine the current location coordinates (which only works if the device has GPS and the user is at the location when filing his complant)
b. use a Google Map, so the user can place a pin on the map, which then returns the location's coordinates
c. as a fallback method, if (a) and (b) can't be used, let the user describe the Complaint position textually (e.g. "Main Road #16", or "East side of the cricket field")

So, in your database, for each complaint, yu will either have a location in coordinates, or a location description.

2. About the activeYN field for Complaint Type: I really don't know how to explain this differently or more clearly. In fact, it's a standard solution to the task of having fixed tables which are managed in the back end.
So, let me ask you how YOU would create the pick list with complaint types in your app. Please describe what you - as an IT student - would do to make this work, and I'll give feedback to that.

3. In your picture, you have values like "320x240" in your image field. Why are you storing the image size? And where do you store the image itself?
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes
Ok Sir i wll send u soon the modified post complain form, I understood what us said now clearly, and in next post i will describe how i will use pick list to retrieve complain type,

-yes i just made roughly picture storage, definitely i will use blob64 as u said before.
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes
Sir, If I will create full app in php, so can you Call it by XHR Calls with ajax to Phonegap build? for me?
I am just scaring to use XHR Call for my php script.
Yes Yes i know all, I also understand all the functionality of web sockets, Sir please for me do this task. I will submit you my app in php. U just use XHR Calls in it Please Please Please and give me android and windows file...........?????Thanks in advance Petra.
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
Sorry, but I can't do that.
You said you had taken on an assignment for a community. With due respect, but if you aren't able to perform such task with the help you get offered here, then you perhaps shouldn't have taken it on.

If this is still a school assignment for you as a student, I shouldn't do that, either. You are supposed to learn this stuff, right?
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes
Sir, right, but please do not break my hope, Okay u do not complete this, u do not complete it yourself, but even you can help me right?
This is not a project/assignment of a school, at part time I am doing this project for my earning. I know that I should study more and complete it, I will, but I just want your guidance, can u?
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes
Now Sir Please Do not Behave Like Automated Internet Bot, i know that You are not that one.
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes
Now want your suggestions.



Sir, please mention my mistakes, thank you
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
This can hardly be true.

You are storing the description of Complaint_Type in the Complaint table, breaking the normalization of the ER model.
-- Suppose, after having received 10 Complaints, the community says: "Now, I want to change the text of "Road and Foothpath" to "Road and Footpath" (or "Road and Sidewalk")....what would your query look like instead of
SELECT * FROM complaints WHERE CompType='Road and Foothpath' (assuming that you already have 5 complaints for that CompType)?

I assume you are also hard-coding the select list for the Complaint_Type (pick list) in the html assets, instead of fetching them from the database, right?
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes
Then Please help me now. :(
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
I already did! I gave you the layout of two tables, and placed the relationship as a foreign key in the Complaints table.
All you need now is a Join over these two tables.
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes
Sorry sir, but which join should i use? Inner?
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes
Sir this point i could understood, means i have to enter complain type in database too??? and fetch array in form? sir please expalin me i can do really
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes
Ok I Got it what u said, i will create like that, but sir let me clear some point like what is activeyn column and Should I fetch data from database into form?
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
You have two tables: "oomplaints" and "compltype"
You have an n:1 relationship, so the PK of compltype is present as FK in table complaints.

Now, to create your select box, you want all active compltypes with their id:
SELECT ct_id, ct_description FROM compltype
WHERE activeYN='Y'
ORDER BY description ASC


To find all unsolved Complaints from last week (I assume you need a datetime field for this, too) with their type:
SELECT complaint_id, lat, lon, c_datetime, ct_description
FROM complaints
INNER JOIN compltype ON ct_id=complaint_ct_id
WHERE c_status=0 AND C_datetime > NOW() - INTERVAL 1 WEEK
ORDER BY c_datetime ASC


[careful with time zones, though!]

May I assume you can create the necessary insert and update queries?
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes
Yes Petra I can do insert and update queries.
So I have to add one more column named datetime with datetime datatype?
Yes It's necessary, Thank You.
and i also got joins.
:)

Sir one doubt more........:D Sorry , I think Petra no one make me disturbed like this before , Sorry


  • Status and Activeyn are same?
  • What is description Column in COMPLTYPE Table? Is it other or?


Thanks in advance Petra
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
'status' was introduced by you, and is apparently an attribute of the Complaint. Such Complaint can be 'received', 'acknowledged', 'solved', 'reopened' or whatnot. You are the process analyst, so you should know best

'activeYN' was introduced by me It is an attribute of Complaint Type. You need this to simulate a delete action, because you can't really delete tuples with existing relationships.
If you want to deactivate Complaint Types in advance (for instance as of next week), then you need a date field instead, and of course relevant queries to find active Complaint Types.
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes
Ohh means by Field 'ActiveYN' I can keep active some rows and deactive, according my need right?
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes
Sir in your two tables i couldn't found complain regarding to:
How We can know which type of complain user sent?
And what is the use of Description? Is it ComplainType Description?
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
How We can know which type of complain user sent?
By fetching the Complaint Type description from the tuple identified by the foreign key in Complaint. That's the whole purpose of the n:1 relationship between the two tables.
And what is the use of Description? Is it ComplainType Description?
Yes, it is
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes
Got it :) Thanks A lot
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes

Thank you Very Much Petra, for being here always, Really you are a good human, May Allah give u long life aameen :)
Sir, i want to be your follower, are you on facebook?
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes
All my doubts and question you solved, even they were not related to phonegap build. I can't you this favor on me. With lots of Respect i wanna pay u thanks by deepness of heart.
Thank You Sir.
:)
see u soon
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes
RESPECTED SIR PETRA, GREETINGS,
SIR ACCORDING TO YOU IN COMPLAINT TABLE,
YOU HAVE DECLARED EMAIL, AND PHONENO FIELDS OF TABLE UNIQUE, AND OTHERHAND WE ARE NOT MAKING THESE FIELDS MANDATORY.
SO WHEN A SAME USER WILL BOOK COMPLAINT SECOND/NEXT TIME, S[HE] WILL LEAVE EMPTY THESE FIELDS?
THANKS IN ADVANCE
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
No, you're right. These should not be unique. They can only be unique if you define a Person entity in your ER model.
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes
Thank you Petra , what is the time there? You are still awaking?
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
I'm currently abroad. It's 8pm here.
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes
Ok Sir thanks for always here :)
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes

<?php
$con=mysqli_connect("localhost","root","","amroclean");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

echo "<select name= 'description'>";
echo '<option value="">'.'--- Complain Regarding to: ---'.'</option>';

$query = mysqli_query($con,"
SELECT description FROM compltype");
$query_display = mysqli_query($con,"SELECT * FROM compltype");

while($row=mysqli_fetch_array($query))
{
echo "<option value='". $row['compltypeid']."'>".$row['description']
.'</option>';

}

echo '</select>';
?>

In the above code, should i use following query instead of Highlighted Query? to fetch data into picklist?

Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
Your highlighted query only returns $row['description'] (of ALL tuples in the database)
However, you want to have returned not only the description, but also $row['compltypeid']. And you want only the active compltypes.

So yes, you need the other query.

What I don't understand is why you don't send a json object with the data only to the app, so you could use javascript to create the select list right there, after receiving the deviceready event. The app, after all, is the presentation layer.
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes
Now i am totally confused :(
I can only create dynamic websites, using php+mysql.
When i used PhoneGap Build, i thought I can directly convert a website into an app, Because i know php i thought i can properly use php with mysql.
:(
How we can fetch database details into a picklist using javascript i dont know :(
Petra You have to help me, i dont know please
I have to complete this app soon.
Please
Please
Please
i dont know javascript properly....:(
Photo of Saba Rais

Saba Rais

  • 724 Posts
  • 3 Reply Likes
Petraaaaa
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
If you're in such a hurry, you won't learn javascript and DOM manipulation quickly enough. Better continue the way you are working now, try and get things working somehow, then learn proper html5/javascript when you have time.

Your php script will generate a complete Select element with Options, right? How are you going to import that in your app and place it in your html template?
(Edited)