How to remove location services request from PhoneGap iOS 6 app? - ios6

I am using PhoneGap 2.8 to create an iOS 6 app. I am building it in XCode, not using PhoneGap Build. My app does not require location services, but uses the camera. Every time it returns from the camera.getPicture() call, it shows a dialog to allow my app to use location services. If I say no, or location services are disabled, the photo does not get passed back to my app.
This happens even if I deny the camera app location services in the privacy settings. I have also edited my config.xml and removed all references to CDVLocation. There are no references to navigator.geolocation in my javascript code.
Why is it asking for location services? Is there somewhere else in my XCode project I need to remove this permission, or exclude a phonegap module? Does iOS 6 display this prompt to any app that uses the camera, even if the user has already blocked the camera from using location services?
Thanks for any assistance.

It seems that Phonegap automatically add EXIF data to Jpeg image taken with the camera which in turns triggers the location services alert.
There are two ways to prevent that from happening:
1 - Specify PNG for the format of the captured picture (by default phonegap uses JPEG which contains EXIF data)
encodingType=navigator.camera.EncodingType;
function capturePhotoEdit() {
navigator.camera.getPicture(onPhotoDataSuccess, onFail, { encodingType: encodingType.PNG, destinationType: destinationType.DATA_URL });
}
2 - If you want to use JPEG instead of PNG images, you will have to comment out these lines in CordovaLib/Classes/CDVCamera.m between lines 312 and 322. This is the code that adds the EXIF data to the picture.
NSDictionary *controllerMetadata = [info objectForKey:#"UIImagePickerControllerMediaMetadata"];
if (controllerMetadata) {
self.data = data;
self.metadata = [[NSMutableDictionary alloc] init];
NSMutableDictionary *EXIFDictionary = [[controllerMetadata objectForKey:(NSString *)kCGImagePropertyExifDictionary]mutableCopy];
if (EXIFDictionary) [self.metadata setObject:EXIFDictionary forKey:(NSString *)kCGImagePropertyExifDictionary];
[[self locationManager] startUpdatingLocation];
return;
}

Related

Convert video file to byte array and save within app

I am trying save some video in react native app privately. So that i can download videos within app and can watch within app after download. So i am not able to get it how can i do this. Let me know if anybody have resolution for this approach. i was checking that we can convert files into byte than can store within react native app. again then convert into video and can watch it within app. Let me know if this can be done by anyone. Thanks
<Video source={{uri: "background"}}
ref={(ref) => {
this.player = ref
}}
onBuffer={this.onBuffer}
onError={this.videoError}
style={styles.backgroundVideo} />
Watch this video
You can watch the above video. Anybody have a idea that how mx doing this thing. I want to do same. Download videos and save and will be private and play in my app.
For downloading any file like video,img ..
there are two best known libraries for downloading files
https://www.npmjs.com/package/react-native-fs
https://www.npmjs.com/package/react-native-fetch-blob
Now you can follow their documentation to download files like Videos,images or whatever you want to your user's phone.
For the part that you dont want it to be available to user via gallery.
For this you can use react-native-fetchblob as it has builtin intent actions and views. You can download a video file with any random name like 1234CACHE any random name without any extension to it, specially dont give it extension like video.mp4 because gallery detects .mp4 files so dont give it any extension and the file won't be available in any gallery.
Now how to hide the file? react-native-fetch-blob allow us to save files into directories that are not publicly available i mean user cannot reach those directory and these directories are used only for saving App's data so you can save your video file in one of these directories.
Now after completing your download, You can open your file with the Intent.
Example:
const VIDEO_PATH = res.path() //the path where your downloaded video is saved, you will actually receive this in the response of download function.
const MIME_TYPE = "video/mp4"
//Now finally call the intent with video mime so the video will be opened in user's media player, or if you want your own media player you can use any library for that.
android.actionViewIntent(VIDEO_PATH , MIME_TYPE)
you can use https://github.com/RonRadtke/react-native-blob-util to download any remote files

Mobile app with data from TYPO3

I don't know anything about TYPO3.
I have a potential client who pushes content on a website through TYPO3 and now wants to expose some of this content in a mobile application I'm supposed to develop.
I use to implement mobile apps with Ionic.
So I have two questions:
1) Is there a way to read TYPO3 content as a web service so I can call it in my Ionic app ?
2) Is TYPO3 able to expose some part of his content in a responsive website so I just have to configure it and show that website in my webview?
In TYPO3 you can configure any kind of output. That can be the same content in the same structure as the original website.
You can configure additional pagetypes.
jsonPage = PAGE
jsonPage {
typeNum = 1234
config {
disableAllHeaderCode = 1
:
}
:
}
Often this is done for a print-view or a pure text view without tags.
In this way you can output the page content as e.g. JSon or XML.
I even did an output once as PHP includes which had the pagecontent in php-variables.
So you can request abstract data, or the same data with another rendering than the normal page like a special responsive rendering.
Even if you do not want to use TYPO3 at all, you can still make your own queries using php/mysql as all content and page related data (at least should be)is stored in the database and is well sorted there.
(Which is much more work than defining a new pagetype as mentionned above - but could also be an option)

Saving an image captured using ngCordova and Ionic (file service)

I want to save an Image I captured using ngCordova camera plugin in Ionic platform. I know how to capture the image but the Image is gone when I reopen the mobile app. I want the user to be able to take a picture that replace an existing one and also to be able to override that picture if she/he clicks the button again.
My problem is I cannot use cordova file service and local storage to store the image.
refer to Store Image into internal Storage in Ionic?

Local image for marker icon on Cordova/Phonegap Google Maps Plugin

Is it possible to use an image locally store on the device as the marker icon? I can use a URL and it works, but when I try to use a local image it won't load. How should I reference the image? This is a multiplatform application so I can't use device specific paths like Android file:///android:asset/
map.addMarker({
'position': new plugin.google.maps.LatLng(13.7579507,100.5643353),
'title': 'Fortune Town',
'icon': '../templates/icon2.png'
}, function(marker) {
marker.showInfoWindow();
});
I am using Ionic Framework (which uses AngularJS) and Apache Cordova with the Google Maps plugin from https://github.com/wf9a5m75/phonegap-googlemaps-plugin/
It doesn't make too much sense but this is what worked:
'icon': 'www/templates/icon2.png'
Use a storage plugin, like Cordova Storage, and pull it from there, or a local database. http://docs.phonegap.com/en/1.2.0/phonegap_storage_storage.md.html
Capturing and storing a picture taken with the Camera into a local database / PhoneGap / Cordova / iOS

Google App Engine cannot serve some of mp4 files

I uploaded 2 .mp4 videointo blobstore.
When I served 311.0KB mp4 video, there is no problem with it. I can play the video
But when I served 3.3MB mp4 video, video is not loaded. So I went to admin console, and click Blob Viewer menu. When I clicked to see 3.3MB video, it doesn't load as well. Why?
I am using free version of GAE.
After some time I found out that using the X-AppEngine-BlobKey and X-AppEngine-BlobRange is working fine. I use Django and here is part of the code that I use, it should give you the idea how it works
response = HttpResponse()
response['Accept-Ranges'] = 'bytes'
response['Content-Type'] = content_type
response['X-AppEngine-BlobKey'] = blob_key
if 'HTTP_RANGE' in request.META:
response['X-AppEngine-BlobRange'] = request.META['HTTP_RANGE']
return response
Please note that X-AppEngine-BlobRange is set to exactly the same value as range header in request. GAE documentation for that case might be a little bit confusing as the examples show values like "0-499" when it should be set to "bytes=0-499".

Resources