android-intent - 调整 phonegap 相机插件以在应用程序中显示 'camera view'

标签 android-intent cordova plugins camera

是否可以在应用程序(使用 phonegap 构建)中打开相机 View ? 我做了一些研究,发现 phonegap 相机插件使用 intents,而我需要做的是使用 android 设备提供的相机 API。我知道我需要对插件进行大量调整,或者创建我自己的插件。我只想知道是否可能

如果可以的话,我会发布进一步的问题

提前致谢:)

最佳答案

如果分辨率是您需要用户配置的全部,这里是 Cordova + Regular Camera 插件解决方案的尝试。显然,您会希望构建比使用内置 Javascript 提示更好看的东西,但这给了您想法。一旦成功,您就可以换掉您自己的自定义 UI 表单的提示以获取解析参数。

function takePictureWithUsersSelectedResolution()
{

    var userSelectedQuality = prompt("Please enter the picture quality"); 
    var userSelectedWidth = prompt("Please enter the picture width");
    var userSelectedHeight = prompt("Please enter the picture height");

    navigator.camera.getPicture
    (                           
        function onSuccess(imageData) 
        {                   
            // save the pic or do something else with it
            yourSaveFunction(imageData);
        }, 

        function onFail(message) 
        {
            // do something with the error
            yourErrorLoggingFunction(message);

        },

        { 
            // *** Main Settings You Need to Customize ***
            quality : userSelectedQuality,
            targetWidth: userSelectedWidth,
            targetHeight: userSelectedHeight            
        }
    ); 

}

有关可以发送到相机插件的设置的更多信息,请参阅文档: http://docs.phonegap.com/en/3.3.0/cordova_camera_camera.md.html

关于android-intent - 调整 phonegap 相机插件以在应用程序中显示 'camera view',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23466013/

相关文章:

java - Android 是一个 Activity 特有的 Intent 还是全局的

java - Android Intent 不开始新 Activity ?

ios 应用程序在测试时工作但在发布后崩溃

ios - Phonegap/ Cordova 1.8.0 : ChildBrowser doesnt work onLocationChange

ios - Flutter iOS 存档版本在 Xcode 中获取 'xx plugin.h' 文件未找到错误

javascript - NPAPI - 在插件中使用 javascript 对象/函数

android - 在没有用户提示或交互的情况下从 Android 卸载应用程序

android - 完成在堆栈中留下 Activity

cordova - 与 Phonegap 分享来自 android 画廊 "share button"的照片

php - CakeDC 用户插件 : How can i install cakedc users plugin, 我已经阅读了文档