How to Access Phone Contacts and Also take Camera Pictures

Please I am new to Framework 7. I need your assistance on
How to Access Phone Contacts and Also take Camera Pictures in framework 7 Mobile App Development

?

I mean How can I open Phone Contacts of an Android Mobile Phone and Also open and take Camera Pictures by clicking on an icon in Framework 7 Mobile App using JavaScript, Ajax
and Html

It is only possible if you use cordova https://cordova.apache.org/. There are plugins for that
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-camera/index.html
https://github.com/apache/cordova-plugin-contacts

Thanks for your Suggestion. But I don’t know how to integrate the Cordova Camera Plugin and Phone Contacts Plugin in Framework 7 using Javascript.
I have read through the above links you gave me but I am still Confused.

Please kindly assist me with a Sample Code for integrating Camera and Phone Contacts for Android using Javascript, Html in Framework 7

Thanks

There is nothing specific about using framework7, any tutorial on accessing contacts in cordova will help. This article seems like a good place to start https://www.raymondcamden.com/2014/12/23/cordova-demo-viewing-all-contacts

1 Like

Thanks for your Suggestions

Also I am having an Issue of after building my framework 7 Android app using build.phonegap.com, The ajax request does not run on Android. But it runs perfectly well on my Laptop Browser before the build.

Please how can I resolve this

?

Do you have an error? It’s likely a CORS Issue.

It not showing any error. The Ajax loading indicator continues to spin without showing any error or message.

What is CORS Issue ?

Please how can I resolve this ?

Can you post any code? are you running your app on a device or an emulator, and if so what debugging have you done.

I am running the app on an Android device.

I am new to all of these.

It Hybrid App is running the ajax request properly on a browser BUT when I compile it by zipping the files and Uploading it to build.phonegap.com. The generated Android apk does not fire the ajax request.

Please kindly assist me on how to debug or resolve this.

Thanks

I understand, but I do not have enough information to help you. Have you connected the device to chrome dev tools on a computer? This is not a framework7 specific issue so I encourage you to look more broadly at debugging cordova android apps.

What happens is that when I run the app on an Android Device, the AJAX error function comes up as the response.

It seems that the app does not see my internet connection on my Device. I have repeatedly checked the internet connection on my device and the internet connection is working very well for other Apps on the Android Device.

Please give me a ;guide on how to resolve this.

Also how can I connect the device to chrome dev tools on a computer ?

I am new to all of these.

Thanks

I have just tried to debug it but I got the following errors on my console:

[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/features/5093566007214080
y @ framework7.min.js:18

My-app.js Code are as follows:

// Initialize your app
// var myApp = new Framework7();

var myApp = new Framework7({
animateNavBackIcon:true,
template7Pages: true,
precompileTemplates: true
});

// Export selectors engine
var $$ = Dom7;

// Add view
var mainView = myApp.addView(’.view-main’, {
// Because we use fixed-through navbar we can enable dynamic navbar
dynamicNavbar: true
});

// Funcion to handle Submit button on Login page
$$(’#submmit-login’).on(‘click’, function () {

var username = $$('#username').val();
 var password = $$('#password').val();
 
 if (!username || !password){
  myApp.alert('Attention! Please fill in all Registration form fields');
  return;
 }

console.log('Submit clicked');
console.log('username: ' +username);
console.log('password: ' +password);

myApp.showIndicator();

$$.ajax({
		url: 'https://tdcmobilestore.com.ng/apimobileapp/auth.php',
		method: 'POST',
		data: { 
				username: username, 
				password: password 
		 }, 
					
		success: function(response){

		myApp.hideIndicator();
		
		  var reply = response.replace(/\s+/, ""); //remove any trailing white spaces from returned string
  			
		let obj = JSON.parse(reply);
				
			if(obj.response == "OK"){

			  localStorage.setItem("username", username);
			  localStorage.setItem("password", password);
	
				myApp.alert('Success ! You Have Logged In');
	
				window.location= 'great.html';	
			}
			
			else{
				myApp.alert('ERROR. FROM DB' + reply);
			}
		},
		
	 error: function(response){
	
			myApp.alert('ERROR FROM AJAX' + response);
	 }
		
	});

});

Please assist me to resolve this

Thanks